Skip to contentSkip to conversation

package/rpi-firmware: add configurable kernel cmdline option

PATCH New Ivo Slanina 4 participants 5 messages Aug 9, 2015 – Aug 10, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/rpi-firmware: add configurable kernel cmdline option

Raspberry Pi expects cmdline.txt file at boot partition, which defines kernel parameters. Buildroot stores this file in package/rpi-firmware directory and makes this configuration quite unconfortable. Basicaly user have to manually edit output/images/rpi-firmware/cmdline.txt for every build.

This patch adds option to specify content of cmdline.txt and store it in configuration file. This approach removes need to manually modify this file for every build and adds posibility to store its value in configuration file per project.

---
 package/rpi-firmware/Config.in       | 6 ++++++
 package/rpi-firmware/cmdline.txt     | 1 -
 package/rpi-firmware/rpi-firmware.mk | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)
 delete mode 100644 package/rpi-firmware/cmdline.txt
package/rpi-firmware/Config.in +6 -0
index 405674f..978ecfd 100644
@@ -39,6 +39,12 @@ config BR2_PACKAGE_RPI_FIRMWARE_CD
 
 endchoice
 
+config BR2_PACKAGE_RPI_FIRMWARE_CMDLINE
+	string "Kernel cmdline"
+	default "root=/dev/mmcblk0p2 rootwait"
+	help
+	  Set this value to customize cmdline.txt file at boot partition.
+
 config BR2_PACKAGE_RPI_FIRMWARE_BOOT
 	string
 	default ""      if BR2_PACKAGE_RPI_FIRMWARE_DEFAULT
package/rpi-firmware/cmdline.txt deleted +0 -1
deleted file mode 100644
index 38aa378..0000000
@@ -1 +0,0 @@
-root=/dev/mmcblk0p2 rootwait
package/rpi-firmware/rpi-firmware.mk +1 -1
index 1ef15aa..9d22a69 100644
@@ -41,7 +41,7 @@ define RPI_FIRMWARE_INSTALL_IMAGES_CMDS
 	$(INSTALL) -D -m 0644 $(@D)/boot/start$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).elf $(BINARIES_DIR)/rpi-firmware/start.elf
 	$(INSTALL) -D -m 0644 $(@D)/boot/fixup$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).dat $(BINARIES_DIR)/rpi-firmware/fixup.dat
 	$(INSTALL) -D -m 0644 package/rpi-firmware/config.txt $(BINARIES_DIR)/rpi-firmware/config.txt
-	$(INSTALL) -D -m 0644 package/rpi-firmware/cmdline.txt $(BINARIES_DIR)/rpi-firmware/cmdline.txt
+	echo $(BR2_PACKAGE_RPI_FIRMWARE_CMDLINE) > $(BINARIES_DIR)/rpi-firmware/cmdline.txt
 	$(RPI_FIRMWARE_INSTALL_DTB)
 	$(RPI_FIRMWARE_INSTALL_DTB_OVERLAYS)
 endef
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 package/rpi-firmware: add configurable kernel cmdline option

Ivo, All,

On 2015-08-09 17:47 +0200, Ivo Slanina spake thusly:

Quoted 6 lines

Raspberry Pi expects cmdline.txt file at boot partition, which defines kernel parameters. Buildroot stores this file in package/rpi-firmware directory and makes this configuration quite unconfortable. Basicaly user have to manually edit output/images/rpi-firmware/cmdline.txt for every build.

Quoted 6 lines

This patch adds option to specify content of cmdline.txt and store it in configuration file. This approach removes need to manually modify this file for every build and adds posibility to store its value in configuration file per project.

No. Such tweaking should be left for a post-build script.

And *if* we were to have a mean to set the kernel command line in Buildroot, it should not be specific to the RPi. It should be a generic solution, that could be used for all bootloaders. I.e. an entry in the kernel menu.

But I'm not really a fan of this; post-build scripts have been introduced just for this kind of local customisation. Others may disagree, though...

Regards,
Yann E. MORIN.

Quoted 51 lines
---
 package/rpi-firmware/Config.in       | 6 ++++++
 package/rpi-firmware/cmdline.txt     | 1 -
 package/rpi-firmware/rpi-firmware.mk | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)
 delete mode 100644 package/rpi-firmware/cmdline.txt
package/rpi-firmware/Config.in +6 -0
index 405674f..978ecfd 100644
@@ -39,6 +39,12 @@ config BR2_PACKAGE_RPI_FIRMWARE_CD
 
 endchoice
 
+config BR2_PACKAGE_RPI_FIRMWARE_CMDLINE
+	string "Kernel cmdline"
+	default "root=/dev/mmcblk0p2 rootwait"
+	help
+	  Set this value to customize cmdline.txt file at boot partition.
+
 config BR2_PACKAGE_RPI_FIRMWARE_BOOT
 	string
 	default ""      if BR2_PACKAGE_RPI_FIRMWARE_DEFAULT
package/rpi-firmware/cmdline.txt deleted +0 -1
deleted file mode 100644
index 38aa378..0000000
@@ -1 +0,0 @@
-root=/dev/mmcblk0p2 rootwait
package/rpi-firmware/rpi-firmware.mk +1 -1
index 1ef15aa..9d22a69 100644
@@ -41,7 +41,7 @@ define RPI_FIRMWARE_INSTALL_IMAGES_CMDS
 	$(INSTALL) -D -m 0644 $(@D)/boot/start$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).elf $(BINARIES_DIR)/rpi-firmware/start.elf
 	$(INSTALL) -D -m 0644 $(@D)/boot/fixup$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).dat $(BINARIES_DIR)/rpi-firmware/fixup.dat
 	$(INSTALL) -D -m 0644 package/rpi-firmware/config.txt $(BINARIES_DIR)/rpi-firmware/config.txt
-	$(INSTALL) -D -m 0644 package/rpi-firmware/cmdline.txt $(BINARIES_DIR)/rpi-firmware/cmdline.txt
+	echo $(BR2_PACKAGE_RPI_FIRMWARE_CMDLINE) > $(BINARIES_DIR)/rpi-firmware/cmdline.txt
 	$(RPI_FIRMWARE_INSTALL_DTB)
 	$(RPI_FIRMWARE_INSTALL_DTB_OVERLAYS)
 endef
Signature · 6 lines
2.1.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 package/rpi-firmware: add configurable kernel cmdline option

Quoted 5 lines
Quoted 5 lines

This patch adds option to specify content of cmdline.txt and store it
in configuration file.

[...]

Quoted 3 lines

And *if* we were to have a mean to set the kernel command line in Buildroot, it should not be specific to the RPi. It should be a generic

Completely agreee on this part...

Quoted 8 lines

solution, that could be used for all bootloaders. I.e. an entry in the
kernel menu.

But I'm not really a fan of this; post-build scripts have been introduced just for this kind of local customisation. Others may disagree, though...

I kinda disagree here...

The problem is that the kernel commandline is partly built purely by buildroot (for instance console=) and partly by the user (depending on the architecture, the boot partition can be manually specified) so having a generic way to specify "add this strin at the end of the kernel command line when you save the commandline wherever this particular architecture needs it" would be handy

Of course it can always be done with with post-build script, but it can sometime be tricky when what you need is to modify a string in a variable place that is half-generated by buildroot.

so yes, it would be handy. Not a huge problem but still handy

Regards

J?r?my Rosen

Quoted 81 lines

Regards,
Yann E. MORIN.

Quoted 57 lines
---
 package/rpi-firmware/Config.in       | 6 ++++++
 package/rpi-firmware/cmdline.txt     | 1 -
 package/rpi-firmware/rpi-firmware.mk | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)
 delete mode 100644 package/rpi-firmware/cmdline.txt
package/rpi-firmware/Config.in +6 -0
index 405674f..978ecfd 100644
@@ -39,6 +39,12 @@ config BR2_PACKAGE_RPI_FIRMWARE_CD
 
 endchoice
 
+config BR2_PACKAGE_RPI_FIRMWARE_CMDLINE
+	string "Kernel cmdline"
+	default "root=/dev/mmcblk0p2 rootwait"
+	help
+	  Set this value to customize cmdline.txt file at boot partition.
+
 config BR2_PACKAGE_RPI_FIRMWARE_BOOT
 	string
 	default ""      if BR2_PACKAGE_RPI_FIRMWARE_DEFAULT
package/rpi-firmware/cmdline.txt deleted +0 -1
deleted file mode 100644
index 38aa378..0000000
@@ -1 +0,0 @@
-root=/dev/mmcblk0p2 rootwait
package/rpi-firmware/rpi-firmware.mk +0 -0
index 1ef15aa..9d22a69 100644
@@ -41,7 +41,7 @@ define RPI_FIRMWARE_INSTALL_IMAGES_CMDS
 	$(INSTALL) -D -m 0644
 	$(@D)/boot/start$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).elf
 	$(BINARIES_DIR)/rpi-firmware/start.elf
 	$(INSTALL) -D -m 0644
 	$(@D)/boot/fixup$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).dat
 	$(BINARIES_DIR)/rpi-firmware/fixup.dat
 	$(INSTALL) -D -m 0644 package/rpi-firmware/config.txt
package/rpi-firmware/rpi-firmware.mk +0 -1
 	$(BINARIES_DIR)/rpi-firmware/config.txt
-	$(INSTALL) -D -m 0644 package/rpi-firmware/cmdline.txt

$(BINARIES_DIR)/rpi-firmware/cmdline.txt

package/rpi-firmware/rpi-firmware.mk +1 -0
+	echo $(BR2_PACKAGE_RPI_FIRMWARE_CMDLINE) >

$(BINARIES_DIR)/rpi-firmware/cmdline.txt

package/rpi-firmware/rpi-firmware.mk +0 -1
 	$(RPI_FIRMWARE_INSTALL_DTB)
 	$(RPI_FIRMWARE_INSTALL_DTB_OVERLAYS)
 endef
--

2.1.4

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

--
.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics'
|  conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___
|               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/
|  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v
|   conspiracy.  |

'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#3 lore raw

PATCH 1/1 package/rpi-firmware: add configurable kernel cmdline option

Dear Jeremy Rosen,

Quoted 9 lines · Jeremy Rosen
Quoted 8 lines

solution, that could be used for all bootloaders. I.e. an entry in the
kernel menu.

But I'm not really a fan of this; post-build scripts have been introduced just for this kind of local customisation. Others may disagree, though...

Quoted 4 lines

I kinda disagree here...

The problem is that the kernel commandline is partly built purely by buildroot (for instance console=)

Not at all. Buildroot does not define console= anywhere. It uses the kernel console as the default tty for getty, but does not anything else beyond that: it's still up to the user to pass console= on the kernel command line.

Quoted 9 lines

and partly by the user (depending
on the architecture, the boot partition can be manually specified) so having a generic way to specify "add this strin at the end of the kernel command line when you save the commandline wherever this particular architecture needs it" would be handy

Of course it can always be done with with post-build script, but it can sometime be tricky when what you need is to modify a string in a variable place that is half-generated by buildroot.

Except that there is clearly not generic way to specify the kernel command line. Depending on the bootloader being used, the mechanism is completely different. Even with the same bootloader (e. U-Boot), there is typically a specific environment for each board/platform that builds the kernel command line at runtime from various other bootloader environment variables.

So just like Yann said: defining the kernel command line is way too hardware/project specific to be solved by Buildroot, and it is not something for which Buildroot would provide a lot of useful help anyway.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH 1/1 package/rpi-firmware: add configurable kernel cmdline option

In reply to Yann E. MORIN

Dear Yann E. MORIN,

Quoted 10 lines · Yann E. MORIN

No. Such tweaking should be left for a post-build script.

And *if* we were to have a mean to set the kernel command line in Buildroot, it should not be specific to the RPi. It should be a generic solution, that could be used for all bootloaders. I.e. an entry in the kernel menu.

But I'm not really a fan of this; post-build scripts have been introduced just for this kind of local customisation. Others may disagree, though...

Fully agreed.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com