From patchwork Sat Aug 31 12:08:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3347 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3557B3FA6C for ; Sat, 31 Aug 2024 14:08:46 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5bedba9894dsf2061050a12.1 for ; Sat, 31 Aug 2024 05:08:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1725106126; cv=pass; d=google.com; s=arc-20240605; b=faqFn1bJGadadGUTLJZPl7F6rmCnBJqvlv9x+j2n16Vg3WWXrN717zFr4lj97R5R+5 IA/KK06n05hUIlytX239OoD0JYE2CImElbyqcorBBDteBPdInVlZ0bmGV3dpTejNX7ir KAWzYuGnFE5OzjGHuOzj0NeVo6RSUQb8E/EISAEIT5uZaDddHJ7TYrFofdNWRc4UMIgn 7Y6FxGWcALEa2P/U62C5v75GNA6kzZvCHt4k0cRHMM6KtPE1jjkb0gCMiw6lr+kY91// yNZvAJpkAs1MHyCq+PyMsyWSMHPvWdyqG5Y2+kp22lE7mmi0Jf1bDcl/pva2nQ13LbY5 8eiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=5ZM0odIZBMh/zlmrjFG2sd8Uw84p9R7AEhzpP4miOZA=; fh=Zk27musWEfpGYnsQUfZx4PesgmfFL2ZXbW2RMSzPitI=; b=Bd9IVqgZk5KBZn0L0ttWnlw4MiSlFBVfoqqAFi76XnFEN0XKC30D73MpuPCG6JcJzJ 7415X0v/Ag+CAUeremgTE3bF0PffOKPr+ECmbd1OrV+I+s4mEoUIrEMzSax2fI7a7uOD rG9ODqu0jzw/Wjhd+qStYp0UA80ihYFTvMFcgPZmcDRWNcT/C0UtJuBYTMQaQ4NStGi7 gynLdR9dhLYbYV4IPsJ3TTT/3zVecNhd3/xwRcafd9dOH5zmQFpECnBDspdYN0j6JXsi jS93ge1zKJGmnVQ0/XrDSW9XCiqLgvHxRrJK85eQaNUwkAKX+ocpEfXW34tuVsVtgCBh LySQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=T+anrrr0; 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=1725106126; x=1725710926; 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=5ZM0odIZBMh/zlmrjFG2sd8Uw84p9R7AEhzpP4miOZA=; b=n4EGal5KNeGfPa/kEAmmRWcEP/BlsaZvREropjK0xnIiK+U0MFhfcV4Qar3PnJirO/ Ht/2VjSFB3sDRxb3Ao9xDNbLencVmcibWEGo5k8u1JtlpHPq3wGDypR63HUwoR2LqQu6 +FA93RORqNo9KtS4vcgsvs3bQlpanpHSYtd8o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725106126; x=1725710926; 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=5ZM0odIZBMh/zlmrjFG2sd8Uw84p9R7AEhzpP4miOZA=; b=qB5XUT+9d6YG4Jgn9sIGM/Gg85xNue30e0eWez6b2/a3B+BU6ql75gD39HDYk1BdFs BhxTuS3oVdlFeeezNHCnJsr8bWdPsUwShFJYJuQ/07FUCqKU9MfEapIBjX/myfZnVrNB A2dLVjsAr6vPKWVMWHSn4VJcuUnhONUVFn6JgKl58TtN3djVDEpcDBYWt3hMTw9M6p/7 INdk2ZCc8eE5yrqkdE8eXkk2aE8HT5WiZiyKppCMCm3S2+X6ymm9o7HSd9ufjLUAm8NN wjHWlUH+iZgM0WxVhLv4H3O621em8UfUmHfL+4qq3AawV4TS9MZ1PsUSByx89X46k8zk idEg== X-Forwarded-Encrypted: i=2; AJvYcCXjLH1DvQ4u7dmMQnkQ0l8Ul1xXzOLPGWxW6Wp9TgViDuBytSaW5P80IZkNd5lYuF64rM3NKYlk6DvAbs7v@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yy/eQ8W9DArDfchm431qJTazOieLTJ/dJ1iWJn0RAEkTdUkEg31 Ak5CsR4/ZUaB5KRn/0SKYMkQCMocaZxlbixQCzD6B/ttXyp0Yfj0TKINEkgbDuFitQ== X-Google-Smtp-Source: AGHT+IFwh/JipE8XUkSw/CD1+bGX/8OBANGwJAW1srKCIb5AnH1AhLEZxl+z4xbaqFxgU8QWYtFyDA== X-Received: by 2002:a05:6402:40d6:b0:5bf:80d:e11d with SMTP id 4fb4d7f45d1cf-5c21ed3e30dmr8285778a12.12.1725106125584; Sat, 31 Aug 2024 05:08:45 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:3592:b0:5be:ef89:e7a6 with SMTP id 4fb4d7f45d1cf-5c21ec50939ls578748a12.2.-pod-prod-04-eu; Sat, 31 Aug 2024 05:08:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWRQESbls2+u5zRJ0yOngI6GS4ue8rriIW4BeYNussvxF4mYAimGuGIUxRrGRQXvRZvZMYdPyAkj3a4r5rk@amarulasolutions.com X-Received: by 2002:a17:907:36c5:b0:a86:6968:3b93 with SMTP id a640c23a62f3a-a89d879c32dmr59690266b.33.1725106123822; Sat, 31 Aug 2024 05:08:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725106123; cv=none; d=google.com; s=arc-20160816; b=TMKZebZZEQGNyTI26FBqlXwKnz04Og42HHV353G41H4p3XX+tIFSrVNd2bYvTtyk4N av/5gVMjjLABZ7FnHcq+szZSRbDC6Koqz6cXfnuFemuKoYzKpapJkHenC0O87Md4L7SC CqsxD0SFCIe6xFo+kFqDZ4boDno9EBRf1NUpDBUfX8OVkW07FwzaPp0GFdaR0beUv8o0 u94fqMlz/KwNCJkiHV5WanOG2a/+R0cU4NsxePs/XAEnpwpb15LO7+vqoTdLbkfjnR6g kjx/is3vaYbxXnBpnwoUmHxg+kKBD/7X0eakzrlos90CUhZz4CSTwA5/yUZWmJZtGoEj 6f9A== 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=vjJfoEd6aJRxK/ZXd9KzrdJcvsoV07mC6Y5AbeT3mhQ=; fh=gzUZ213RKc1NvS5aIOoW991MQjEKl/IDuALsO7T6j3M=; b=KGi7gKNPyx1M/CJGS7oHOy2ySc6HqcfiuATIfrlv6uFn6yOLHjw/RtsTmeus5FKubl 1QjQn54rpB3+U+5Z8BXAEoI7dOofIzKsSUHojLWSl4sFyAHQPo5E1TA6zkWtPSO5T/8+ o/PGawxFUcv0Bofq0YV8nxhrQH8urquaIb3umgmjq03vyEGu6Sx3Xh/8hsQtkLXgKlfX bElM7x/Jg+cYbhGDDWLNTQAihwJIkKjTpsFyvHDUsdnq7Gc3MU9tmldORTSYcywUP21H 73xHfIp7+p7jvjAUDNGEURXaC3zjV4bGsSsefIbtkKMdL2SmLrYZJNcvMvND33cahgQG e/mw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=T+anrrr0; 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 a640c23a62f3a-a89890915b7sor169261566b.7.2024.08.31.05.08.43 for (Google Transport Security); Sat, 31 Aug 2024 05:08:43 -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; AJvYcCW0um2VjgvSvnMyMZurj8YA7D6fs/zBdd4HAJSSmPWdvnyUua7qXYrvYECQb5bidU6SSaNNdG7qwhvXE36r@amarulasolutions.com X-Received: by 2002:a05:6402:2792:b0:5c2:4a98:7520 with SMTP id 4fb4d7f45d1cf-5c24a987b9emr853788a12.31.1725106123293; Sat, 31 Aug 2024 05:08:43 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-48-52-249.retail.telecomitalia.it. [82.48.52.249]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c226ce4f47sm2938178a12.88.2024.08.31.05.08.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2024 05:08:42 -0700 (PDT) From: Dario Binacchi To: buildroot@buildroot.org Cc: Damien Le Moal , Dario Binacchi , Thomas Petazzoni , "Yann E . MORIN" , linux-amarula@amarulasolutions.com Subject: [PATCH v4 1/3] package/tinyinit: new package Date: Sat, 31 Aug 2024 14:08:31 +0200 Message-ID: <20240831120833.2915529-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240831120833.2915529-1-dario.binacchi@amarulasolutions.com> References: <20240831120833.2915529-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=T+anrrr0; 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 Cc: Yann E. MORIN Cc: Thomas Petazzoni Reviewed-by: Damien Le Moal --- Changes v3 -> v4: - Add tinyinit to Busybox dependencies - Add a comment to the tinyinit.mk just before the statements creating the symlink - Drop the comment from package/tinyinit/Config.in - Add the entry in the init selection in system/Config.in. 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/busybox/busybox.mk | 1 + package/tinyinit/Config.in | 8 ++++++++ package/tinyinit/init | 32 ++++++++++++++++++++++++++++++++ package/tinyinit/tinyinit.mk | 13 +++++++++++++ system/Config.in | 9 +++++++++ 7 files changed, 65 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 0b590f0ec20c..cf62d0ed65ae 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 211080345adc..af7f13a75f7e 100644 --- a/package/Config.in +++ b/package/Config.in @@ -2868,6 +2868,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/busybox/busybox.mk b/package/busybox/busybox.mk index 204ebe0106ee..942875ee0e12 100644 --- a/package/busybox/busybox.mk +++ b/package/busybox/busybox.mk @@ -68,6 +68,7 @@ BUSYBOX_DEPENDENCIES = \ $(if $(BR2_PACKAGE_UNZIP),unzip) \ $(if $(BR2_PACKAGE_USBUTILS),usbutils) \ $(if $(BR2_PACKAGE_UTIL_LINUX),util-linux) \ + $(if $(BR2_PACKAGE_TINYINIT),tinyinit) \ $(if $(BR2_PACKAGE_VIM),vim) \ $(if $(BR2_PACKAGE_WATCHDOG),watchdog) \ $(if $(BR2_PACKAGE_WGET),wget) \ diff --git a/package/tinyinit/Config.in b/package/tinyinit/Config.in new file mode 100644 index 000000000000..f68b030e7e0f --- /dev/null +++ b/package/tinyinit/Config.in @@ -0,0 +1,8 @@ +config BR2_PACKAGE_TINYINIT + bool "tinyinit" + depends on BR2_INIT_TINYINIT + imply BR2_PACKAGE_BUSYBOX + help + A Linux tiny initialization script suitable for resource + limited systems, which can be used as an alternative to the + one provided by Busybox. 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..ac1f0f736e38 --- /dev/null +++ b/package/tinyinit/tinyinit.mk @@ -0,0 +1,13 @@ +################################################################################ +# +# tinyinit +# +################################################################################ + +define TINYINIT_INSTALL_TARGET_CMDS + $(INSTALL) -m 0755 -D $(TINYINIT_PKGDIR)/init $(TARGET_DIR)/sbin/init + # Downside: In non-initramfs systems the symlink isn't used/needed + (cd $(TARGET_DIR); ln -sf /sbin/init init) +endef + +$(eval $(generic-package)) diff --git a/system/Config.in b/system/Config.in index d7d59db47db7..974152bd23e6 100644 --- a/system/Config.in +++ b/system/Config.in @@ -165,6 +165,15 @@ config BR2_INIT_TINI https://github.com/krallin/tini +config BR2_INIT_TINYINIT + bool "tiny init" + select BR2_PACKAGE_TINYINIT + select BR2_PACKAGE_SKELETON_INIT_NONE if BR2_ROOTFS_SKELETON_DEFAULT + help + A Linux tiny initialization script suitable for resource + limited systems, which can be used as an alternative to the + one provided by Busybox. + config BR2_INIT_NONE bool "Custom (none)" select BR2_PACKAGE_SKELETON_INIT_NONE if BR2_ROOTFS_SKELETON_DEFAULT From patchwork Sat Aug 31 12:08:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3348 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C0C493F338 for ; Sat, 31 Aug 2024 14:08:47 +0200 (CEST) Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2f3f16a39e0sf26626571fa.2 for ; Sat, 31 Aug 2024 05:08:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1725106127; cv=pass; d=google.com; s=arc-20240605; b=lOS9rOMrKQzodhlDjbS9bU5QEeYxhOIjiZ7dl9Z9SvW9xQdOYx4UdxKw5grU7u0F5l 46rlYXkSxj6FWM+wrsz5TC+gwdv6fQnnXB0OkjNAsHY/hUYW3TJanoCVP4RNxnIgIHVU Q4hbRBP8ZP/87nGxCnGrcnOp7yQa2g68rvI67HDeJJSn+OHWPIKAFIs2vLgt6Z+N6zdT xkYQNGQMfXi0PVKtVhHo102W7K2wDbNPvJMWpjzFGTkHQmPZ4Y1tKqioSqDVTNROnzpZ Y9fZV9oeP28BBBmtkO7/oVm3YZ3ZkicILjgQnIM6hSRyHC/WnrHJ2IVlmvbw4fcB3DL1 56Zg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=oB23lB755u0evq9f8o1s4Rx6EsORWRbBbycaW3MWuiI=; fh=A1SpY+S/td39y9MGxdrTbb3s44CxyjAquMoa0ZFVfQI=; b=NG+PFUNWUjCXWPOxOpa5YyQIXkz+4XED+2fR6lcsnBnz95Swr83BeGi16H0TLqQuSA LhX0i9dnCjqQ6mc4CS/y8krKgE81+Lx4/mSIhuFgJkI5KJqb91sabfKVgtzO5rlciBXc piL7jQhIHzIZIfIBPmRe+fnsaR5m8oX6D52B55Y+hw26tSZ7Lv4vWI+Jc2tJKEyZK5gg kwPwqLkGcMbYjBTiFKhN2LSihFGUZRyN/ZsKvj7mfQcxSGbVbhJ8JU2wus0z41lnk9ui rNFFkTy4SVMQSYtybbC6CmCRzDWfPLaYPwhOrwEWu0hggGVl7SB48Es8XESYS3wEh1Ro ZQWA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=nwLuW1ME; 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=1725106127; x=1725710927; 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=oB23lB755u0evq9f8o1s4Rx6EsORWRbBbycaW3MWuiI=; b=n5wWoJPviIH1vt2Nn+bBBAOyYuPUrgoVOTInCSFIETRWkVA0g1pyZu2gJFQUIy8/Kx 6obQZByz6XG8HjdOUjmIBzKgRTa7Csq03Qzvm9J3764B9mmRsuAXS6OYVQ7fdTC0GVfc b561jI2W54Oz7ljITDraav++tK/pUVFLOxMtQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725106127; x=1725710927; 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=oB23lB755u0evq9f8o1s4Rx6EsORWRbBbycaW3MWuiI=; b=RuBZFuAb4gZzQ+pp98uCLhczsFQLfqJ8qq+OWNPMyWdW3kWeTVkezJosWrSzy17S+Q BExNz6lDoRQHTEry253zTZtZeUjV+zJZ2qNBTzLH97crjtliU0xfxDZkCSg6Nm4UNFzo cZlEiFDFWukbaG5g0hYWyNFqtQvhNe8o6844Ps5/P8L45nccx/wh8hsxHx7l+vgs2HpT AF/hGlxMRMpNGvYg+BOtfsjD/ymsiYjLecRt2HeZUZMTFzKHX/7F+U70QjZuHyqwovbh 5eITGE5M4TyNslzgaS2wX+Tc9UT61rVPWxVg8P5PTATA1JBXzdHeD6dJvP5tklGNfj4e g5ww== X-Forwarded-Encrypted: i=2; AJvYcCVhfFvKfIKutmUqXY5lIi1v/wHSb96xdi5TxXNWCpg+0nn6XSRJrkTwlZ5sbGSc9jo/GmlWiUSN3FV88qZ0@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YwfmXzEsDjurj9R2wvXvugPzMljzrobWSxXalJ84VsaLEUIrIdN YUrE3RYLPBvhHaoqdas1ZbqXIA5BQgP7Olxw1kx1P5AlT0Kr0ur+N2uPFO+F9aX4Hg== X-Google-Smtp-Source: AGHT+IGJdaMo33Ce1G7EH+vpbBtmfspvYgMf20J2c89fFw0OjfJYNWUmF8kV8wP4Ax+vxJgSaTgRNQ== X-Received: by 2002:a2e:be08:0:b0:2f0:1a8f:4cd2 with SMTP id 38308e7fff4ca-2f6104f284dmr78522641fa.33.1725106126746; Sat, 31 Aug 2024 05:08:46 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a2e:2282:0:b0:2ee:7a6c:fcba with SMTP id 38308e7fff4ca-2f610a862eels10366781fa.1.-pod-prod-08-eu; Sat, 31 Aug 2024 05:08:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVaQuxSPtrd9yz9snuMMVsGLjpWg1ehMtLpcIMETzba+7WV/+ZjE8zQk2TzQTSnwptRZA5pdDa9APwsXOfn@amarulasolutions.com X-Received: by 2002:a05:651c:2210:b0:2f5:2e2:eadf with SMTP id 38308e7fff4ca-2f61039088cmr69694101fa.10.1725106124873; Sat, 31 Aug 2024 05:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725106124; cv=none; d=google.com; s=arc-20160816; b=Zv6UYZ4lMPUNkZJX/zjtKdGLIdy/Vyzk/GTIekoAkOH1OCsL+/Uj+cZI6YWs7UGnu7 O96cNPmD4d+Rz1WwId+BziJkzy3qzjmVDasUc8H2z2ZJ19EwfJnK192qRwpclpTI9/+T hKt5h+/ca1OfqB9HahtoUbSA+BBJQb29Cpkn8o1otf3Qs71nbQHPkyt/I3QTEb6JSokl aCE5tC/P6H+Xmr4RiePGft1IB2P0M4lAI/iJEwn7BQuQmoiqoX8cTrc3pY/BwlFaIkOL 2aAXzb+uW5boWcaArKmk847wiY6n8leG3RmjbAY6CTl2LNrbgMbChO/i/ae5pOOahjt3 Uocg== 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=TmBMI624XPvQVILDzBHHHhA6pjVilGnK++D3NnqAOmk=; fh=WkPQHKAkM4ve9DC0lVlopVz8mp+vYWyxkZ2vUnu92G4=; b=Ew+JaKoG0XFwUboz7xUOU3GkmwBpN3CY2JkKth2RPNVWmsCNjszdVGqlExZqqmscKf Lcqye4K88Tp+hu+JHiICne+nKrMwloPmP4lSxMM87egj/Y++RWnsyzX9+jGR5NV3u4bY uzqn1QyJiVfFVTG3bEfQ5pETz2n/a5g5+4i5u8b4XgQqMXnJzhoZwP2raG5dyTs49dvQ mUTmUY4TlOHQC/vRjKZaFU/6NlONbCpJxWKxM95SFAQeIWElOAqNxMpActfdneRX/4/y nTdg4eiZId75CARkNGwWVJPlwKri6YoSWWwBXdWfo0Kd4S5dWfTKIlaq8a7OvRY/jDjp CAzA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=nwLuW1ME; 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 4fb4d7f45d1cf-5c226cea324sor1133946a12.7.2024.08.31.05.08.44 for (Google Transport Security); Sat, 31 Aug 2024 05:08:44 -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; AJvYcCXYnk6RG+5wlduosJ+Nc3TE1Il9fYh8OZrwQJ73XIDVZ1pwwzCdWIuwn4nrbFCVu+rqmDghIuNqHD/gDZry@amarulasolutions.com X-Received: by 2002:a05:6402:1d56:b0:5c0:9097:c0fc with SMTP id 4fb4d7f45d1cf-5c21ed89fe2mr7378470a12.26.1725106124369; Sat, 31 Aug 2024 05:08:44 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-48-52-249.retail.telecomitalia.it. [82.48.52.249]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c226ce4f47sm2938178a12.88.2024.08.31.05.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2024 05:08:44 -0700 (PDT) From: Dario Binacchi To: buildroot@buildroot.org Cc: Damien Le Moal , Dario Binacchi , Thomas Petazzoni , "Yann E . MORIN" , linux-amarula@amarulasolutions.com, Waldemar Brodkorb Subject: [PATCH v4 2/3] configs/stm32f746_disco_sd: new defconfig Date: Sat, 31 Aug 2024 14:08:32 +0200 Message-ID: <20240831120833.2915529-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240831120833.2915529-1-dario.binacchi@amarulasolutions.com> References: <20240831120833.2915529-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=nwLuW1ME; 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 v3 -> v4: - Fix indentation in board/stmicroelectronics/stm32f746-disco/flash_sd.sh - Remove from board/stmicroelectronics/stm32f746-disco/post-build.sh the statements for finalizing the tinyinit script - Replace BR2_INIT_NONE=y and BR2_PACKAGE_TINYINIT=y with BR2_INIT_TINYINIT=y in stm32f746_disco_sd_defconfig - I ran some tests with a single partition, as suggested by Thomas, but the system became less stable. Even with just an `ls` command, I encountered issues with the device, whereas with two partitions, I can execute more commands before running into problems. The memory fragmentation has likely increased. So I therefore preferred to keep the two-partition system. 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 | 4 +++ .../stm32f746-disco/readme.txt | 31 +++++++++++++++++++ configs/stm32f746_disco_sd_defconfig | 31 +++++++++++++++++++ 11 files changed, 139 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 cf62d0ed65ae..70e57598486e 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..b4858cb9dacb --- /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..5dcdb352eb3b --- /dev/null +++ b/board/stmicroelectronics/stm32f746-disco/post-build.sh @@ -0,0 +1,4 @@ +#!/bin/sh +BOARD_DIR="$(dirname "$0")" + +install -m 0644 -D "${BOARD_DIR}"/extlinux.conf "${BINARIES_DIR}"/extlinux/extlinux.conf 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..870dde318324 --- /dev/null +++ b/configs/stm32f746_disco_sd_defconfig @@ -0,0 +1,31 @@ +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_TINYINIT=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_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 Sat Aug 31 12:08:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3349 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 4557E3FA6C for ; Sat, 31 Aug 2024 14:08:48 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-5c2486f1f14sf267170a12.1 for ; Sat, 31 Aug 2024 05:08:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1725106128; cv=pass; d=google.com; s=arc-20240605; b=LOPNgbqgpK68VHM/54ZLdTMD9f7JItPDIkQ/zaIwAsGjXi65tJsJnFE4i40pF0hTnG XQbTPvspz0VctLqyEk3X+9hbsMNkgQCbUn29bwTmhj5iannkRjpE6E3dTfGPQMGTURs5 PkkTFAWI9bpdcOUCdfUfJ79iwAb4oVIPcXovFLV/2dPdk7cmHwCme3h9llTSw2wToihE 8TmudON6NOOPGGVJhF8cLZwVJZ3uFb8DW06SUebOfFw6/ZQY1DVCyo3brw70RUo9kq0D owBwcvDnj1225FhibZt03ARFYqOWRdw+7M5d0z+PXCVjn7LoXIsAcv8UuABtp4b/++Nj l9tw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=rblI1BnTjmpEJdJE+Z140Mqb6/+IVBlOGkYkGf+H7qA=; fh=gyUMYdGv30mt24+ABZttD4ehnU7bfq4pw92aQZ2uigQ=; b=J/qUzMYzrFKWkzdxDrnQQ9B+O2+3ylvtwAcca3EU8xfy1YsbJ+X+p8vjZKSeJ2eWJ7 X0PJa/rQjQ0GZGSri2pLKnC0U05kWnSFTza8X3v7PDbzOtG1lks2OapwH8wYXMc5Aozh zjSwcY2FfexB5UcjuFhRsT5wetJ4svsN9xU5YjbvCjjcNa8LCWNlFHjMbDOTBguFOj/t XEJc6+ygwSeGdRpuXTsfW+cJ1qc4AdqTbLmecqnmuM6NOSq5uPHcj4Jt8r9T8QDubrqx SJJXOYSy7ZO6oh5OiFimASxs1WpdeISVJMehrlZNLMyFQgvxOagKkFQmZGV9VIqu+Mx8 EFyA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Fd4CfUNO; 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=1725106128; x=1725710928; 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=rblI1BnTjmpEJdJE+Z140Mqb6/+IVBlOGkYkGf+H7qA=; b=ZFsxEhZMIofTRMc6jBDDrbFm0FZsMiOqH2tN5o9msnZ7Ajcv8uTQikpcJUEbnEkYp5 F1HnLY+bU2aDEhQFY/zP1MFiU/QJHzX4V4r3ucYp9wDTAyFLZlvlhPgtX6h40bhj5XiY TmKcN4m86SLsPqRwoGoejlOQuyWr2Y5snZ5Xw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725106128; x=1725710928; 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=rblI1BnTjmpEJdJE+Z140Mqb6/+IVBlOGkYkGf+H7qA=; b=whKElcDqP44i0SeMk6r/j1H3JAF2gkUnHSHcHHIbzH2005oQ12ZRolJl+vwoIDLZ6h GfzQQArjIUXcf3AZ84TM1MjYRaM++QpC4Yx77j6mBCz6e8FS3gW/2QeNZbDKbcuJ+O3C p5oFkhAsbWRC5n9OO7Orf5AQ3mh1tdAnsTOk8IKGMEUxmbCdVdiKtGAEYxeoeZfKlJy1 MCAbP5XbV67T4Jz79Mgleyc+qDQXO/AGDMnntwMQoN+PHraYCRgSfncuSH+4WDfUvMgO 98PrXgtPeHbSfQmCD/6zk5fUJTcKQ4+wDiYgZLzCbTf3D5j1AQYyeA1RBHwcf9qpHS6B KBKQ== X-Forwarded-Encrypted: i=2; AJvYcCWK31jzicje/DPeaekdKWwSlsC4Mo3lNe9jXw0q0OVIy3Ch3pG+wpGcwYoAJy5DPB/e2nkYOli4u5QrOkJS@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yz4GNY+KQ7BQK1ZRNXAgmrhiIUfjWAgmjmFHI2x7ZD7T+q+5A8T lKfUuuKGddRIAjRrvGC7jf765Wk3m86IV0VIxYLINIXS5OEviLnJCVxFmQQFdR2grw== X-Google-Smtp-Source: AGHT+IGmu8C+bskEY9cIjKFq1pjRajic0VEXDRA/QWy5N3oOl5PXxC++eA11MTeDrPAGpFLEYSHL3A== X-Received: by 2002:a05:6402:3584:b0:5c0:a8ba:3cf0 with SMTP id 4fb4d7f45d1cf-5c21ed32f2bmr6650577a12.8.1725106127838; Sat, 31 Aug 2024 05:08:47 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:34c9:b0:5be:ea4f:8c6d with SMTP id 4fb4d7f45d1cf-5c21ec5504fls423997a12.2.-pod-prod-03-eu; Sat, 31 Aug 2024 05:08:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX55KiRrUASlF/P6Y918drZe8cMJ1Es7YIhQHu1+nkGc5yMOfFbH/k4Jh+Cfaq7IUAgiXH3174bmjB/1B6v@amarulasolutions.com X-Received: by 2002:a05:6402:518a:b0:5c2:4dcc:b90a with SMTP id 4fb4d7f45d1cf-5c24dccbb2emr368978a12.34.1725106126179; Sat, 31 Aug 2024 05:08:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725106126; cv=none; d=google.com; s=arc-20160816; b=Vgzxsc6QFRZjLZMA2ksjSObQFcihFucPVJaOO18IQpnBdwprk9mEmQRydg4IGvxXcH XjGlhHDu3/RJ/ajo14woFBidM5J214TMkOEW75vGleiCWPAbB9qaABnXUqwmmwf3yC6e xMTm/oYvJIlJkGsZlF1c1mGLzwzZqseztkHNH349wuh/Ouvl7HawtpE4lljwYnwvn2SD 5LoEe4j9gfdkIDVC48za6ATCqyPbaS1e1F59gAT9uX9KWyLPPgSNQOYmDhlBeDSyVFnx 2bbTJaD8Ek/hOSUEZkQJlAJex6eMmgNfPwuu81GIj3BpKfCgXNDAfgCo5caRf35iEQoU L5DA== 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=JSKYc6C8TT6iYubA26m8JbSuDNI8sNNGFRv1JezIBfI=; fh=47hGyxz7P7S9RfaXLOqyFNAsJ3fsL0ob/ncZGuDa4/0=; b=AlV9pVcqd9M6l+JqjxMX7/DVpV7MyYIPwdVaVcio7WBdx1sSKf35dbtW/XWXaWYIM7 WLjKszjNd58dVHzZfbygvzMxUdLH0mkSBSJnqMLN1fIIPOpJQzikybbJb01D8E9rOqYs wmS+IYbuItN2LXxZ1lfM2nH+qu6shqR0X3VoF5mB3je9BmfuDokibFl/HeXd5X/MWpD6 keHfuQDFbI9aiW1OH+2oiE4rYa1SKqmy87tPeqGR+z2pTe8gIJYqJKFiFY8rZMzjxJfF vHf2RFsPqIGHvY4y3jRWjK7rPolzbkyi4gqaZ2rj4gFC7gVu6h2zLeyrXd7ZI7xgiwa4 kqlQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Fd4CfUNO; 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 4fb4d7f45d1cf-5c226cda875sor1128158a12.8.2024.08.31.05.08.46 for (Google Transport Security); Sat, 31 Aug 2024 05:08: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; AJvYcCWCa5aT2sMSDl7u/y3tOcquAXYeEzo33k93M++VHIAzrWRL7IP2J6g0yfW2UcbHF8gjcKVITXz3kMoPwahx@amarulasolutions.com X-Received: by 2002:a05:6402:518a:b0:5c2:4dcc:b90a with SMTP id 4fb4d7f45d1cf-5c24dccbb2emr368947a12.34.1725106125330; Sat, 31 Aug 2024 05:08:45 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-48-52-249.retail.telecomitalia.it. [82.48.52.249]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c226ce4f47sm2938178a12.88.2024.08.31.05.08.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2024 05:08:45 -0700 (PDT) From: Dario Binacchi To: buildroot@buildroot.org Cc: Damien Le Moal , Dario Binacchi , Thomas Petazzoni , "Yann E . MORIN" , linux-amarula@amarulasolutions.com Subject: [PATCH v4 3/3] board/canaan/k210-soc: use tinyinit as Linux init process Date: Sat, 31 Aug 2024 14:08:33 +0200 Message-ID: <20240831120833.2915529-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240831120833.2915529-1-dario.binacchi@amarulasolutions.com> References: <20240831120833.2915529-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=Fd4CfUNO; 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 Reviewed-by: Damien Le Moal --- Changes v3 -> v4: - Replace BR2_INIT_NONE=y and BR2_PACKAGE_TINYINIT=y with BR2_INIT_TINYINIT=y in stm32f746_disco_sd_defconfig 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 | 3 +- configs/sipeed_maix_bit_defconfig | 3 +- configs/sipeed_maix_bit_sdcard_defconfig | 3 +- configs/sipeed_maix_dock_defconfig | 3 +- configs/sipeed_maix_dock_sdcard_defconfig | 3 +- configs/sipeed_maix_go_defconfig | 3 +- configs/sipeed_maix_go_sdcard_defconfig | 3 +- configs/sipeed_maixduino_defconfig | 3 +- configs/sipeed_maixduino_sdcard_defconfig | 3 +- 12 files changed, 9 insertions(+), 61 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 4cfc202153c7..849bb2a55e47 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..27624aff4a9a 100644 --- a/configs/canaan_kd233_defconfig +++ b/configs/canaan_kd233_defconfig @@ -32,6 +32,5 @@ BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/busybox-tiny.co # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set # Filesystem -BR2_INIT_NONE=y +BR2_INIT_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..5119307330de 100644 --- a/configs/sipeed_maix_bit_defconfig +++ b/configs/sipeed_maix_bit_defconfig @@ -32,6 +32,5 @@ BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/busybox-tiny.co # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set # Filesystem -BR2_INIT_NONE=y +BR2_INIT_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..4047da159221 100644 --- a/configs/sipeed_maix_bit_sdcard_defconfig +++ b/configs/sipeed_maix_bit_sdcard_defconfig @@ -33,10 +33,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="canaan/sipeed_maix_bit" # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set # Filesystem -BR2_INIT_NONE=y +BR2_INIT_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..0caa4d4e3ae3 100644 --- a/configs/sipeed_maix_dock_defconfig +++ b/configs/sipeed_maix_dock_defconfig @@ -32,6 +32,5 @@ BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/busybox-tiny.co # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set # Filesystem -BR2_INIT_NONE=y +BR2_INIT_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..ecb640a47bb2 100644 --- a/configs/sipeed_maix_dock_sdcard_defconfig +++ b/configs/sipeed_maix_dock_sdcard_defconfig @@ -33,10 +33,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="canaan/sipeed_maix_dock" # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set # Filesystem -BR2_INIT_NONE=y +BR2_INIT_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..21075a9ed004 100644 --- a/configs/sipeed_maix_go_defconfig +++ b/configs/sipeed_maix_go_defconfig @@ -32,6 +32,5 @@ BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/busybox-tiny.co # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set # Filesystem -BR2_INIT_NONE=y +BR2_INIT_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..5448bd0ce351 100644 --- a/configs/sipeed_maix_go_sdcard_defconfig +++ b/configs/sipeed_maix_go_sdcard_defconfig @@ -33,10 +33,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="canaan/sipeed_maix_go" # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set # Filesystem -BR2_INIT_NONE=y +BR2_INIT_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..6c93b29b4343 100644 --- a/configs/sipeed_maixduino_defconfig +++ b/configs/sipeed_maixduino_defconfig @@ -32,6 +32,5 @@ BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/busybox-tiny.co # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set # Filesystem -BR2_INIT_NONE=y +BR2_INIT_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..0b42cae45df7 100644 --- a/configs/sipeed_maixduino_sdcard_defconfig +++ b/configs/sipeed_maixduino_sdcard_defconfig @@ -33,10 +33,9 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="canaan/sipeed_maixduino" # BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set # Filesystem -BR2_INIT_NONE=y +BR2_INIT_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"