Skip to contentSkip to conversation

Add support for extlinux.conf

PATCH Superseded Alexander Shiyan 2 participants 11 messages Apr 28 – May 5 Documentation

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 Add support for extlinux.conf

This adds support for the extlinux.conf configuration format, commonly used by Syslinux and many Linux distributions. The configuration file is typically located at /boot/extlinux/extlinux.conf or /extlinux/extlinux.conf and defines boot entries with kernel, initrd, device tree, and command line options.

The implementation integrates with the existing boot entry framework:
- The extlinux scanner discovers entries on mounted filesystems.
- The default LABEL is turned into a boot entry.
- The "root=" parameter is stripped from the APPEND line only when
global.bootm.appendroot is set. This allows barebox to inject the
correct root device based on the actual boot device (e.g., when the
same rootfs image is used across different storage media).
- Bootm is used to load and start the kernel.
---
barebox@Diasom DS-RK3568-SOM-EVB:/ global.bootm.appendroot=true
barebox@Diasom DS-RK3568-SOM-EVB:/ global.boot.default=mmc1.2
barebox@Diasom DS-RK3568-SOM-EVB:/ boot
ext4 ext40: EXT2 rev 1, inode_size 256, descriptor size 64
Booting entry 'extlinux: linux'
extlinux: Booting extlinux label 'linux'
Adding "root=/dev/mmcblk1p3" to Kernel commandline
Loading ARM aarch64 Linux/EFI image '/mnt/mmc1.2/boot/extlinux/../vmlinuz'
commandline: root=/dev/mmcblk1p3 console=ttyS2,1500000n8 ro systemd.unit=setup.target quiet splash systemd.machine_id=181af2816b4c6b0aef77068e0ccc69ad Loaded kernel to 0x0a400000, devicetree at 0x000000000fb49000

---
 common/Kconfig    |  19 +++
 common/Makefile   |   1 +
 common/extlinux.c | 286 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 306 insertions(+)
 create mode 100644 common/extlinux.c
common/Kconfig +19 -0
index fd422714d5..0e93686e4f 100644
@@ -734,6 +734,25 @@ config BLSPEC
 	  on a device and it allows the Operating System to install / update
 	  kernels.
 
+config EXTLINUX
+	bool
+	prompt "Support extlinux.conf"
+	depends on FLEXIBLE_BOOTARGS
+	depends on !SHELL_NONE
+	select BOOT
+	select BOOTM
+	select MMCBLKDEV_ROOTARG if MCI
+	help
+	  Enable this to let barebox parse extlinux.conf configuration files,
+	  commonly used by the Syslinux bootloader and many Linux distributions
+	  (e.g., on SD cards or USB drives).
+	  extlinux.conf is typically located at /boot/extlinux/extlinux.conf or
+	  /extlinux/extlinux.conf. It defines boot entries with kernel, initrd,
+	  device tree, and command line options.
+	  This option allows barebox to discover and boot operating systems
+	  that follow the extlinux configuration format, providing a simple
+	  and portable way to manage multiple boot options.
+
 config FLEXIBLE_BOOTARGS
 	bool
 	prompt "flexible Linux bootargs generation"
common/Makefile +1 -0
index 27c5dea168..cd929b2194 100644
@@ -9,6 +9,7 @@ obj-y				+= clock.o
 pbl-$(CONFIG_PBL_CLOCKSOURCE)	+= clock.o
 obj-y				+= console_common.o
 obj-$(CONFIG_OFDEVICE)		+= deep-probe.o
+obj-$(CONFIG_EXTLINUX)		+= extlinux.o
 obj-y				+= startup.o
 obj-y				+= misc.o
 obj-pbl-y			+= memsize.o
common/extlinux.c new file +286 -0

286 lines not on this page · raw message

Signature · 1 line
2.52.0
#1 lore raw

PATCH v2 2/2 Documentation: add extlinux.conf support description

---
 Documentation/user/booting-linux.rst | 42 ++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
Documentation/user/booting-linux.rst +42 -0
index 3972777f30..a192efd453 100644
@@ -309,6 +309,48 @@ Additional notes about keys in the bootloader spec entries:
    different devices without having to specify a different ``root=`` option each
    time.
 
+.. _extlinux_conf:
+
+extlinux.conf Support
+^^^^^^^^^^^^^^^^^^^^^
+
+In addition to the Boot Loader Specification, barebox also supports the
+extlinux configuration format, commonly used by the Syslinux bootloader and
+many Linux distributions. This format is often found on SD cards, USB drives,
+or disk partitions prepared with tools like ``extlinux --install``.
+
+The configuration file is named ``extlinux.conf`` and can be located at:
+* ``/boot/extlinux/extlinux.conf``
+* ``/extlinux/extlinux.conf``
+
+The file uses a simple key-value syntax with sections labeled by ``LABEL``.
+A typical example looks like:
+
+.. code-block:: none
+
+  DEFAULT linux
+  LABEL linux
+    KERNEL /boot/vmlinuz
+    INITRD /boot/initrd.img
+    FDT /boot/board.dtb
+    APPEND console=ttyS0,115200 root=PARTUUID=deadbeef-01
+
+When booting an extlinux entry, barebox strips any ``root=`` parameter from the
+``APPEND`` line **only if** the global variable ``global.bootm.appendroot`` is
+set to true. After stripping, barebox injects the correct ``root=`` based on
+the boot device (similar to the ``linux-appendroot`` feature in blspec). This
+makes the same root filesystem image usable across different storage media.
+
+To use extlinux support, enable ``CONFIG_EXTLINUX`` in your barebox
+configuration. Entries are automatically discovered by the :ref:`command_boot`
+command when scanning a device or mount point. For example:
+
+.. code-block:: sh
+
+  global.bootm.appendroot=true
+  global.boot.default=mmc1.2
+  boot
+
 .. _booting_linux_net:
 
 Network boot
Signature · 1 line
2.52.0
#2 lore raw
In reply to Alexander Shiyan

Hello Alexander,

Quoted 29 lines · Alexander Shiyan
common/extlinux.c new file +29 -0
+static int extlinux_boot(struct bootentry *be, int verbose, int dryrun)
+{
+	struct extlinux_entry *e =
+		container_of(be, struct extlinux_entry, entry);
+	char *kernel_abs, *initrd_abs = NULL, *fdt_abs = NULL;
+	struct bootm_data data = {};
+	int ret;
+
+	bootm_data_init_defaults(&data);
+
+	data.dryrun = max_t(int, dryrun, data.dryrun);
+	data.verbose = max(verbose, data.verbose);
+
+	kernel_abs = basprintf("%s/%s", e->rootpath, e->kernel);
+	data.os_file = kernel_abs;
+
+	if (e->initrd) {
+		initrd_abs = basprintf("%s/%s", e->rootpath, e->initrd);
+		data.initrd_file = initrd_abs;
+	}
+
+	if (e->fdt) {
+		char *fdtdir = e->fdtdir ? : e->rootpath;
+
+		fdt_abs = basprintf("%s/%s", fdtdir, e->fdt);
+		data.oftree_file = fdt_abs;
+	}
+
+	if (e->append) {

common/extlinux.c line 95

Quoted 10 lines
common/extlinux.c new file +10 -0
+		char *append;
+
+		/*
+		 * The same rootfs image may be launched from eMMC or SD card.
+		 * Remove any hardcoded root= parameter from "append" to avoid
+		 * conflicts, then let barebox automatically add the correct
+		 * root= (via global.bootm.appendroot) based on the boot device.
+		 */
+		if (data.appendroot)
+			append = remove_param(e->append, "ROOT=");

Why use the upper case form here? Does the kernel even support uppercase ROOT=? I suspect not, in which case we can replace the case-insensitive comparison with a regular one.

I thought about this a bit and I still see multiple issues:

- Even in absence of root=, an initramfs can decide its own root anyway
- Giving this extra meaning to bootm.appendroot will make extlinux.conf behave differently to blspec
- The extlinux.conf files are not necessarily within a rootfs to begin with (maybe it's partition with just boot/kernel images)
- Other kernel options that are related to the rootfs aren't touched by this

I am not sure these can be resolved properly.

I thus have a question to you: What happens if you drop remove_param() completely? Sure we will have two root=, but the later gets precedence, so your use case would continue to work without giving users a wrong expectation.

I just Cc'd you on [1] which ensures appendroot is later than whatever is added by blspec or extlinux.conf.

[1]:
https://lore.barebox.org/barebox/[email protected]/T/#u

common/extlinux.c line 99

Quoted 4 lines
common/extlinux.c new file +4 -0
+		else
+			append = xstrdup(e->append);
+
+		globalvar_add_simple("linux.bootargs.dyn.extlinux", append);

Please rename to linux.bootargs.dyn.bootentries like blspec.

These kernel parameters are assembled in alphabetical order and have the same name both here and in blspec will make interaction with other parameters less surprising.

common/extlinux.c line 106

Quoted 1 line
common/extlinux.c new file +1 -0
+	ret = bootm_boot(&data);

As mentioned for v1, this should be bootm_entry(), not bootm_boot().

common/extlinux.c line 108

Quoted 2 lines
common/extlinux.c new file +2 -0
+	if (ret)
+		pr_err("bootm failed: %s\n", strerror(-ret));

... %pe\n", ERR_PTR(ret));

Cheers,
Ahmad

Signature · 4 lines
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |
#3 lore raw

Hello Ahmad.

...

Quoted 11 lines
Quoted 11 lines
common/extlinux.c new file +11 -0
+     if (e->append) {
+             char *append;
+
+             /*
+              * The same rootfs image may be launched from eMMC or SD card.
+              * Remove any hardcoded root= parameter from "append" to avoid
+              * conflicts, then let barebox automatically add the correct
+              * root= (via global.bootm.appendroot) based on the boot device.
+              */
+             if (data.appendroot)
+                     append = remove_param(e->append, "ROOT=");

...

Quoted 4 lines

I thus have a question to you: What happens if you drop remove_param() completely? Sure we will have two root=, but the later gets precedence, so your use case would continue to work without giving users a wrong expectation.

Yes, the second one takes priority.
The second one is the one added via extlinux.conf APPEND option. In our case we need the first parameter, i.e. which comes from barebox when global.bootm.appendroot is toggled on.

Thanks!

#4 lore raw

Hello Alexander,

Quoted 20 lines · Alexander Shiyan

Hello Ahmad.

...

Quoted 11 lines
Quoted 11 lines
common/extlinux.c new file +11 -0
+     if (e->append) {
+             char *append;
+
+             /*
+              * The same rootfs image may be launched from eMMC or SD card.
+              * Remove any hardcoded root= parameter from "append" to avoid
+              * conflicts, then let barebox automatically add the correct
+              * root= (via global.bootm.appendroot) based on the boot device.
+              */
+             if (data.appendroot)
+                     append = remove_param(e->append, "ROOT=");

...

Quoted 4 lines

I thus have a question to you: What happens if you drop remove_param() completely? Sure we will have two root=, but the later gets precedence, so your use case would continue to work without giving users a wrong expectation.

Quoted 4 lines

Yes, the second one takes priority.
The second one is the one added via extlinux.conf APPEND option. In our case we need the first parameter, i.e. which comes from barebox when global.bootm.appendroot is toggled on.

Ack. Please check the series I Cc'd you on, which ensures that global.bootm.appendroot applies _after_ extlinux.conf APPEND.

Thanks,
Ahmad

Quoted 3 lines

Thanks!

Signature · 4 lines
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |
#5 lore raw

Hello Ahmad.

barebox@Diasom DS-RK3568-SOM-EVB:/ global
* allow_color: 1
arch: arm64
autoboot: countdown (values: "countdown", "abort", "halt", "menu", "boot")
autoboot_abort_key: <NULL>
* autoboot_timeout: 2
* boot.default: default
boot.watchdog_timeout: 0
bootm.appendroot: 0
bootm.dryrun: 0
bootm.earlycon: 0
bootm.image:
bootm.image.loadaddr:
bootm.initrd:
bootm.initrd.loadaddr:
bootm.oftree:
bootm.provide_hostname: 0
* bootm.provide_machine_id: 1
bootm.root_dev:
bootm.root_param: root
bootm.tee:
bootm.verbose: 0
bootm.verify: available (values: "none", "hash", "signature", "available")
* bootm.~appendroot: true
console.ctrlc_allowed: 1
dhcp.bootfile:
dhcp.client_id:
dhcp.client_uuid:
dhcp.hostname:
dhcp.oftree_file:
dhcp.option224:
dhcp.retries: 20
dhcp.rootpath:
dhcp.tftp_server_name:
dhcp.user_class:
dhcp.vendor_id: barebox
endianness: little
env.autoprobe: 1
fastboot.bbu: 0
fastboot.max_download_size: 134217728
fastboot.partitions:
firmware.path: /env/firmware
hostname: diasom
linux.bootargs.base:
linux.bootargs.console: console=ttyS2,1500000n8 linux.bootargs_append: 0
linux.rootnfsopts: v3,tcp
log_max_messages: 32768
loglevel: 7
machine_id: 181af2816b4c6b0aef77068e0ccc69ad
model: Diasom DS-RK3568-SOM-EVB
net.domainname:
net.fetchdir: /mnt/tftp
net.gateway: 0.0.0.0
net.ifup_force_detect: 0
net.nameserver: 0.0.0.0
net.server:
nfs.port: 0
of.kernel.add_machine_compatible:
of.overlay.compatible:
of.overlay.filter: pattern compatible
of.overlay.path:
of.overlay.pattern: *
of_partition_binding: adaptive (values: "new", "legacy",
"donttouch", "adaptive")
partitions.first_usable_lba: 16384
system.partitions:
system.reset: unknown (values: "unknown", "POR", "RST", "WDG",
"WKE", "JTAG", "THERM", "EXT", "BROWNOUT")
system.reset_instance: 0
tftp.windowsize: 1
usbgadget.acm: 0
usbgadget.dfu_function:
* user: none
version: 2026.04.0-00765-gd3f78fc00c40-dirty
barebox@Diasom DS-RK3568-SOM-EVB:/ global.boot.default=mmc1.2 barebox@Diasom DS-RK3568-SOM-EVB:/ boot -d
ext4 ext40: EXT2 rev 1, inode_size 256, descriptor size 64 Booting entry 'extlinux: linux'
extlinux: Booting extlinux label 'linux'

Loading ARM aarch64 Linux/EFI image '/mnt/mmc1.2/boot/extlinux/../vmlinuz' Camera IMX662 detected.
commandline: console=ttyS2,1500000n8 systemd.machine_id=181af2816b4c6b0aef77068e0ccc69ad root=LABEL=ROOT ro systemd.unit=setup.target quiet splash
Loaded kernel to 0x0a400000, devicetree at 0x000000000fb49000 Dryrun. Aborted

bootm.~appendroot: true, but now is ever not added to the cmdline.

вт, 5 мая 2026 г. в 13:49, Ahmad Fatoum <[email protected]>:

Quoted 45 lines

Hello Alexander,

Quoted 20 lines · Alexander Shiyan

Hello Ahmad.

...

Quoted 11 lines
Quoted 11 lines
common/extlinux.c new file +11 -0
+     if (e->append) {
+             char *append;
+
+             /*
+              * The same rootfs image may be launched from eMMC or SD card.
+              * Remove any hardcoded root= parameter from "append" to avoid
+              * conflicts, then let barebox automatically add the correct
+              * root= (via global.bootm.appendroot) based on the boot device.
+              */
+             if (data.appendroot)
+                     append = remove_param(e->append, "ROOT=");

...

Quoted 4 lines

I thus have a question to you: What happens if you drop remove_param() completely? Sure we will have two root=, but the later gets precedence, so your use case would continue to work without giving users a wrong expectation.

Quoted 4 lines

Yes, the second one takes priority.
The second one is the one added via extlinux.conf APPEND option. In our case we need the first parameter, i.e. which comes from barebox when global.bootm.appendroot is toggled on.

Ack. Please check the series I Cc'd you on, which ensures that global.bootm.appendroot applies _after_ extlinux.conf APPEND.

Thanks,
Ahmad

Quoted 3 lines

Thanks!

--

Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |
#6 lore raw

Hello Alexander,

Quoted 2 lines · Alexander Shiyan

barebox@Diasom DS-RK3568-SOM-EVB:/ global
* bootm.~appendroot: true

This should be bootm.appendroot: 1.

Quoted 1 line

bootm.~appendroot: true, but now is ever not added to the cmdline.

The tilde is just an implementation detail in common/bootm.c. You should just global.bootm.appendroot as before.

Thanks,
Ahmad

Quoted 48 lines

вт, 5 мая 2026 г. в 13:49, Ahmad Fatoum <[email protected]>:

Quoted 45 lines

Hello Alexander,

Quoted 20 lines · Alexander Shiyan

Hello Ahmad.

...

Quoted 11 lines
Quoted 11 lines
common/extlinux.c new file +11 -0
+     if (e->append) {
+             char *append;
+
+             /*
+              * The same rootfs image may be launched from eMMC or SD card.
+              * Remove any hardcoded root= parameter from "append" to avoid
+              * conflicts, then let barebox automatically add the correct
+              * root= (via global.bootm.appendroot) based on the boot device.
+              */
+             if (data.appendroot)
+                     append = remove_param(e->append, "ROOT=");

...

Quoted 4 lines

I thus have a question to you: What happens if you drop remove_param() completely? Sure we will have two root=, but the later gets precedence, so your use case would continue to work without giving users a wrong expectation.

Quoted 4 lines

Yes, the second one takes priority.
The second one is the one added via extlinux.conf APPEND option. In our case we need the first parameter, i.e. which comes from barebox when global.bootm.appendroot is toggled on.

Ack. Please check the series I Cc'd you on, which ensures that global.bootm.appendroot applies _after_ extlinux.conf APPEND.

Thanks,
Ahmad

Quoted 3 lines

Thanks!

--

Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |
Signature · 4 lines
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |
#7 lore raw

barebox@Diasom DS-RK3568-SOM-EVB:/ global
* allow_color: 1
arch: arm64
autoboot: countdown (values: "countdown", "abort", "halt", "menu", "boot")
autoboot_abort_key: <NULL>
* autoboot_timeout: 2
* boot.default: default
boot.watchdog_timeout: 0
* bootm.appendroot: 1
bootm.dryrun: 0
bootm.earlycon: 0
bootm.image:
bootm.image.loadaddr:
bootm.initrd:
bootm.initrd.loadaddr:
bootm.oftree:
bootm.provide_hostname: 0
* bootm.provide_machine_id: 1
bootm.root_dev:
bootm.root_param: root
bootm.tee:
bootm.verbose: 0
bootm.verify: available (values: "none", "hash", "signature", "available") console.ctrlc_allowed: 1
dhcp.bootfile:
dhcp.client_id:
dhcp.client_uuid:
dhcp.hostname:
dhcp.oftree_file:
dhcp.option224:
dhcp.retries: 20
dhcp.rootpath:
dhcp.tftp_server_name:
dhcp.user_class:
dhcp.vendor_id: barebox
endianness: little
env.autoprobe: 1
fastboot.bbu: 0
fastboot.max_download_size: 134217728
fastboot.partitions:
firmware.path: /env/firmware
hostname: diasom
linux.bootargs.base:
linux.bootargs.console: console=ttyS2,1500000n8 linux.bootargs_append: 0
linux.rootnfsopts: v3,tcp
log_max_messages: 32768
loglevel: 7
machine_id: 181af2816b4c6b0aef77068e0ccc69ad
model: Diasom DS-RK3568-SOM-EVB
net.domainname:
net.fetchdir: /mnt/tftp
net.gateway: 0.0.0.0
net.ifup_force_detect: 0
net.nameserver: 0.0.0.0
net.server:
nfs.port: 0
of.kernel.add_machine_compatible:
of.overlay.compatible:
of.overlay.filter: pattern compatible
of.overlay.path:
of.overlay.pattern: *
of_partition_binding: adaptive (values: "new", "legacy",
"donttouch", "adaptive")
partitions.first_usable_lba: 16384
system.partitions:
system.reset: unknown (values: "unknown", "POR", "RST", "WDG",
"WKE", "JTAG", "THERM", "EXT", "BROWNOUT")
system.reset_instance: 0
tftp.windowsize: 1
usbgadget.acm: 0
usbgadget.dfu_function:
* user: none
version: 2026.04.0-00765-gd3f78fc00c40-dirty
barebox@Diasom DS-RK3568-SOM-EVB:/ global.boot.default=mmc1.2 barebox@Diasom DS-RK3568-SOM-EVB:/ boot
ext4 ext40: EXT2 rev 1, inode_size 256, descriptor size 64 Booting entry 'extlinux: linux'
extlinux: Booting extlinux label 'linux'
Adding "root=/dev/mmcblk1p3" to Kernel commandline

Loading ARM aarch64 Linux/EFI image '/mnt/mmc1.2/boot/extlinux/../vmlinuz' Camera IMX662 detected.
commandline: console=ttyS2,1500000n8 root=LABEL=ROOT ro systemd.unit=setup.target quiet splash root=/dev/mmcblk1p3 systemd.machine_id=181af2816b4c6b0aef77068e0ccc69ad
Loaded kernel to 0x0a400000, devicetree at 0x000000000fb49000 nv variables modified, saving them
I/TC: Secondary CPU 1 initializing
I/TC: Secondary CPU 1 switching to normal world boot
I/TC: Secondary CPU 2 initializing
I/TC: Secondary CPU 2 switching to normal world boot
I/TC: Secondary CPU 3 initializing
I/TC: Secondary CPU 3 switching to normal world boot

Now it works!

вт, 5 мая 2026 г. в 15:22, Ahmad Fatoum <[email protected]>:

Quoted 72 lines

Hello Alexander,

Quoted 2 lines · Alexander Shiyan

barebox@Diasom DS-RK3568-SOM-EVB:/ global
* bootm.~appendroot: true

This should be bootm.appendroot: 1.

Quoted 1 line

bootm.~appendroot: true, but now is ever not added to the cmdline.

The tilde is just an implementation detail in common/bootm.c. You should just global.bootm.appendroot as before.

Thanks,
Ahmad

Quoted 48 lines

вт, 5 мая 2026 г. в 13:49, Ahmad Fatoum <[email protected]>:

Quoted 45 lines

Hello Alexander,

Quoted 20 lines · Alexander Shiyan

Hello Ahmad.

...

Quoted 11 lines
Quoted 11 lines
common/extlinux.c new file +11 -0
+     if (e->append) {
+             char *append;
+
+             /*
+              * The same rootfs image may be launched from eMMC or SD card.
+              * Remove any hardcoded root= parameter from "append" to avoid
+              * conflicts, then let barebox automatically add the correct
+              * root= (via global.bootm.appendroot) based on the boot device.
+              */
+             if (data.appendroot)
+                     append = remove_param(e->append, "ROOT=");

...

Quoted 4 lines

I thus have a question to you: What happens if you drop remove_param() completely? Sure we will have two root=, but the later gets precedence, so your use case would continue to work without giving users a wrong expectation.

Quoted 4 lines

Yes, the second one takes priority.
The second one is the one added via extlinux.conf APPEND option. In our case we need the first parameter, i.e. which comes from barebox when global.bootm.appendroot is toggled on.

Ack. Please check the series I Cc'd you on, which ensures that global.bootm.appendroot applies _after_ extlinux.conf APPEND.

Thanks,
Ahmad

Quoted 3 lines

Thanks!

--

Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |

--

Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |
#8 lore raw

Hi,

Quoted 16 lines · Alexander Shiyan

barebox@Diasom DS-RK3568-SOM-EVB:/ global

Loading ARM aarch64 Linux/EFI image '/mnt/mmc1.2/boot/extlinux/../vmlinuz' Camera IMX662 detected.
commandline: console=ttyS2,1500000n8 root=LABEL=ROOT ro systemd.unit=setup.target quiet splash root=/dev/mmcblk1p3 systemd.machine_id=181af2816b4c6b0aef77068e0ccc69ad
Loaded kernel to 0x0a400000, devicetree at 0x000000000fb49000 nv variables modified, saving them
I/TC: Secondary CPU 1 initializing
I/TC: Secondary CPU 1 switching to normal world boot
I/TC: Secondary CPU 2 initializing
I/TC: Secondary CPU 2 switching to normal world boot
I/TC: Secondary CPU 3 initializing
I/TC: Secondary CPU 3 switching to normal world boot

Quoted 1 line

Now it works!

Great. I think with the rest of my feedback integrated, the v3 should be good to go.

Thanks,
Ahmad

Quoted 75 lines

вт, 5 мая 2026 г. в 15:22, Ahmad Fatoum <[email protected]>:

Quoted 72 lines

Hello Alexander,

Quoted 2 lines · Alexander Shiyan

barebox@Diasom DS-RK3568-SOM-EVB:/ global
* bootm.~appendroot: true

This should be bootm.appendroot: 1.

Quoted 1 line

bootm.~appendroot: true, but now is ever not added to the cmdline.

The tilde is just an implementation detail in common/bootm.c. You should just global.bootm.appendroot as before.

Thanks,
Ahmad

Quoted 48 lines

вт, 5 мая 2026 г. в 13:49, Ahmad Fatoum <[email protected]>:

Quoted 45 lines

Hello Alexander,

Quoted 20 lines · Alexander Shiyan

Hello Ahmad.

...

Quoted 11 lines
Quoted 11 lines
(quoted diff) +11 -0
+     if (e->append) {
+             char *append;
+
+             /*
+              * The same rootfs image may be launched from eMMC or SD card.
+              * Remove any hardcoded root= parameter from "append" to avoid
+              * conflicts, then let barebox automatically add the correct
+              * root= (via global.bootm.appendroot) based on the boot device.
+              */
+             if (data.appendroot)
+                     append = remove_param(e->append, "ROOT=");

...

Quoted 4 lines

I thus have a question to you: What happens if you drop remove_param() completely? Sure we will have two root=, but the later gets precedence, so your use case would continue to work without giving users a wrong expectation.

Quoted 4 lines

Yes, the second one takes priority.
The second one is the one added via extlinux.conf APPEND option. In our case we need the first parameter, i.e. which comes from barebox when global.bootm.appendroot is toggled on.

Ack. Please check the series I Cc'd you on, which ensures that global.bootm.appendroot applies _after_ extlinux.conf APPEND.

Thanks,
Ahmad

Quoted 3 lines

Thanks!

--

Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |

--

Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |
Signature · 4 lines
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |
#9 lore raw

There is another question: is it necessary to call globalvar_remove("linux.bootargs.dyn.bootentries")
in extlinux_entry_free()?
We can run bootm multiple times in dry-run mode, and the variable may become invalid...

вт, 5 мая 2026 г. в 15:52, Ahmad Fatoum <[email protected]>:

Quoted 110 lines

Hi,

Quoted 16 lines · Alexander Shiyan

barebox@Diasom DS-RK3568-SOM-EVB:/ global

Loading ARM aarch64 Linux/EFI image '/mnt/mmc1.2/boot/extlinux/../vmlinuz' Camera IMX662 detected.
commandline: console=ttyS2,1500000n8 root=LABEL=ROOT ro systemd.unit=setup.target quiet splash root=/dev/mmcblk1p3 systemd.machine_id=181af2816b4c6b0aef77068e0ccc69ad
Loaded kernel to 0x0a400000, devicetree at 0x000000000fb49000 nv variables modified, saving them
I/TC: Secondary CPU 1 initializing
I/TC: Secondary CPU 1 switching to normal world boot
I/TC: Secondary CPU 2 initializing
I/TC: Secondary CPU 2 switching to normal world boot
I/TC: Secondary CPU 3 initializing
I/TC: Secondary CPU 3 switching to normal world boot

Quoted 1 line

Now it works!

Great. I think with the rest of my feedback integrated, the v3 should be good to go.

Thanks,
Ahmad

Quoted 75 lines

вт, 5 мая 2026 г. в 15:22, Ahmad Fatoum <[email protected]>:

Quoted 72 lines

Hello Alexander,

Quoted 2 lines · Alexander Shiyan

barebox@Diasom DS-RK3568-SOM-EVB:/ global
* bootm.~appendroot: true

This should be bootm.appendroot: 1.

Quoted 1 line

bootm.~appendroot: true, but now is ever not added to the cmdline.

The tilde is just an implementation detail in common/bootm.c. You should just global.bootm.appendroot as before.

Thanks,
Ahmad

Quoted 48 lines

вт, 5 мая 2026 г. в 13:49, Ahmad Fatoum <[email protected]>:

Quoted 45 lines

Hello Alexander,

Quoted 20 lines · Alexander Shiyan

Hello Ahmad.

...

Quoted 11 lines
Quoted 11 lines
(quoted diff) +11 -0
+     if (e->append) {
+             char *append;
+
+             /*
+              * The same rootfs image may be launched from eMMC or SD card.
+              * Remove any hardcoded root= parameter from "append" to avoid
+              * conflicts, then let barebox automatically add the correct
+              * root= (via global.bootm.appendroot) based on the boot device.
+              */
+             if (data.appendroot)
+                     append = remove_param(e->append, "ROOT=");

...

Quoted 4 lines

I thus have a question to you: What happens if you drop remove_param() completely? Sure we will have two root=, but the later gets precedence, so your use case would continue to work without giving users a wrong expectation.

Quoted 4 lines

Yes, the second one takes priority.
The second one is the one added via extlinux.conf APPEND option. In our case we need the first parameter, i.e. which comes from barebox when global.bootm.appendroot is toggled on.

Ack. Please check the series I Cc'd you on, which ensures that global.bootm.appendroot applies _after_ extlinux.conf APPEND.

Thanks,
Ahmad

Quoted 3 lines

Thanks!

--

Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |

--

Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |

--

Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |
#10 lore raw

Hello Alexander,

Quoted 5 lines · Alexander Shiyan

There is another question: is it necessary to call globalvar_remove("linux.bootargs.dyn.bootentries")
in extlinux_entry_free()?
We can run bootm multiple times in dry-run mode, and the variable may become invalid...

The boot_entry() function takes care to set all global.linux.bootargs.dyn.* variables to the empty string:

	globalvar_set_match("linux.bootargs.dyn.", "");

So you should not need to explicitly remove it.

Cheers,
Ahmad

Quoted 113 lines

вт, 5 мая 2026 г. в 15:52, Ahmad Fatoum <[email protected]>:

Quoted 110 lines

Hi,

Quoted 16 lines · Alexander Shiyan

barebox@Diasom DS-RK3568-SOM-EVB:/ global

Loading ARM aarch64 Linux/EFI image '/mnt/mmc1.2/boot/extlinux/../vmlinuz' Camera IMX662 detected.
commandline: console=ttyS2,1500000n8 root=LABEL=ROOT ro systemd.unit=setup.target quiet splash root=/dev/mmcblk1p3 systemd.machine_id=181af2816b4c6b0aef77068e0ccc69ad
Loaded kernel to 0x0a400000, devicetree at 0x000000000fb49000 nv variables modified, saving them
I/TC: Secondary CPU 1 initializing
I/TC: Secondary CPU 1 switching to normal world boot
I/TC: Secondary CPU 2 initializing
I/TC: Secondary CPU 2 switching to normal world boot
I/TC: Secondary CPU 3 initializing
I/TC: Secondary CPU 3 switching to normal world boot

Quoted 1 line

Now it works!

Great. I think with the rest of my feedback integrated, the v3 should be good to go.

Thanks,
Ahmad

Quoted 75 lines

вт, 5 мая 2026 г. в 15:22, Ahmad Fatoum <[email protected]>:

Quoted 72 lines

Hello Alexander,

Quoted 2 lines · Alexander Shiyan

barebox@Diasom DS-RK3568-SOM-EVB:/ global
* bootm.~appendroot: true

This should be bootm.appendroot: 1.

Quoted 1 line

bootm.~appendroot: true, but now is ever not added to the cmdline.

The tilde is just an implementation detail in common/bootm.c. You should just global.bootm.appendroot as before.

Thanks,
Ahmad

Quoted 48 lines

вт, 5 мая 2026 г. в 13:49, Ahmad Fatoum <[email protected]>:

Quoted 45 lines

Hello Alexander,

Quoted 20 lines · Alexander Shiyan

Hello Ahmad.

...

Quoted 11 lines
Quoted 11 lines
(quoted diff) +11 -0
+     if (e->append) {
+             char *append;
+
+             /*
+              * The same rootfs image may be launched from eMMC or SD card.
+              * Remove any hardcoded root= parameter from "append" to avoid
+              * conflicts, then let barebox automatically add the correct
+              * root= (via global.bootm.appendroot) based on the boot device.
+              */
+             if (data.appendroot)
+                     append = remove_param(e->append, "ROOT=");

...

Quoted 4 lines

I thus have a question to you: What happens if you drop remove_param() completely? Sure we will have two root=, but the later gets precedence, so your use case would continue to work without giving users a wrong expectation.

Quoted 4 lines

Yes, the second one takes priority.
The second one is the one added via extlinux.conf APPEND option. In our case we need the first parameter, i.e. which comes from barebox when global.bootm.appendroot is toggled on.

Ack. Please check the series I Cc'd you on, which ensures that global.bootm.appendroot applies _after_ extlinux.conf APPEND.

Thanks,
Ahmad

Quoted 3 lines

Thanks!

--

Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |

--

Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |

--

Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |
Signature · 4 lines
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |