Skip to contentSkip to conversation

tinyinit and stm32f746_disco_sd_defconfig

PATCH Superseded Dario Binacchi 3 participants 12 messages Aug 22, 2024 – Aug 30, 2024 Arm STM32

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover tinyinit and stm32f746_disco_sd_defconfig

This series is inspired by reading the following topic:

https://lore.kernel.org/buildroot/20230206230203.70e2dbd8@windsurf/T

Starting from that patch, and following Thomas Petazzoni's suggestions regarding the possibility of using a single minimal script without duplicating it within Buildroot, I developed these three patches. Meanwhile, the configuration for the stm32f746_disco board was useful for developing the display support for the board, which was later merged into Linux.

Dario Binacchi (3):
package/tinyinit: new package configs/stm32f746_disco_sd: new defconfig board/canaan/k210-soc: use tinyinit as Linux init process

 .checkpackageignore                           |  1 -
 DEVELOPERS                                    |  3 ++
 board/canaan/k210-soc/rootfs_overlay/init     |  1 -
 .../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/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 +-
 configs/stm32f746_disco_sd_defconfig          | 32 +++++++++++++++++++
 package/Config.in                             |  1 +
 package/tinyinit/Config.in                    | 10 ++++++
 .../sbin => package/tinyinit}/init            | 11 +------
 package/tinyinit/tinyinit.mk                  | 12 +++++++
 26 files changed, 179 insertions(+), 21 deletions(-)
 delete mode 120000 board/canaan/k210-soc/rootfs_overlay/init
 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
 create mode 100644 package/tinyinit/Config.in
 rename {board/canaan/k210-soc/rootfs_overlay/sbin => package/tinyinit}/init (75%)
 mode change 100755 => 100644
 create mode 100644 package/tinyinit/tinyinit.mk
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v3 1/3 package/tinyinit: new package

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.

---

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
DEVELOPERS +1 -0
index d7d0af35431b..45cc1cc48996 100644
@@ -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 <[email protected]>
package/Config.in +1 -0
index 317f859684fe..ddf378b13e01 100644
@@ -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"
package/tinyinit/Config.in new file +10 -0
new file mode 100644
index 000000000000..2ceb8e191e23
@@ -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
package/tinyinit/init new file +32 -0
new file mode 100644
index 000000000000..fbcb481010c2
@@ -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/console) 2>/dev/null; then
+    exec 0</dev/console
+    exec 1>/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
package/tinyinit/tinyinit.mk new file +12 -0
new file mode 100644
index 000000000000..c7bb144dee68
@@ -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))
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH v3 1/3] package/tinyinit: new package

Quoted 6 lines · On Thu, 22 Aug 2024 20:37:40 +0200 Dario Binacchi…
 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(+)

We also need to change busybox.mk to ensure that tinyinit is built before Busybox:

# Packages that provide commands that may also be busybox applets:

BUSYBOX_DEPENDENCIES = \
	...
	$(if $(BR2_PACKAGE_TINYINIT),tinyinit) \
Quoted 6 lines
package/tinyinit/Config.in new file +0 -0
new file mode 100644
index 000000000000..2ceb8e191e23

package/tinyinit/Config.in line 10

Quoted 10 lines
package/tinyinit/Config.in new file +10 -0
@@ -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

I find this a bit odd. In the end, shouldn't we simply promote tinyinit as an init implementation, and have its own BR2_INIT_TINYINIT entry?

Also, should BR2_PACKAGE_TINYINIT select busybox? Or do we pretend that it is possible to use it with some other implementations of mount and other basic commands? Perhaps this is a good case to use "imply BR2_PACKAGE_BUSYBOX", so that BR2_PACKAGE_TINYINIT enables busybox by default, but still allows removing busybox if really the user knows what (s)he is doing?

package/tinyinit/Config.in

Quoted 3 lines
package/tinyinit/Config.in new file +3 -0
+define TINYINIT_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0755 -D $(TINYINIT_PKGDIR)/init $(TARGET_DIR)/sbin/init
+	(cd $(TARGET_DIR); ln -sf /sbin/init init)

Hmm. I initially thought this symlink shouldn't be needed, as it's created by fs/cpio/cpio.mk when you're building a cpio for initramfs:

ifeq ($(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)

define ROOTFS_CPIO_ADD_INIT

        if [ ! -e $(TARGET_DIR)/init ]; then \
                ln -sf sbin/init $(TARGET_DIR)/init; \
        fi

endef

else

# devtmpfs does not get automounted when initramfs is used.
# Add a pre-init script to mount it before running init
# We must have /dev/console very early, even before /init runs,
# for stdin/stdout/stderr
define ROOTFS_CPIO_ADD_INIT
        if [ ! -e $(TARGET_DIR)/init ]; then \
                $(INSTALL) -m 0755 fs/cpio/init $(TARGET_DIR)/init; \
        fi
        mkdir -p $(TARGET_DIR)/dev
        mknod -m 0622 $(TARGET_DIR)/dev/console c 5 1
endef

But actually, in the case of a non-static /dev, it doesn't do a symlink, but adds a pre-init script, and your tinyinit already does the tasks of this pre-init provided by fs/cpio/init.

So I guess what you did is probably OK, but maybe a comment would be useful. The only downside of your approach is that it leaves a /init symlink that isn't used/needed for non-initramfs use-cases, but perhaps that's OK.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH v3 1/3] package/tinyinit: new package

Hello Thomas and Yann,

Quoted 31 lines · Thomas Petazzoni
Quoted 6 lines · On Thu, 22 Aug 2024 20:37:40 +0200 Dario Binacchi…
 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(+)

We also need to change busybox.mk to ensure that tinyinit is built before Busybox:

# Packages that provide commands that may also be busybox applets:

BUSYBOX_DEPENDENCIES = \
        ...
        $(if $(BR2_PACKAGE_TINYINIT),tinyinit) \
Quoted 11 lines
package/tinyinit/Config.in new file +5 -0
new file mode 100644
index 000000000000..2ceb8e191e23
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_TINYINIT
+     bool "tinyinit"
+     depends on BR2_INIT_NONE
+     help
+       A Linux tiny initialization script suitable for resource
Quoted 8 lines

package/tinyinit/Config.in line 10

Quoted 5 lines
package/tinyinit/Config.in new file +5 -0
+       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

I find this a bit odd. In the end, shouldn't we simply promote tinyinit as an init implementation, and have its own BR2_INIT_TINYINIT entry?

I removed TINYINIT from the init selections based on Yann's suggestion:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

IMHO, I believe there are positive aspects in both implementations, but my knowledge
on the subject is more limited compared to yours. From my side, I can assure you that
there's no problem to restore tinyinit as a new entry in the list of init options.

Thanks and regards,
Dario

Quoted 51 lines

Also, should BR2_PACKAGE_TINYINIT select busybox? Or do we pretend that it is possible to use it with some other implementations of mount and other basic commands? Perhaps this is a good case to use "imply BR2_PACKAGE_BUSYBOX", so that BR2_PACKAGE_TINYINIT enables busybox by default, but still allows removing busybox if really the user knows what (s)he is doing?

package/tinyinit/Config.in

Quoted 3 lines
package/tinyinit/Config.in new file +3 -0
+define TINYINIT_INSTALL_TARGET_CMDS
+     $(INSTALL) -m 0755 -D $(TINYINIT_PKGDIR)/init $(TARGET_DIR)/sbin/init
+     (cd $(TARGET_DIR); ln -sf /sbin/init init)

Hmm. I initially thought this symlink shouldn't be needed, as it's created by fs/cpio/cpio.mk when you're building a cpio for initramfs:

ifeq ($(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)

define ROOTFS_CPIO_ADD_INIT

        if [ ! -e $(TARGET_DIR)/init ]; then \
                ln -sf sbin/init $(TARGET_DIR)/init; \
        fi

endef

else

# devtmpfs does not get automounted when initramfs is used.
# Add a pre-init script to mount it before running init
# We must have /dev/console very early, even before /init runs,
# for stdin/stdout/stderr
define ROOTFS_CPIO_ADD_INIT
        if [ ! -e $(TARGET_DIR)/init ]; then \
                $(INSTALL) -m 0755 fs/cpio/init $(TARGET_DIR)/init; \
        fi
        mkdir -p $(TARGET_DIR)/dev
        mknod -m 0622 $(TARGET_DIR)/dev/console c 5 1
endef

But actually, in the case of a non-static /dev, it doesn't do a symlink, but adds a pre-init script, and your tinyinit already does the tasks of this pre-init provided by fs/cpio/init.

So I guess what you did is probably OK, but maybe a comment would be useful. The only downside of your approach is that it leaves a /init symlink that isn't used/needed for non-initramfs use-cases, but perhaps that's OK.

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com

Signature · 21 lines
Dario Binacchi

Senior Embedded Linux Developer

[email protected]

__________________________________


Amarula Solutions SRL

Via Le Canevare 30, 31100 Treviso, Veneto, IT

T. +39 042 243 5310
[email protected]

www.amarulasolutions.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

Re: [Buildroot] [PATCH v3 1/3] package/tinyinit: new package

In reply to Thomas Petazzoni via buildroot

Thomas, All,

On 2024-08-23 18:17 +0200, Thomas Petazzoni spake thusly:

Quoted 2 lines

On Thu, 22 Aug 2024 20:37:40 +0200
Dario Binacchi <[email protected]> wrote:

[--SNIP--]

Quoted 7 lines

We also need to change busybox.mk to ensure that tinyinit is built before Busybox:

# Packages that provide commands that may also be busybox applets:

BUSYBOX_DEPENDENCIES = \
	...
	$(if $(BR2_PACKAGE_TINYINIT),tinyinit) \

Good catch! We also need that for tini, then.

Quoted 10 lines
Quoted 10 lines
package/tinyinit/Config.in new file +4 -0
new file mode 100644
index 000000000000..2ceb8e191e23
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_TINYINIT
+	bool "tinyinit"
+	depends on BR2_INIT_NONE
+	help
Quoted 8 lines

package/tinyinit/Config.in line 10

Quoted 6 lines
package/tinyinit/Config.in new file +6 -0
+	  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

I find this a bit odd. In the end, shouldn't we simply promote tinyinit as an init implementation, and have its own BR2_INIT_TINYINIT entry?

As Dario already pointed out, that was my suggestion to drop it from the init selection.

The reasoning is that we need to know the init system when we need some infra for it. For example, for busybox/sysvinit, we need to install init scripts, for systemd, the units, and for openrc, the openrc "units".

And the "None" init choice really is "Custom", in that there is always a PID-1 process, whether in a real system, a VM, or a container: it is the first process that is started in that environment. Now, whether that process is a real init system, a stub, or directly the final applicaiton, it is still a PID-1, and thus treated as 'init' by the kernel.

The existing tini package is to be used a a PID-1 in containers (I use it extensively in that situation) and it does not need any infra in Buildroot (it can only spawn a single child and is a reaper); to my eyes, tiny-init is also very simple and does not require any infra in Buildroot. Both tini and tiny-init are cases for a "Custom" init (currently labelled "None").

Regards,
Yann E. MORIN.

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

Re: [Buildroot] [PATCH v3 1/3] package/tinyinit: new package

Quoted 6 lines · On Tue, 27 Aug 2024 22:07:04 +0200 "Yann E. MORIN" <[email protected]>…
Quoted 4 lines

# Packages that provide commands that may also be busybox applets:

BUSYBOX_DEPENDENCIES = \
	...
	$(if $(BR2_PACKAGE_TINYINIT),tinyinit) \  

Good catch! We also need that for tini, then.

Yes.

Quoted 18 lines
Quoted 4 lines

package/tinyinit/Config.in line 10

Quoted 2 lines
package/tinyinit/Config.in new file +2 -0
+comment "tinyinit needs BR2_INIT_NONE, i. e. no init system installed"
+	depends on !BR2_INIT_NONE  

I find this a bit odd. In the end, shouldn't we simply promote tinyinit as an init implementation, and have its own BR2_INIT_TINYINIT entry?

As Dario already pointed out, that was my suggestion to drop it from the init selection.

The reasoning is that we need to know the init system when we need some infra for it. For example, for busybox/sysvinit, we need to install init scripts, for systemd, the units, and for openrc, the openrc "units".

And the "None" init choice really is "Custom", in that there is always a PID-1 process, whether in a real system, a VM, or a container: it is the first process that is started in that environment. Now, whether that process is a real init system, a stub, or directly the final applicaiton, it is still a PID-1, and thus treated as 'init' by the kernel.

Quoted 6 lines

The existing tini package is to be used a a PID-1 in containers (I use it extensively in that situation) and it does not need any infra in Buildroot (it can only spawn a single child and is a reaper); to my eyes, tiny-init is also very simple and does not require any infra in Buildroot. Both tini and tiny-init are cases for a "Custom" init (currently labelled "None").

I understand your point, but:

(1) It is really unclear for the user that they have to chose "None" as init to be able to use tinyinit (tinyinit is proposed with depends on BR2_INIT_NONE)

(2) Due to (1), Dario has added a "tinyinit needs BR2_INIT_NONE, i. e. no init system installed" Config.in comment, which I also find odd

So while I understand your point that tinyinit or tini don't need as much infrastructure/logic as busybox init/sysvinit/systemd/openrc, I find the current way they are presented to be very weird (but I can live with it).

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Re: [Buildroot] [PATCH v3 1/3] package/tinyinit: new package

Thomas, All,

On 2024-08-29 23:47 +0200, Thomas Petazzoni spake thusly:

Quoted 4 lines
Quoted 2 lines · On Tue, 27 Aug 2024 22:07:04 +0200 "Yann E. MORIN" <[email protected]>…

As Dario already pointed out, that was my suggestion to drop it from the init selection.

[--SNIP--]

Quoted 7 lines

I understand your point, but:

(1) It is really unclear for the user that they have to chose "None" as init to be able to use tinyinit (tinyinit is proposed with depends on BR2_INIT_NONE)
(2) Due to (1), Dario has added a "tinyinit needs BR2_INIT_NONE, i. e. no init system installed" Config.in comment, which I also find odd

To me, it really all looked very obvious, exactly thanks to the comment.

tiniy-init is also not a reaper, which dos not really make it an init either...

Note that tini does not install itself as /init or /sbin/init, but just as /usr/bin/tini (and a symlink in /usr/libexec/docker/docker-init); tini is also a reaper.

Quoted 4 lines

So while I understand your point that tinyinit or tini don't need as much infrastructure/logic as busybox init/sysvinit/systemd/openrc, I find the current way they are presented to be very weird (but I can live with it).

Then I think we should also organise the selection list, like:

Init system
*** General purpose ***
( ) BusyBox
( ) systemV
( ) OpenRC
( ) systemd
*** Special purpose, read help *** ( ) tini
( ) tinyinit
( ) Custom (aka none)
*** My br2-ext (in /path/to/my-br2-ext) *** ( ) my-init

(br2-external entries are added by support/scripts/br2-external).

Regards,
Yann E. MORIN.

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

PATCH v3 2/3 configs/stm32f746_disco_sd: new defconfig

In reply to Dario Binacchi

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

---

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
DEVELOPERS +2 -0
index 45cc1cc48996..e8dc27f7ad47 100644
@@ -785,10 +785,12 @@ F:	package/xinetd/
 
 N:	Dario Binacchi <[email protected]>
 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/
board/stmicroelectronics/stm32f746-disco/extlinux.conf new file +4 -0
new file mode 100644
index 000000000000..bb79c0b412a2
@@ -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
board/stmicroelectronics/stm32f746-disco/flash_sd.sh new file +22 -0
new file mode 100755
index 000000000000..4fe85448f984
@@ -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"
board/stmicroelectronics/stm32f746-disco/genimage.cfg new file +27 -0
new file mode 100644
index 000000000000..6743d41972c0
@@ -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
+	}
+}
board/stmicroelectronics/stm32f746-disco/linux.fragment new file +13 -0
new file mode 100644
index 000000000000..625fdced9e8d
@@ -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
board/stmicroelectronics/stm32f746-disco/patches/linux-headers/linux-headers.hash new file +1 -0
new file mode 120000
index 000000000000..5808d92afe89
@@ -0,0 +1 @@
+../linux/linux.hash
\ No newline at end of file
board/stmicroelectronics/stm32f746-disco/patches/linux/linux.hash new file +2 -0
new file mode 100644
index 000000000000..7f78b950f35c
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256  a36dd3e82ceb634afded31f2656568f57c4d9c4b399859f298b18116df11c6fe  linux-5.15.165.tar.xz
board/stmicroelectronics/stm32f746-disco/patches/uboot/uboot.hash new file +2 -0
new file mode 100644
index 000000000000..fe9b4f53dc63
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256  f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f  u-boot-2024.07.tar.bz2
board/stmicroelectronics/stm32f746-disco/post-build.sh new file +9 -0
new file mode 100755
index 000000000000..2894ad851c66
@@ -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}"
board/stmicroelectronics/stm32f746-disco/readme.txt new file +31 -0
new file mode 100644
index 000000000000..4ac16da33132
@@ -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/<your-sd-device>
+
+*** 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.
configs/stm32f746_disco_sd_defconfig new file +32 -0
new file mode 100644
index 000000000000..8c92afc5740e
@@ -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
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw

Re: [Buildroot] [PATCH v3 2/3] configs/stm32f746_disco_sd: new defconfig

Hello,

Quoted 18 lines · On Thu, 22 Aug 2024 20:37:41 +0200 Dario Binacchi…
board/stmicroelectronics/stm32f746-disco/flash_sd.sh new file +12 -0
new file mode 100755
index 000000000000..4fe85448f984
@@ -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

board/stmicroelectronics/stm32f746-disco/flash_sd.sh line 22

Quoted 10 lines
board/stmicroelectronics/stm32f746-disco/flash_sd.sh new file +10 -0
+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"

Could you keep the indentation consistent? Above you used 4 spaces, and here only 2.

Quoted 13 lines
board/stmicroelectronics/stm32f746-disco/genimage.cfg new file +7 -0
new file mode 100644
index 000000000000..6743d41972c0
@@ -0,0 +1,27 @@
+image boot.vfat {
+	vfat {
+		files = {
+			"zImage",
+			"stm32f746-disco.dtb",
+			"extlinux"
+		}

board/stmicroelectronics/stm32f746-disco/genimage.cfg line 17

Quoted 10 lines
board/stmicroelectronics/stm32f746-disco/genimage.cfg new file +10 -0
+	}
+
+	size = 16M
+}
+
+image sdcard.img {
+	hdimage {
+	}
+
+	partition u-boot {

Why is this partition called u-boot? It doesn't contain anything u-boot related.

board/stmicroelectronics/stm32f746-disco/genimage.cfg line 19

Quoted 2 lines
board/stmicroelectronics/stm32f746-disco/genimage.cfg new file +2 -0
+		partition-type = 0xC
+		image = "boot.vfat"

But why is a VFAT partition needed in fact? Why can't U-Boot simply get the kernel+DTB from the ext4 rootfs partition?

Quoted 6 lines
board/stmicroelectronics/stm32f746-disco/post-build.sh new file +0 -0
new file mode 100755
index 000000000000..2894ad851c66

board/stmicroelectronics/stm32f746-disco/post-build.sh line 9

Quoted 9 lines
board/stmicroelectronics/stm32f746-disco/post-build.sh new file +9 -0
@@ -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}"

Meh, this kind of sucks. tinyinit does one thing and we have to undo it here. Not great. Can we do better, i.e decide whether it makes sense to do it or not? To be honest, I am not sure if this is really useful to do at boot time.

Quoted 28 lines
configs/stm32f746_disco_sd_defconfig new file +22 -0
new file mode 100644
index 000000000000..8c92afc5740e
@@ -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

configs/stm32f746_disco_sd_defconfig line 32

Quoted 10 lines
configs/stm32f746_disco_sd_defconfig new file +10 -0
+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

If you drop the FAT partition, you can drop BR2_PACKAGE_HOST_MTOOLS=y and BR2_PACKAGE_HOST_DOSFSTOOLS=y.

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#9 lore raw

Re: [Buildroot] [PATCH v3 2/3] configs/stm32f746_disco_sd: new defconfig

Hello Thomas,

Quoted 29 lines · Thomas Petazzoni

Hello,

Quoted 23 lines · On Thu, 22 Aug 2024 20:37:41 +0200 Dario Binacchi…
board/stmicroelectronics/stm32f746-disco/flash_sd.sh new file +17 -0
new file mode 100755
index 000000000000..4fe85448f984
@@ -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" \
Quoted 8 lines

board/stmicroelectronics/stm32f746-disco/flash_sd.sh line 22

Quoted 5 lines
board/stmicroelectronics/stm32f746-disco/flash_sd.sh new file +5 -0
+  -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"

Could you keep the indentation consistent? Above you used 4 spaces, and here only 2.

You are right. Sorry.

Quoted 28 lines
Quoted 14 lines
board/stmicroelectronics/stm32f746-disco/genimage.cfg new file +7 -0
new file mode 100644
index 000000000000..6743d41972c0
@@ -0,0 +1,27 @@
+image boot.vfat {
+     vfat {
+             files = {
+                     "zImage",
+                     "stm32f746-disco.dtb",
+                     "extlinux"
+             }

board/stmicroelectronics/stm32f746-disco/genimage.cfg line 17

Quoted 10 lines
board/stmicroelectronics/stm32f746-disco/genimage.cfg new file +10 -0
+     }
+
+     size = 16M
+}
+
+image sdcard.img {
+     hdimage {
+     }
+
+     partition u-boot {

Why is this partition called u-boot? It doesn't contain anything u-boot related.

Quoted 5 lines

board/stmicroelectronics/stm32f746-disco/genimage.cfg line 19

Quoted 2 lines
board/stmicroelectronics/stm32f746-disco/genimage.cfg new file +2 -0
+             partition-type = 0xC
+             image = "boot.vfat"

But why is a VFAT partition needed in fact? Why can't U-Boot simply get the kernel+DTB from the ext4 rootfs partition?

I ran some tests with a single partition, as you suggested, 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 would therefore prefer to keep the two-partition system.

As Waldemar suggested:
https://lore.kernel.org/buildroot/20230930223622.06e32f3c@windsurf/T/
I'd be curious to see the stability with FDPIC support. But that's another story :)

Quoted 14 lines
Quoted 14 lines
board/stmicroelectronics/stm32f746-disco/post-build.sh new file +6 -0
new file mode 100755
index 000000000000..2894ad851c66
@@ -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
Quoted 8 lines

board/stmicroelectronics/stm32f746-disco/post-build.sh line 9

Quoted 3 lines
board/stmicroelectronics/stm32f746-disco/post-build.sh new file +3 -0
+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}"

Meh, this kind of sucks. tinyinit does one thing and we have to undo it here. Not great. Can we do better, i.e decide whether it makes sense to do it or not? To be honest, I am not sure if this is really useful to do at boot time.

I think it's better to remove those instructions from "post-build.sh" to ensure functional
backward compatibility with the boards from which the script was borrowed.

Thanks and regards,
Dario

Quoted 51 lines
Quoted 30 lines
configs/stm32f746_disco_sd_defconfig new file +22 -0
new file mode 100644
index 000000000000..8c92afc5740e
@@ -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

configs/stm32f746_disco_sd_defconfig line 32

Quoted 10 lines
configs/stm32f746_disco_sd_defconfig new file +10 -0
+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

If you drop the FAT partition, you can drop BR2_PACKAGE_HOST_MTOOLS=y and BR2_PACKAGE_HOST_DOSFSTOOLS=y.

Thanks!

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com

Signature · 21 lines
Dario Binacchi

Senior Embedded Linux Developer

[email protected]

__________________________________


Amarula Solutions SRL

Via Le Canevare 30, 31100 Treviso, Veneto, IT

T. +39 042 243 5310
[email protected]

www.amarulasolutions.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#10 lore raw

PATCH v3 3/3 board/canaan/k210-soc: use tinyinit as Linux init process

In reply to Dario Binacchi

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.

---

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
.checkpackageignore +0 -1
index 81e48bf85909..e1ba013fcbc5 100644
@@ -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
board/canaan/k210-soc/rootfs_overlay/init deleted +0 -1
deleted file mode 120000
index a0b71977c06f..000000000000
@@ -1 +0,0 @@
-/sbin/init
\ No newline at end of file
board/canaan/k210-soc/rootfs_overlay/sbin/init deleted +0 -41

41 lines not on this page · raw message

configs/canaan_kd233_defconfig +1 -1
index 832f8363a75c..dda42836ae1d 100644
@@ -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"
configs/sipeed_maix_bit_defconfig +1 -1
index 238e082a3d40..2bd203c45681 100644
@@ -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"
configs/sipeed_maix_bit_sdcard_defconfig +1 -1
index 28aa143583bd..fd5f19d5793a 100644
@@ -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"
configs/sipeed_maix_dock_defconfig +1 -1
index ee1b0d837284..0faa06b7dcb2 100644
@@ -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"
configs/sipeed_maix_dock_sdcard_defconfig +1 -1
index 41a062c7a179..379d228d4c7e 100644
@@ -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"
configs/sipeed_maix_go_defconfig +1 -1
index a5b09e17ac1c..33599c19f505 100644
@@ -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"
configs/sipeed_maix_go_sdcard_defconfig +1 -1
index 0e80d9c83ad8..1b03cf6165ad 100644
@@ -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"
configs/sipeed_maixduino_defconfig +1 -1
index 7ba7653e8d5f..0cdd16df3f87 100644
@@ -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"
configs/sipeed_maixduino_sdcard_defconfig +1 -1
index 7bdd36e1d09f..629205c5bc49 100644
@@ -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"
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#11 lore raw
In reply to Dario Binacchi

Hello Dario,

Quoted 4 lines · On Thu, 22 Aug 2024 20:37:39 +0200 Dario Binacchi…

Dario Binacchi (3):
package/tinyinit: new package configs/stm32f746_disco_sd: new defconfig board/canaan/k210-soc: use tinyinit as Linux init process

Thanks a lot. I was about to apply, but there are still a few things that bother me. I'll reply to the individual patches.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot