From patchwork Thu Aug 22 18:37:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3329 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id EDB3740F40 for ; Thu, 22 Aug 2024 20:37:48 +0200 (CEST) Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4281ca9f4dbsf8784445e9.0 for ; Thu, 22 Aug 2024 11:37:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1724351868; cv=pass; d=google.com; s=arc-20160816; b=RVQN6CeTxuO4JfBvZ39XRgyv9iJBHFWYHAh87MbeBKpksV/T7X2O6sy/VMtk1OYwKc KTNCTSZC8seHRg6bITEfTDPNmOU2kFIOvpe9WmxUAdgq5+xqAjOPAMe9i61sEQL+wibf u9flnRR2TdNKliq1nfHS0mOLYtEkfu9xr9SsP3xYSPF3BZ9bkOT6Wz6YObsuuVSMTuW+ pf+F/+qiv2DA/Riinpjdj8RdWzYAp4BtCZ34RBHEafCPMoi3fr57CZ2US2JW+Anp/W61 xLebQR7gYf2C11TtyccHXp6J5I57oY9xuDfYnsf0YcGOdQ1qkHodpRATp1Z3fWeZ1S9G ZR7A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=9Tzlt+BdPYcy4EVQmD79iN3E6kejaQPiWA2ibvl6JCs=; fh=uaP0oTPex2asVER3FfLdHMBFbcdhweMnNFX3EYV6f7U=; b=ZPyNnCX9wrjLfrjFrQNl4PHgUW+S8ayFFEUTgm1PGMw9hw8Ckdat2jSyKvsTNEObeQ puK6vwG1XtiZTXzY+hLKeXvARet2oFYKMhQwLrJ4pL6cRuwn5JlPZ31bbJ7fQIGMjFDO Gz/UatulqP0M2MFFg4TO0HmeKbplRner8ioaucmKBajKyN3/TzsgpXObAsvmhOCd/2nQ ooDilOhrlMUgKXkkboH2SXlZGjKnxs05eBQlx551Xrqz7THFeP+13YVT2D3d2lFV1I9y LNdbDnlRWsXvPe6MDlUjxcCHEIYICyRp3srq4JbRhw35TZO1USiIZcBDoqtGoi66cZvQ u5VQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XvGGyTLz; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1724351868; x=1724956668; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=9Tzlt+BdPYcy4EVQmD79iN3E6kejaQPiWA2ibvl6JCs=; b=osgXqAGDMEFavp/bRf5TgiGtf3c5yTD/mDbpdj6m2eke/Pd+lr8TLe/rn0fTnAljGy isIsklDDvmoxkwcG7aoWBWd8HDA5jivGYM3FDiu4BPUuLXDgT5gWpJiHjR3o4tiC3fw3 Ft4t3ZQC8/KsG532jgUEYyr7Tgg1f9OVQIiTM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724351868; x=1724956668; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9Tzlt+BdPYcy4EVQmD79iN3E6kejaQPiWA2ibvl6JCs=; b=NMUogYHEdKpQTRvkKBd8BFqaS3KcQHCWok4yIJVnXXoG3YpdudXjcyUCe6xPmZEY85 yTFMykTFI6MYLuTs2QjvU0lbm8C/DPbo5mfcYY2dxwff0+mJum9eY+oJZ31kODtkMlJy t93lJ/G7/Ht8jmdotLXfFVmD4SIk/i74QElHkHIiemLLUADDTj5/63lyOt8xqIOLhgMK Vz42JKgLFiA2ytksYqOWnGFQ4Ke3c33yBN0LaUj9e5w37JtNpUEsBUGc8gvbMvYKUYAX ujrUECfeHcwdHIJLq2xyO6QedeixSJgyCXnZ8cBruhIJ2gDBIlstOTYnUG44Lxiue7Nw XV8g== X-Forwarded-Encrypted: i=2; AJvYcCVEEAEGNegvbrIWxktthWHLLFTRbo1KJsE5FC3p3nYWTiJI0rdO/w6aUJark2z0ZifhhaT2mxdaKzhl+1/D@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yx8FqU0wqI4PziZAgJ1TubqxdW8I1Vb9g7AQhyxy68JiL0yss4H 6J5b/aJVeYI8XO7ScMfSJzCfhhJDKSjssh35kAD+5LLXx7829gsS+aH4UrFkRzc6xA== X-Google-Smtp-Source: AGHT+IHVv0QUfKTDXhGyuauln9JGyadBJCvuGZX4JOXpRK8/2gSRyJNf7q8OBsZzc7MVcMo/LHf7tw== X-Received: by 2002:a5d:438d:0:b0:368:460a:961d with SMTP id ffacd0b85a97d-372fd5bb9dbmr3952396f8f.3.1724351868492; Thu, 22 Aug 2024 11:37:48 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:adf:fe4e:0:b0:368:4489:3f40 with SMTP id ffacd0b85a97d-37305dd255els316491f8f.2.-pod-prod-07-eu; Thu, 22 Aug 2024 11:37:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWo0SX7CRiLBgmzhm8gNl+02mLNayWbxqDikwbtL8z9mJYAc3Iya0qlZEbrP9xhUY8aM72ZEhUwYpwoUQNx@amarulasolutions.com X-Received: by 2002:adf:fc87:0:b0:364:348:9170 with SMTP id ffacd0b85a97d-372fd92b2bcmr4185552f8f.54.1724351866719; Thu, 22 Aug 2024 11:37:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724351866; cv=none; d=google.com; s=arc-20160816; b=InjHXCgQSoJVQ2tYvVkuTyMHOo8DHhPA2LEIuh7MHrZ2RsC4hey/lJAbe57n5674CO TXDvjyg9GjSCEf4bT1XyG9LZvOLIKLQRZqgEDmepFmvdbpR0tuI0/IIc+CNi+KnEmL++ tCxAxBc4bzw5SnZI7m0+vw/ZzMUMNVfqGJGRZWsQ7kFQXJnFD/aSK2tGY3fPM9fAt4rV fOQ1MQhMQmMs8TQ+C1iwwP3mIbX7NcYb4X6xSyrpK61S1lZa9SKDExVKKY3Qr16JDX6Z PYp/fVqorWnrk4oxmtFyXd78QRY+4WajeDSFvRNWLls2bMCpb5gyzRr6ooAv6GCtALGj Y3Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=rKzCjo3qdZIf2pi418S63Vz2bGbb0Xdz5SnU/PMgetQ=; fh=fGUT6C+qo4rASkpziVnqryM5OSgskCdWowl9TGMdeuE=; b=PqrHaNwbsBRtd91cl6wIYcUitGV0uUYNlSmDCohCRMltWt5EKH0s6T+c4d/WJDC5wJ /bjPkOo+AhogmVn7B7tmSBifISX6qeQNE7FrfyTHexFstoQaJvUuUQi7E/XqwU7lp5Zy 8aawUxkOCBhzqSLL07YN00rTWqfxrcobxo8wjJD6n8bfmhIAzFBSaumaXDgt/fioe4Fe bFlEY99en51Rt1Jz7xSMboEa5NYurM09mcUgZMXu/RZ/g75lBAn6nsVx/eKPZMVotl8L ZFLDSJz1YFB1KvDpK7uMdDnUMBOfegtNeaGtF2ruWJX4o2yuCfDeCtsh8MkdN0CdNhpp aimA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XvGGyTLz; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ffacd0b85a97d-3730826b0desor416049f8f.8.2024.08.22.11.37.46 for (Google Transport Security); Thu, 22 Aug 2024 11:37:46 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCXJ8y11cgwJPplmZl37GfxteCxYsPLZYyZL0w1j4KVqki5SDXtln88Qbp9z9dT/vbY9XbNaoFjJ/TuRiSIW@amarulasolutions.com X-Received: by 2002:adf:a3d0:0:b0:371:8a74:4170 with SMTP id ffacd0b85a97d-372fd6d5744mr4225924f8f.24.1724351866197; Thu, 22 Aug 2024 11:37:46 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.. ([2.196.40.166]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3730811001fsm2276397f8f.20.2024.08.22.11.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 11:37:45 -0700 (PDT) From: Dario Binacchi To: buildroot@buildroot.org Cc: Dario Binacchi , Damien Le Moal , Thomas Petazzoni , "Yann E . MORIN" , linux-amarula@amarulasolutions.com Subject: [PATCH v3 1/3] package/tinyinit: new package Date: Thu, 22 Aug 2024 20:37:40 +0200 Message-ID: <20240822183742.3550055-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240822183742.3550055-1-dario.binacchi@amarulasolutions.com> References: <20240822183742.3550055-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XvGGyTLz; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This package contains a Linux init script suitable for resource-limited systems which can be used as an alternative to the one provided by Busybox. Signed-off-by: Dario Binacchi --- Changes v2 -> v3: - Add the init script - Drop the entry in the init selection in system/Config.in. Changes v1 -> v2: - Rename tinit to tinyinit. - Put the script inside the tinyinit package without the need to use a github repo. - Update the commit message. DEVELOPERS | 1 + package/Config.in | 1 + package/tinyinit/Config.in | 10 ++++++++++ package/tinyinit/init | 32 ++++++++++++++++++++++++++++++++ package/tinyinit/tinyinit.mk | 12 ++++++++++++ 5 files changed, 56 insertions(+) create mode 100644 package/tinyinit/Config.in create mode 100644 package/tinyinit/init create mode 100644 package/tinyinit/tinyinit.mk diff --git a/DEVELOPERS b/DEVELOPERS index d7d0af35431b..45cc1cc48996 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -791,6 +791,7 @@ F: configs/imx8mn_bsh_smm_s2_defconfig F: configs/imx8mn_bsh_smm_s2_pro_defconfig F: configs/stm32f769_disco_sd_defconfig F: package/sscep/ +F: package/tinyinit/ F: package/uuu/ N: Dario Binacchi diff --git a/package/Config.in b/package/Config.in index 317f859684fe..ddf378b13e01 100644 --- a/package/Config.in +++ b/package/Config.in @@ -2869,6 +2869,7 @@ menu "System tools" source "package/tar/Config.in" source "package/tealdeer/Config.in" source "package/thermald/Config.in" + source "package/tinyinit/Config.in" source "package/tpm-tools/Config.in" source "package/tpm2-abrmd/Config.in" source "package/tpm2-tools/Config.in" diff --git a/package/tinyinit/Config.in b/package/tinyinit/Config.in new file mode 100644 index 000000000000..2ceb8e191e23 --- /dev/null +++ b/package/tinyinit/Config.in @@ -0,0 +1,10 @@ +config BR2_PACKAGE_TINYINIT + bool "tinyinit" + depends on BR2_INIT_NONE + help + A Linux tiny initialization script suitable for resource + limited systems, which can be used as an alternative to the + one provided by Busybox. + +comment "tinyinit needs BR2_INIT_NONE, i. e. no init system installed" + depends on !BR2_INIT_NONE diff --git a/package/tinyinit/init b/package/tinyinit/init new file mode 100644 index 000000000000..fbcb481010c2 --- /dev/null +++ b/package/tinyinit/init @@ -0,0 +1,32 @@ +#!/bin/sh + +# This script replaces the default busybox init process to avoid having that +# process staying alive and sleeping in the background, (uselessly) consuming +# precious memory. + +# Mount procfs and sysfs +/bin/mount -t proc proc /proc +/bin/mount -t sysfs sysfs /sys + +# When the kernel is directly booted, devtmpfs is not automatically mounted. +# Manually mount it if needed. +devmnt=$(mount | grep -c devtmpfs) +if [ "${devmnt}" -eq 0 ]; then + /bin/mount -t devtmpfs devtmpfs /dev +fi + +# Use the /dev/console device node from devtmpfs if possible to not +# confuse glibc's ttyname_r(). +# This may fail (E.G. booted with console=), and errors from exec will +# terminate the shell, so use a subshell for the test +if (exec 0/dev/null; then + exec 0/dev/console + exec 2>/dev/console +fi + +# Clear memory to reduce page fragmentation +echo 3 > /proc/sys/vm/drop_caches + +# Finally, let's start an interactive shell +exec /bin/sh diff --git a/package/tinyinit/tinyinit.mk b/package/tinyinit/tinyinit.mk new file mode 100644 index 000000000000..c7bb144dee68 --- /dev/null +++ b/package/tinyinit/tinyinit.mk @@ -0,0 +1,12 @@ +################################################################################ +# +# tinyinit +# +################################################################################ + +define TINYINIT_INSTALL_TARGET_CMDS + $(INSTALL) -m 0755 -D $(TINYINIT_PKGDIR)/init $(TARGET_DIR)/sbin/init + (cd $(TARGET_DIR); ln -sf /sbin/init init) +endef + +$(eval $(generic-package)) From patchwork Thu Aug 22 18:37:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3330 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id D733B3F15B for ; Thu, 22 Aug 2024 20:37:50 +0200 (CEST) Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-371914b5caasf597403f8f.0 for ; Thu, 22 Aug 2024 11:37:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1724351870; cv=pass; d=google.com; s=arc-20160816; b=0r4/1u/ApEOr+PdOk2DE4PwYzfcnL1ZT0sKqcShmNafdTc4XNoNMETdHMv1G/4D2i7 Xg6zNbVvKc9fklEuqpce5AmhGY2ZfCWCzLI9Fux3wHC7MrjYgYQgjuU/fGVz/Anyhexh H8YGLPpsyek9Gjd4krsQve9zsvovpJajVHaKdEk3tV72IJca8EBjhylH7+9KdK6t7+wF 4JeGUPdvds0aQQQFoMNZ9YawqLFR0yV2hJwoM6UBYhRT/XWP9EG67FkehoHd+GbygtFh HOTF6Jzaczaf/lxIdvWiwxpPQWMsquXN1cRaWrJ5H8TCCjwQSYoJPWyc9vYh03+jWPD+ +39A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=pLPw7SC5EGZTCMHT2qGstp8l6gsucGus/XZxLLqI6BQ=; fh=l+JrsGZZ1+qpiYYXR7P/Afjv5Bd8t/go0I5nhSOesSg=; b=XA9oRhtdHvt+ey+WmjeFay6sRgBJHHVtXxEqg68JuXW+TWMvhiKcqC0ku4vsuWvYG/ /Rt4M1CAAOLj3s+RZlz7V3Z1V+wnedRWPWRwMoO2zL8U4gxZzgjGS+oOSCs0w9A+JL0+ 2YRB3tablqF+L0sgzLXHysywtAleoUmdtuq8IYlGk0c+TPXES0UgKJy5IxC8nx9vn0ZM 8lIq9sNhVZsOJS9nqNOXuBbjnsCIjFPuTqM42eMhaJkIuk//nUiU0dFlb7KzBWPO2L7R GiHeN8Ansoo8LzEvm8VFLv5Wtj1uBGBqJOhBuk2kWFwis5/0tGxNGUuMvvScRiZKl1Bu 2aPg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TjxXVLB7; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1724351870; x=1724956670; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=pLPw7SC5EGZTCMHT2qGstp8l6gsucGus/XZxLLqI6BQ=; b=rOdj6NPotxVt4i6A211dNtwQep3VAV0zfGnlUVut/t7tQR6VNkt7HtWZFQpNLxW+ot cja7Zwgp2XRCFqt5Q5XY/2x2dK3ZDvuoVu+5za+xDGvORoUqjCAi1T22TbaE8e0TmnYy qoqFwYYmI7OgCLNT553Ic7SDZN5nPfuUidOlg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724351870; x=1724956670; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pLPw7SC5EGZTCMHT2qGstp8l6gsucGus/XZxLLqI6BQ=; b=SKixhGKlGrfkon05gkXR/Yj+dpNNZskuS2KVPEgQ9R3oHv5I+KGFQaOXScSzduwaTZ HEo93pzARzVwGy/RFkJz+/8Y6grs3HXQeY9GpwmMzcCUK4xmX/JElhaMcsBUK53gEcIs n0DGRhRi5e7cklyMgczUNx5EeLNVyyxi9Z6o1BBSTARLn2ktkWoowrPzZ1eGdG8DgUyj C6pukws6jqMDN3Yndo57Nq7B7xAzgw9PoayP6bRl+HINq9npHShM4YrJhUTvw0Yq9pg9 X1ed2i2t8endXanAxplm+3edw2t0cvkM/bmqLT1gHVVdBm0KntOq0Pk4xHAnvWWp/WIy CJsw== X-Forwarded-Encrypted: i=2; AJvYcCVGRJ75LxCOFHGHCaB9Klyq1UMTGsMeS0AUjv1jcwJyHe2Leq5a/oIAsqu1VXyw3cTsCzcflqWw4k6kJCOm@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxNSHv0/MeKfQtWqjcj9g+cPqidSuTVLvE0lvhSwYycFZTNfi+3 3Nwm4T0GZUKtkm6X/AsIHWgcO/4fHS+vv8bAjio0FjXw6yPQBum7bMzsP8CiOtts/A== X-Google-Smtp-Source: AGHT+IEQwsmVm3gRTySh61dkg+lig3Q0enZgne/0KBC/DB4LyUB3OMWEy6bhBFGVIlQmiCg6osg4QA== X-Received: by 2002:a5d:658c:0:b0:36c:ff0c:36d3 with SMTP id ffacd0b85a97d-372fd5aa40dmr4389194f8f.29.1724351870052; Thu, 22 Aug 2024 11:37:50 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:adf:fe4e:0:b0:368:326f:723 with SMTP id ffacd0b85a97d-37305dcd34als343755f8f.2.-pod-prod-08-eu; Thu, 22 Aug 2024 11:37:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVPv+Cjb2X8VcNL/N4O2QWX+3OLe8tCU95v0axYyoJLLlHa19hDDS0UI8oQd0NbkkJa0+EFz4LyjfFYvuNa@amarulasolutions.com X-Received: by 2002:a5d:688e:0:b0:367:9881:7d66 with SMTP id ffacd0b85a97d-372fd71ff45mr4259270f8f.41.1724351868127; Thu, 22 Aug 2024 11:37:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724351868; cv=none; d=google.com; s=arc-20160816; b=MNsmEWak9vysEZ8TeW33iWsXTbNX/iQzCHWrUirb1yTXwzkZEMHfOxmUM7dqBXijed OVmMsS2gDqS39B5cMc/VJSp4xaNvIEpLraQQneE2zWDtq9Szo0Req9BWm93AFH8NPjEQ UjaXRFX8xC3aIQSd8SQuhA8c/1y4JWrkxnkaS8e1zO1Qerv+zo+STX8dCIlVEoqikSiJ gj50TTEKCnbhWE/5iEq9P43B/lFQyOEcXMhqk6QwcFuGo76cvGujjLSlMTQwataszH/x HzhQfKj5cuIKLvxkuUYpcKXGNO6UVRUbl37XI/jzNkh4jdMinfwvJF2OTjn34XFtgcZW rk8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=wfDn25DvjQbEDfvxvo3R4b6L0CBWG3X/xv0iKBlN4Vs=; fh=jUA8yZzhQ3ahU3xTyFfONq8OMK8NmXW+/cwquHCtd90=; b=UpN57Qx3vp1XYq00W/RmhbbSVRWoUgNlE08/gMavmavDHllaQRG4/oPi4B0agy4ABU wIjkMMzZEFtsuuBEn/G8d5hogaZM0ZxSLrb+zVKF75g4FeWIaP4LEf6YZv1uqMMCw7Zw frGKcfoAt2bqPyvHa2gY0dLTH5VGdGK6NvWm+Zr0a6YnC9DI+ADlD5ts54OJcIpjmKA8 1ryHQS2yhRtSn+Ew0pfbAJI/nTTrgPJMVOuYfv048F8zUqXN8wwVYA66gNSDWdCfYFQt YKarK3XKYM+Ehlc2nAZ+b2IFZt+BnIrj+VGmhTZNhUYQjmXynbBfZecnMI4mLiJlYq4K bSSA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TjxXVLB7; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ffacd0b85a97d-373081ff444sor506601f8f.6.2024.08.22.11.37.48 for (Google Transport Security); Thu, 22 Aug 2024 11:37:48 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCUMnrGMANw6nEk8G3yBjJN4jXZUs5SiHlJ2yQKO6Lh37yzjYmMZEIcChYIUQW7KcyuKTakEn6H3RVyd1gmt@amarulasolutions.com X-Received: by 2002:a5d:498b:0:b0:371:9366:6d8d with SMTP id ffacd0b85a97d-372fd592a07mr3879041f8f.19.1724351867534; Thu, 22 Aug 2024 11:37:47 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.. ([2.196.40.166]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3730811001fsm2276397f8f.20.2024.08.22.11.37.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 11:37:47 -0700 (PDT) From: Dario Binacchi To: buildroot@buildroot.org Cc: Dario Binacchi , Damien Le Moal , Thomas Petazzoni , "Yann E . MORIN" , linux-amarula@amarulasolutions.com, Waldemar Brodkorb Subject: [PATCH v3 2/3] configs/stm32f746_disco_sd: new defconfig Date: Thu, 22 Aug 2024 20:37:41 +0200 Message-ID: <20240822183742.3550055-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240822183742.3550055-1-dario.binacchi@amarulasolutions.com> References: <20240822183742.3550055-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=TjxXVLB7; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The commit adds support for STM32F746G-DISCO board. The discovery kit is a complete demonstration and development platform for STMicroelectronics Arm Cortex-M7-core-based STM32F746NG. Board support package includes the following components: - mainline Linux kernel 5.15.165 - mainline U-Boot 2024.07 - default packages from buildroot Link: https://www.st.com/en/evaluation-tools/32f746gdiscovery.html Co-Developed-by: Waldemar Brodkorb Tested-by: Waldemar Brodkorb Signed-off-by: Dario Binacchi --- Changes v2 -> v3: - Replace BR2_INIT_TINYINIT=y with BR2_INIT_NONE=y and BR2_PACKAGE_TINYINIT=y in stm32f746_disco_sd_defconfig. Changes v1 -> v2: - Move Linux kernel from version 5.15.163 to 5.15.165. - Drop busybox-tiny.config and use package/busybox/busybox-minimal.config. - Remove the logo management. - Add the Tested-by tag. - Update the commit message DEVELOPERS | 2 ++ .../stm32f746-disco/extlinux.conf | 4 +++ .../stm32f746-disco/flash_sd.sh | 22 +++++++++++++ .../stm32f746-disco/genimage.cfg | 27 ++++++++++++++++ .../stm32f746-disco/linux.fragment | 13 ++++++++ .../patches/linux-headers/linux-headers.hash | 1 + .../stm32f746-disco/patches/linux/linux.hash | 2 ++ .../stm32f746-disco/patches/uboot/uboot.hash | 2 ++ .../stm32f746-disco/post-build.sh | 9 ++++++ .../stm32f746-disco/readme.txt | 31 ++++++++++++++++++ configs/stm32f746_disco_sd_defconfig | 32 +++++++++++++++++++ 11 files changed, 145 insertions(+) create mode 100644 board/stmicroelectronics/stm32f746-disco/extlinux.conf create mode 100755 board/stmicroelectronics/stm32f746-disco/flash_sd.sh create mode 100644 board/stmicroelectronics/stm32f746-disco/genimage.cfg create mode 100644 board/stmicroelectronics/stm32f746-disco/linux.fragment create mode 120000 board/stmicroelectronics/stm32f746-disco/patches/linux-headers/linux-headers.hash create mode 100644 board/stmicroelectronics/stm32f746-disco/patches/linux/linux.hash create mode 100644 board/stmicroelectronics/stm32f746-disco/patches/uboot/uboot.hash create mode 100755 board/stmicroelectronics/stm32f746-disco/post-build.sh create mode 100644 board/stmicroelectronics/stm32f746-disco/readme.txt create mode 100644 configs/stm32f746_disco_sd_defconfig diff --git a/DEVELOPERS b/DEVELOPERS index 45cc1cc48996..e8dc27f7ad47 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -785,10 +785,12 @@ F: package/xinetd/ N: Dario Binacchi F: board/bsh/ +F: board/stmicroelectronics/stm32f746-disco/ F: board/stmicroelectronics/stm32f769-disco/ F: configs/imx6ulz_bsh_smm_m2_defconfig F: configs/imx8mn_bsh_smm_s2_defconfig F: configs/imx8mn_bsh_smm_s2_pro_defconfig +F: configs/stm32f746_disco_sd_defconfig F: configs/stm32f769_disco_sd_defconfig F: package/sscep/ F: package/tinyinit/ diff --git a/board/stmicroelectronics/stm32f746-disco/extlinux.conf b/board/stmicroelectronics/stm32f746-disco/extlinux.conf new file mode 100644 index 000000000000..bb79c0b412a2 --- /dev/null +++ b/board/stmicroelectronics/stm32f746-disco/extlinux.conf @@ -0,0 +1,4 @@ +label stm32f746-disco-buildroot + kernel /zImage + devicetree /stm32f746-disco.dtb + append console=ttySTM0,115200 root=/dev/mmcblk0p2 rw rootwait consoleblank=0 ignore_loglevel diff --git a/board/stmicroelectronics/stm32f746-disco/flash_sd.sh b/board/stmicroelectronics/stm32f746-disco/flash_sd.sh new file mode 100755 index 000000000000..4fe85448f984 --- /dev/null +++ b/board/stmicroelectronics/stm32f746-disco/flash_sd.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +if [ $# -eq 0 ]; then + OUTPUT_DIR=output +else + OUTPUT_DIR=$1 +fi + +if ! test -d "${OUTPUT_DIR}" ; then + echo "ERROR: no output directory specified." + echo "Usage: $0 OUTPUT_DIR" + exit 1 +fi + +"${OUTPUT_DIR}"/host/bin/openocd -f board/stm32f746g-disco.cfg \ + -c "init" \ + -c "reset init" \ + -c "flash probe 0" \ + -c "flash info 0" \ + -c "flash write_image erase ${OUTPUT_DIR}/images/u-boot.bin 0x08000000" \ + -c "reset run" \ + -c "shutdown" diff --git a/board/stmicroelectronics/stm32f746-disco/genimage.cfg b/board/stmicroelectronics/stm32f746-disco/genimage.cfg new file mode 100644 index 000000000000..6743d41972c0 --- /dev/null +++ b/board/stmicroelectronics/stm32f746-disco/genimage.cfg @@ -0,0 +1,27 @@ +image boot.vfat { + vfat { + files = { + "zImage", + "stm32f746-disco.dtb", + "extlinux" + } + } + + size = 16M +} + +image sdcard.img { + hdimage { + } + + partition u-boot { + partition-type = 0xC + image = "boot.vfat" + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext2" + size = 32M + } +} diff --git a/board/stmicroelectronics/stm32f746-disco/linux.fragment b/board/stmicroelectronics/stm32f746-disco/linux.fragment new file mode 100644 index 000000000000..625fdced9e8d --- /dev/null +++ b/board/stmicroelectronics/stm32f746-disco/linux.fragment @@ -0,0 +1,13 @@ +# CONFIG_PREEMPT is not set +# CONFIG_MULTIUSER is not set +# CONFIG_TIMERFD is not set +CONFIG_SET_MEM_PARAM=y +CONFIG_DRAM_BASE=0xC0000000 +CONFIG_DRAM_SIZE=0x01000000 +# CONFIG_GCC_PLUGINS is not set +# CONFIG_XIP_KERNEL is not set +# CONFIG_BLK_DEV is not set +# CONFIG_COMPAT_BRK is not set +# CONFIG_PROC_SYSCTL is not set +# CONFIG_CRYPTO is not set +CONFIG_RCU_TRACE=y \ No newline at end of file diff --git a/board/stmicroelectronics/stm32f746-disco/patches/linux-headers/linux-headers.hash b/board/stmicroelectronics/stm32f746-disco/patches/linux-headers/linux-headers.hash new file mode 120000 index 000000000000..5808d92afe89 --- /dev/null +++ b/board/stmicroelectronics/stm32f746-disco/patches/linux-headers/linux-headers.hash @@ -0,0 +1 @@ +../linux/linux.hash \ No newline at end of file diff --git a/board/stmicroelectronics/stm32f746-disco/patches/linux/linux.hash b/board/stmicroelectronics/stm32f746-disco/patches/linux/linux.hash new file mode 100644 index 000000000000..7f78b950f35c --- /dev/null +++ b/board/stmicroelectronics/stm32f746-disco/patches/linux/linux.hash @@ -0,0 +1,2 @@ +# Locally calculated +sha256 a36dd3e82ceb634afded31f2656568f57c4d9c4b399859f298b18116df11c6fe linux-5.15.165.tar.xz diff --git a/board/stmicroelectronics/stm32f746-disco/patches/uboot/uboot.hash b/board/stmicroelectronics/stm32f746-disco/patches/uboot/uboot.hash new file mode 100644 index 000000000000..fe9b4f53dc63 --- /dev/null +++ b/board/stmicroelectronics/stm32f746-disco/patches/uboot/uboot.hash @@ -0,0 +1,2 @@ +# Locally calculated +sha256 f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f u-boot-2024.07.tar.bz2 diff --git a/board/stmicroelectronics/stm32f746-disco/post-build.sh b/board/stmicroelectronics/stm32f746-disco/post-build.sh new file mode 100755 index 000000000000..2894ad851c66 --- /dev/null +++ b/board/stmicroelectronics/stm32f746-disco/post-build.sh @@ -0,0 +1,9 @@ +#!/bin/sh +BOARD_DIR="$(dirname "$0")" + +install -m 0644 -D "${BOARD_DIR}"/extlinux.conf "${BINARIES_DIR}"/extlinux/extlinux.conf + +# finalize the init script +INIT_PATH="${TARGET_DIR}/sbin/init" +sed -i "/^# Clear memory to reduce page fragmentation/d" "${INIT_PATH}" +sed -i "/^echo 3 > \/proc\/sys\/vm\/drop_caches/d" "${INIT_PATH}" diff --git a/board/stmicroelectronics/stm32f746-disco/readme.txt b/board/stmicroelectronics/stm32f746-disco/readme.txt new file mode 100644 index 000000000000..4ac16da33132 --- /dev/null +++ b/board/stmicroelectronics/stm32f746-disco/readme.txt @@ -0,0 +1,31 @@ +STM32F746-DISCO +=================== + +This tutorial describes how to use the predefined Buildroot +configuration for the STM32F746-DISCO evaluation platform. + +Building +-------- + + make stm32f746_disco_sd_defconfig + make + +Flashing +-------- + + ./board/stmicroelectronics/stm32f746-disco/flash_sd.sh output/ + +It will flash the U-boot bootloader. + +Creating SD card +---------------- + +Buildroot prepares an "sdcard.img" image in the output/images/ directory, +ready to be dumped on a SD card. Launch the following command as root: + + dd if=output/images/sdcard.img of=/dev/ + +*** WARNING! This will destroy all the card content. Use with care! *** + +For details about the medium image layout and its content, see the +definition in board/stmicroelectronics/stm32f746-disco/genimage.cfg. diff --git a/configs/stm32f746_disco_sd_defconfig b/configs/stm32f746_disco_sd_defconfig new file mode 100644 index 000000000000..8c92afc5740e --- /dev/null +++ b/configs/stm32f746_disco_sd_defconfig @@ -0,0 +1,32 @@ +BR2_arm=y +BR2_cortex_m7=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_15=y +BR2_GLOBAL_PATCH_DIR="board/stmicroelectronics/stm32f746-disco/patches" +BR2_DOWNLOAD_FORCE_CHECK_HASHES=y +BR2_INIT_NONE=y +BR2_ROOTFS_POST_BUILD_SCRIPT="board/stmicroelectronics/stm32f746-disco/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/stmicroelectronics/stm32f746-disco/genimage.cfg" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15.165" +BR2_LINUX_KERNEL_DEFCONFIG="stm32" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/stmicroelectronics/stm32f746-disco/linux.fragment" +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y +BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="zImage" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="stm32f746-disco" +BR2_PACKAGE_TINYINIT=y +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_SIZE="32M" +# BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2024.07" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="stm32f746-disco" +BR2_TARGET_UBOOT_NEEDS_OPENSSL=y +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_OPENOCD=y From patchwork Thu Aug 22 18:37:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3331 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 0FE5740F49 for ; Thu, 22 Aug 2024 20:37:51 +0200 (CEST) Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-371a2dcd8c2sf510466f8f.2 for ; Thu, 22 Aug 2024 11:37:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1724351870; cv=pass; d=google.com; s=arc-20160816; b=WGxLMv4oNyFLhEQuOi+9JpDsvEhqcOOEc298mM/VfL1nKm+djSp4BqOMrXKeKxNvLe u3/dLNLGsRa7RUVJQ7tRtijOSfWGO6aBYnQormWJx3yfwb+c+6E0nP+a/1De6gYHCS6I KTjpxPd9aQGVwJhO1V2wDTa9SiAhBYldhNoQ0j7VH+GFKlOo/ErZ4rKuTcXyHKCI8Wsk Gds/QjriswiitI/l2nR3CafpuqjHAtbWKLmBAC60dzHmrZhhNGKYEYKCYi6SV5pA+Bbj EXAQNdgee+7uty5i+JJSQwsLBN+s2zHeGHbTHTH21BNFNigcXII99yB5A8ggtnEvs4MU GH8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=4ZDAfsLp0gBf9Oc/o37PCdFykLeBns6h9lTfvHYdMOk=; fh=B1hfMDhLMttxhM1OXYXhUGmqfk0NpRzyD/xuU0+obVs=; b=xtPs+vX8BzxP2mU4n0poV4Z+7ePV87ZVE/Ecl6DDpCv0YDFMOepuXire6c0ae9sZ3G een+KOY1SJMfe13FlvWl+FbXEETl9lZDBsnzdm7xoQJ0pkUO8K95FIQGZNZ9RKJWIiXX JxjQDMs1apDmijrBo8fZKVjd697D6/KPrA8apVdmVxRYjpmFy/U6M1xqTK4EvteW6l2N M6cmftjCV0WMdiFuBOxiI5cSwnii0E+q1+2DVDLk8bxi/Wk25te90JJr6BIp61k1l/GH 32H45bmYJPPYBvNCKPMUL3QTqogxVsmDauv4oFMhGxGRDvpXIb8L7r3OFyGPA4fi3w6b GqMw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XcCFZBQ6; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1724351870; x=1724956670; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=4ZDAfsLp0gBf9Oc/o37PCdFykLeBns6h9lTfvHYdMOk=; b=HvEL93VPxtWKp3EjRwYE7Q0Ov2+455g1eXEGH5pgliqiQr8B9MTAwnss10HJRM+LBh d1uZW7A34degEptt04yY8Vvp4i5mOo/3E8Inja+sSxEIQ/Tia7og6JroAekFn7Ph2viJ O8/QM9mcO+ypMPY3KtbctaCAOo1DuaeX7pfv0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724351870; x=1724956670; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4ZDAfsLp0gBf9Oc/o37PCdFykLeBns6h9lTfvHYdMOk=; b=Yuv8sTFfKsFsev1HADLym6XqK+FZDdO0CsKytRlkZhv2+PoC7jYuzN26s+6IUsVrkC FSaMVuphG1RvZe83dHkOlcZ1tw0Rhe4rgbvsOV270nQaM4crZsmhwZcQVQu8iw9U/o/D Z5oaG5Fm8/hW++dxp4fFWG5xaB8sQyY2fhizTUn/FaG8gE5YaHWNQYj9bug7tqO6reQg AX8Gz8f7wZBv+vgV4CpHh1p7VMJPqChui0YFSwuUqR7PSTZzh+4zOXwOcFBsq7oLLJnd 6raB4n9ArMp1E01jhRCnnQRDxQgPVJG2aX07Fyszf2vHL/xZgh2+kshRNDIvXR4Qvp5I Zs8g== X-Forwarded-Encrypted: i=2; AJvYcCXh3wLJ6NmI1QVHFO4icIL6dv0DaSWh04APGnBGWhLvdsa8pDg3++DS9KPr5AAp0E1OxldLXPeEdPJmWuoa@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YybLQfdL9aJxWuevSnrNmVEaHabBbITDArgRagurpWjBkR3UpwU 01jt49KU+U7+JFmlUHfJPvWd6lSb0mDJqmKt33lk4LYHTvjVlHZGqocLDAGaNYDrFw== X-Google-Smtp-Source: AGHT+IEOy4qAslpcZI9RKTUK5okh59EdXdGwtH4ySC7Uz5WO9I1ke0A/Lrz5oOSevQKO0VxoVnnv7A== X-Received: by 2002:a05:6000:2a9:b0:36b:bb84:33e2 with SMTP id ffacd0b85a97d-37308c2f949mr2051414f8f.37.1724351870568; Thu, 22 Aug 2024 11:37:50 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:1548:b0:427:ad0:2dd8 with SMTP id 5b1f17b1804b1-42ac3c34468ls6277525e9.0.-pod-prod-04-eu; Thu, 22 Aug 2024 11:37:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWAWMnriQSW0S3OJa+hSl7DDRpa2UJQswIq+nOtcCrnFwAgRKVIZCFkDJk2kxF102KV6H3jg0yqNBWl7VpE@amarulasolutions.com X-Received: by 2002:a05:600c:4e41:b0:428:ea8e:b4a0 with SMTP id 5b1f17b1804b1-42ac55d9b1cmr19602165e9.14.1724351869102; Thu, 22 Aug 2024 11:37:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724351869; cv=none; d=google.com; s=arc-20160816; b=H6CeTwc4iG6q/SI5h6F7s3gHp7paZ+4KnAERHjmv6utKvWOW7BJR/tShAowTyiQvgR ntPFDKJUuszf099hmBL9uqY5+DwY12d1q6uBqW+ORI44T+HyvF0vRoiGairF4wONbS2f J5OA0mzzI1O7Or3Du9H1ylSjvmSVbY1HUcl4pXn5GJSDGImvYKdvflbkwOZ+0V0UvJfR Uaz1pgZgFikd88G+STYeZblvMTLzMJ/F6R1GFNQlE8zr/bQhfffMde1Z10ImIdqkBhsT bRrRugSmE1yIgVsIUat2bMdJ9mH65CeAsq0Yhhy2au/8ngWMu8tZEskDHRCuNMjRw9gu 16tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=tJUf+8K8O1zRMG27X0FoRloRUfG4XE2Ky2O3u3qn/5M=; fh=U/K1Mb0C1OzoFWhPJulNk07T9GOpVUw3LZP6GYW09tc=; b=qU+FSXs+AJM/B8UAhcDaUbNNTe1q71nEkZNLp1Z3ipyrRCeSNXBKdajqEWsTNzg3c0 eIOP7dG1rM+jKlrSnyNPJXDNxYkyozeNlFp/Mb0TS4Pk1sa9TUOyZk2OpGyRLGEsNEKY DyITyIO8fMCctf1wu2wkTB52lhznYRKvH4OOIt7ussyCSAy4xtrt3SO5846Y41mYJea0 97MwC+T1ZeVZHT9wlZc9a37Spd6AEJhigjUcWyeAXfmABBOkpQSt69qiKlOYANuH5+ge 0fcrmCz9GWcfcqkrlQXBeAZJLKxgmrMFn8rk8/BEpipeELfNaefBvfiEkbq0ESTjlvt5 VQbA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XcCFZBQ6; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42ac515cde1sor1765005e9.5.2024.08.22.11.37.49 for (Google Transport Security); Thu, 22 Aug 2024 11:37:49 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCUArPu9hujyrPIJ497Kirf6d0NpCh0zge0GaOcHILGpwSR+eUzwIpu5bGPHtt9NChyfYKZthHBoqaH35SFb@amarulasolutions.com X-Received: by 2002:adf:fe4f:0:b0:36c:b5a1:f108 with SMTP id ffacd0b85a97d-37308d71e1fmr1669066f8f.39.1724351868559; Thu, 22 Aug 2024 11:37:48 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.. ([2.196.40.166]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3730811001fsm2276397f8f.20.2024.08.22.11.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 11:37:48 -0700 (PDT) From: Dario Binacchi To: buildroot@buildroot.org Cc: Dario Binacchi , Damien Le Moal , Thomas Petazzoni , "Yann E . MORIN" , linux-amarula@amarulasolutions.com Subject: [PATCH v3 3/3] board/canaan/k210-soc: use tinyinit as Linux init process Date: Thu, 22 Aug 2024 20:37:42 +0200 Message-ID: <20240822183742.3550055-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240822183742.3550055-1-dario.binacchi@amarulasolutions.com> References: <20240822183742.3550055-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XcCFZBQ6; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The initialization script provided by the tinyinit package is the same as the one contained in board/canaan/k210-soc/rootfs_overlay/sbin/init except for the Linux logo, which has been removed. The patch reworks the configurations that use this overlay directory by replacing the initialization process contained within it with the one provided by the tinyinit package. Signed-off-by: Dario Binacchi --- Changes v2 -> v3: - Replace BR2_INIT_TINYINIT=y with BR2_INIT_NONE=y and BR2_PACKAGE_TINYINIT=y in stm32f746_disco_sd_defconfig. Changes v1 -> v2: - Remove the logo management. - Update the commit message. .checkpackageignore | 1 - board/canaan/k210-soc/rootfs_overlay/init | 1 - .../canaan/k210-soc/rootfs_overlay/sbin/init | 41 ------------------- configs/canaan_kd233_defconfig | 2 +- configs/sipeed_maix_bit_defconfig | 2 +- configs/sipeed_maix_bit_sdcard_defconfig | 2 +- configs/sipeed_maix_dock_defconfig | 2 +- configs/sipeed_maix_dock_sdcard_defconfig | 2 +- configs/sipeed_maix_go_defconfig | 2 +- configs/sipeed_maix_go_sdcard_defconfig | 2 +- configs/sipeed_maixduino_defconfig | 2 +- configs/sipeed_maixduino_sdcard_defconfig | 2 +- 12 files changed, 9 insertions(+), 52 deletions(-) delete mode 120000 board/canaan/k210-soc/rootfs_overlay/init delete mode 100755 board/canaan/k210-soc/rootfs_overlay/sbin/init diff --git a/.checkpackageignore b/.checkpackageignore index 81e48bf85909..e1ba013fcbc5 100644 --- a/.checkpackageignore +++ b/.checkpackageignore @@ -22,7 +22,6 @@ board/bsh/imx8mn-bsh-smm-s2-pro/post-image.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2/flash.sh Shellcheck lib_shellscript.EmptyLastLine board/bsh/imx8mn-bsh-smm-s2/post-build.sh Shellcheck board/canaan/k210-soc/post-build.sh Shellcheck -board/canaan/k210-soc/rootfs_overlay/sbin/init Shellcheck board/chromebook/elm/sign.sh Shellcheck board/chromebook/mksd.sh Shellcheck board/chromebook/snow/sign.sh Shellcheck diff --git a/board/canaan/k210-soc/rootfs_overlay/init b/board/canaan/k210-soc/rootfs_overlay/init deleted file mode 120000 index a0b71977c06f..000000000000 --- a/board/canaan/k210-soc/rootfs_overlay/init +++ /dev/null @@ -1 +0,0 @@ -/sbin/init \ No newline at end of file diff --git a/board/canaan/k210-soc/rootfs_overlay/sbin/init b/board/canaan/k210-soc/rootfs_overlay/sbin/init deleted file mode 100755 index d4bf53d45231..000000000000 --- a/board/canaan/k210-soc/rootfs_overlay/sbin/init +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -# This script replaces the default busybox init process to avoid having that -# process staying alive and sleeping in the background, (uselessly) consuming -# precious memory. - -# Mount procfs and sysfs -/bin/mount -t proc proc /proc -/bin/mount -t sysfs sysfs /sys - -# When the kernel is directly booted, devtmpfs is not automatically mounted. -# Manually mount it if needed. -devmnt=$(mount | grep -c devtmpfs) -if [ ${devmnt} -eq 0 ]; then - /bin/mount -t devtmpfs devtmpfs /dev -fi - -# Use the /dev/console device node from devtmpfs if possible to not -# confuse glibc's ttyname_r(). -# This may fail (E.G. booted with console=), and errors from exec will -# terminate the shell, so use a subshell for the test -if (exec 0/dev/null; then - exec 0/dev/console - exec 2>/dev/console -fi - -# Clear memory to reduce page fragmentation -echo 3 > /proc/sys/vm/drop_caches - -# Print a fun logo :) -echo " __ _" -echo " / / (_) ____ _ _ __ __" -echo " / / | || _ \\ | | | |\\ \\/ /" -echo " / /___| || | | || |_| | > < " -echo " /_____/|_||_| |_| \\____|/_/\\_\\" -echo " 64-bits RISC-V Kendryte K210 NOMMU" -echo "" - -# Finally, let's start an interactive shell -exec /bin/sh diff --git a/configs/canaan_kd233_defconfig b/configs/canaan_kd233_defconfig index 832f8363a75c..dda42836ae1d 100644 --- a/configs/canaan_kd233_defconfig +++ b/configs/canaan_kd233_defconfig @@ -33,5 +33,5 @@ BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/busybox-tiny.co # Filesystem BR2_INIT_NONE=y +BR2_PACKAGE_TINYINIT=y BR2_TARGET_ROOTFS_INITRAMFS=y -BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" diff --git a/configs/sipeed_maix_bit_defconfig b/configs/sipeed_maix_bit_defconfig index 238e082a3d40..2bd203c45681 100644 --- a/configs/sipeed_maix_bit_defconfig +++ b/configs/sipeed_maix_bit_defconfig @@ -33,5 +33,5 @@ BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/busybox-tiny.co # Filesystem BR2_INIT_NONE=y +BR2_PACKAGE_TINYINIT=y BR2_TARGET_ROOTFS_INITRAMFS=y -BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" diff --git a/configs/sipeed_maix_bit_sdcard_defconfig b/configs/sipeed_maix_bit_sdcard_defconfig index 28aa143583bd..fd5f19d5793a 100644 --- a/configs/sipeed_maix_bit_sdcard_defconfig +++ b/configs/sipeed_maix_bit_sdcard_defconfig @@ -34,9 +34,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="canaan/sipeed_maix_bit" # Filesystem BR2_INIT_NONE=y +BR2_PACKAGE_TINYINIT=y BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_SIZE="64M" -BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" BR2_ROOTFS_POST_BUILD_SCRIPT="board/canaan/k210-soc/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/canaan/k210-soc/genimage.cfg" diff --git a/configs/sipeed_maix_dock_defconfig b/configs/sipeed_maix_dock_defconfig index ee1b0d837284..0faa06b7dcb2 100644 --- a/configs/sipeed_maix_dock_defconfig +++ b/configs/sipeed_maix_dock_defconfig @@ -33,5 +33,5 @@ BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/busybox-tiny.co # Filesystem BR2_INIT_NONE=y +BR2_PACKAGE_TINYINIT=y BR2_TARGET_ROOTFS_INITRAMFS=y -BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" diff --git a/configs/sipeed_maix_dock_sdcard_defconfig b/configs/sipeed_maix_dock_sdcard_defconfig index 41a062c7a179..379d228d4c7e 100644 --- a/configs/sipeed_maix_dock_sdcard_defconfig +++ b/configs/sipeed_maix_dock_sdcard_defconfig @@ -34,9 +34,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="canaan/sipeed_maix_dock" # Filesystem BR2_INIT_NONE=y +BR2_PACKAGE_TINYINIT=y BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_SIZE="64M" -BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" BR2_ROOTFS_POST_BUILD_SCRIPT="board/canaan/k210-soc/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/canaan/k210-soc/genimage.cfg" diff --git a/configs/sipeed_maix_go_defconfig b/configs/sipeed_maix_go_defconfig index a5b09e17ac1c..33599c19f505 100644 --- a/configs/sipeed_maix_go_defconfig +++ b/configs/sipeed_maix_go_defconfig @@ -33,5 +33,5 @@ BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/busybox-tiny.co # Filesystem BR2_INIT_NONE=y +BR2_PACKAGE_TINYINIT=y BR2_TARGET_ROOTFS_INITRAMFS=y -BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" diff --git a/configs/sipeed_maix_go_sdcard_defconfig b/configs/sipeed_maix_go_sdcard_defconfig index 0e80d9c83ad8..1b03cf6165ad 100644 --- a/configs/sipeed_maix_go_sdcard_defconfig +++ b/configs/sipeed_maix_go_sdcard_defconfig @@ -34,9 +34,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="canaan/sipeed_maix_go" # Filesystem BR2_INIT_NONE=y +BR2_PACKAGE_TINYINIT=y BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_SIZE="64M" -BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" BR2_ROOTFS_POST_BUILD_SCRIPT="board/canaan/k210-soc/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/canaan/k210-soc/genimage.cfg" diff --git a/configs/sipeed_maixduino_defconfig b/configs/sipeed_maixduino_defconfig index 7ba7653e8d5f..0cdd16df3f87 100644 --- a/configs/sipeed_maixduino_defconfig +++ b/configs/sipeed_maixduino_defconfig @@ -33,5 +33,5 @@ BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/busybox-tiny.co # Filesystem BR2_INIT_NONE=y +BR2_PACKAGE_TINYINIT=y BR2_TARGET_ROOTFS_INITRAMFS=y -BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" diff --git a/configs/sipeed_maixduino_sdcard_defconfig b/configs/sipeed_maixduino_sdcard_defconfig index 7bdd36e1d09f..629205c5bc49 100644 --- a/configs/sipeed_maixduino_sdcard_defconfig +++ b/configs/sipeed_maixduino_sdcard_defconfig @@ -34,9 +34,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="canaan/sipeed_maixduino" # Filesystem BR2_INIT_NONE=y +BR2_PACKAGE_TINYINIT=y BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_SIZE="64M" -BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" BR2_ROOTFS_POST_BUILD_SCRIPT="board/canaan/k210-soc/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/canaan/k210-soc/genimage.cfg"