diff mbox

[5/6] package/rpi-firmware: add options to select what firmware to install

Message ID 30f6d94a556efedb7d999a778bb6e32071efdda0.1370289131.git.yann.morin.1998@free.fr
State Deferred
Headers show

Commit Message

Yann E. MORIN June 3, 2013, 8:15 p.m. UTC
From: "Yann E. MORIN" <yann.morin.1998@free.fr>

Add two options to rpi-firmware:
  - the first option to select the firmware being booted, amongst:
    - the default one
    - the cut-down one, for emergency
  - the second to also install all firmwares

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 board/raspberrypi/readme.txt         |  8 -------
 package/rpi-firmware/Config.in       | 45 ++++++++++++++++++++++++++++++++++++
 package/rpi-firmware/rpi-firmware.mk | 20 ++++++++++++----
 3 files changed, 61 insertions(+), 12 deletions(-)

Comments

Peter Korsgaard June 4, 2013, 6:38 a.m. UTC | #1
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 Yann> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
 Yann> Add two options to rpi-firmware:
 Yann>   - the first option to select the firmware being booted, amongst:
 Yann>     - the default one
 Yann>     - the cut-down one, for emergency
 Yann>   - the second to also install all firmwares

 Yann> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
 Yann> ---
 Yann>  board/raspberrypi/readme.txt         |  8 -------
 Yann>  package/rpi-firmware/Config.in       | 45 ++++++++++++++++++++++++++++++++++++
 Yann>  package/rpi-firmware/rpi-firmware.mk | 20 ++++++++++++----
 Yann>  3 files changed, 61 insertions(+), 12 deletions(-)

 Yann> diff --git a/board/raspberrypi/readme.txt b/board/raspberrypi/readme.txt
 Yann> index 3287795..720a0ac 100644
 Yann> --- a/board/raspberrypi/readme.txt
 Yann> +++ b/board/raspberrypi/readme.txt
 Yann> @@ -34,9 +34,7 @@ After building, you should obtain this tree:
 Yann>      +-- rpi-firmware
 Yann>      |   +-- bootcode.bin
 Yann>      |   +-- config.txt
 Yann> -    |   +-- fixup_cd.dat
 Yann>      |   +-- fixup.dat
 Yann> -    |   +-- start_cd.elf
 Yann>      |   `-- start.elf
 Yann>      `-- zImage
 
 Yann> @@ -52,9 +50,7 @@ At the root of the partition, the RaspberryPi must find the following files:
 
 Yann>   * bootcode.bin
 Yann>   * config.txt
 Yann> - * fixup_cd.dat
 Yann>   * fixup.dat
 Yann> - * start_cd.elf
 Yann>   * start.elf
 Yann>   * zImage
 
 Yann> @@ -83,9 +79,7 @@ After building, you should obtain this tree:
 Yann>      +-- rpi-firmware
 Yann>      |   +-- bootcode.bin
 Yann>      |   +-- config.txt
 Yann> -    |   +-- fixup_cd.dat
 Yann>      |   +-- fixup.dat
 Yann> -    |   +-- start_cd.elf
 Yann>      |   `-- start.elf
 Yann>      `-- zImage
 
 Yann> @@ -104,9 +98,7 @@ You must copy theses files at the root of partition:
 
 Yann>   * bootcode.bin
 Yann>   * config.txt
 Yann> - * fixup_cd.dat
 Yann>   * fixup.dat
 Yann> - * start_cd.elf
 Yann>   * start.elf
 Yann>   * zImage
 
 Yann> diff --git a/package/rpi-firmware/Config.in b/package/rpi-firmware/Config.in
 Yann> index eb10a8a..4573204 100644
 Yann> --- a/package/rpi-firmware/Config.in
 Yann> +++ b/package/rpi-firmware/Config.in
 Yann> @@ -7,3 +7,48 @@ config BR2_PACKAGE_RPI_FIRMWARE
 
 Yann>  	  https://github.com/raspberrypi/firmware
 
 Yann> +if BR2_PACKAGE_RPI_FIRMWARE
 Yann> +
 Yann> +choice
 Yann> +	bool "Firmware to boot"
 Yann> +	default BR2_PACKAGE_RPI_FIRMWARE_DEFAULT
 Yann> +	help
 Yann> +	  There are two different firmware files:
 Yann> +	    - the default firmware, that enables standard GPU features;
 Yann> +	    - the cut-down firmware, for emergency situations, with only
 Yann> +	      features required to boot a Linux kernel.
 Yann> +
 Yann> +config BR2_PACKAGE_RPI_FIRMWARE_DEFAULT
 Yann> +	bool "default"
 Yann> +	help
 Yann> +	  The default firmware, that enables standard GPU features.
 Yann> +
 Yann> +config BR2_PACKAGE_RPI_FIRMWARE_CD
 Yann> +	bool "cut-down ('cd', emergency)"
 Yann> +	help
 Yann> +	  The cut-down firmware, for emergency situations, with only
 Yann> +	  features required to boot a Linux kernel.
 Yann> +
 Yann> +endchoice
 Yann> +
 Yann> +config BR2_PACKAGE_RPI_FIRMWARE_BOOT
 Yann> +	string
 Yann> +	default ""      if BR2_PACKAGE_RPI_FIRMWARE_DEFAULT
 Yann> +	default "_cd"   if BR2_PACKAGE_RPI_FIRMWARE_CD
 Yann> +
 Yann> +config BR2_PACKAGE_RPI_FIRMWARE_ALL
 Yann> +	bool "Install all firmwares"
 Yann> +	default y
 Yann> +	help

So this option overrides whatever you have selected above?

 Yann> +	  If you say 'y' here (the default), then all firmware files will
 Yann> +	  be installed, so you can later switch to an alternate firmware.
 Yann> +	  The firmware files will be installed thusly:
 Yann> +	    - the 'default'  will be denoted with '_default' in filenames

That seems different from above where the default version doesn't have
any suffix?

Do we really need this? Can't people just delete the files they don't
want in a post build script like for everything else?
Yann E. MORIN June 4, 2013, 6:55 a.m. UTC | #2
Peter, All,

On Tuesday 04 June 2013 08:38:47 Peter Korsgaard wrote:
> >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> 
>  Yann> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
>  Yann> Add two options to rpi-firmware:
>  Yann>   - the first option to select the firmware being booted, amongst:
>  Yann>     - the default one
>  Yann>     - the cut-down one, for emergency
>  Yann>   - the second to also install all firmwares
> 
>  Yann> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>  Yann> ---
>  Yann>  board/raspberrypi/readme.txt         |  8 -------
>  Yann>  package/rpi-firmware/Config.in       | 45 ++++++++++++++++++++++++++++++++++++
>  Yann>  package/rpi-firmware/rpi-firmware.mk | 20 ++++++++++++----
>  Yann>  3 files changed, 61 insertions(+), 12 deletions(-)
[--SNIP--]
>  Yann> +if BR2_PACKAGE_RPI_FIRMWARE
>  Yann> +
>  Yann> +choice
>  Yann> +	bool "Firmware to boot"
>  Yann> +	default BR2_PACKAGE_RPI_FIRMWARE_DEFAULT
>  Yann> +	help
>  Yann> +	  There are two different firmware files:
>  Yann> +	    - the default firmware, that enables standard GPU features;
>  Yann> +	    - the cut-down firmware, for emergency situations, with only
>  Yann> +	      features required to boot a Linux kernel.
>  Yann> +
>  Yann> +config BR2_PACKAGE_RPI_FIRMWARE_DEFAULT
>  Yann> +	bool "default"
>  Yann> +	help
>  Yann> +	  The default firmware, that enables standard GPU features.
>  Yann> +
>  Yann> +config BR2_PACKAGE_RPI_FIRMWARE_CD
>  Yann> +	bool "cut-down ('cd', emergency)"
>  Yann> +	help
>  Yann> +	  The cut-down firmware, for emergency situations, with only
>  Yann> +	  features required to boot a Linux kernel.
>  Yann> +
>  Yann> +endchoice
>  Yann> +
>  Yann> +config BR2_PACKAGE_RPI_FIRMWARE_BOOT
>  Yann> +	string
>  Yann> +	default ""      if BR2_PACKAGE_RPI_FIRMWARE_DEFAULT
>  Yann> +	default "_cd"   if BR2_PACKAGE_RPI_FIRMWARE_CD
>  Yann> +
>  Yann> +config BR2_PACKAGE_RPI_FIRMWARE_ALL
>  Yann> +	bool "Install all firmwares"
>  Yann> +	default y
>  Yann> +	help
> 
> So this option overrides whatever you have selected above?

No, the firmware files will be installed as:

    source file                                 | installed file
    ---- Installed by the choice: --------------+-------------------
    start$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).elf   | start.elf
    fixup$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).dat   | fixup.dat
    ---- Installed with "Install all": ---------+-------------------
    start.elf                                   | start_default.elf
    fixup.elf                                   | fixup_default.elf
    start_cd.elf                                | start_cd.elf
    fixup_cd.elf                                | fixup_cd.elf
    start_x.elf                                 | start_x.elf    [*]
    fixup._xelf                                 | fixup_x.elf    [*]

[*] After the bump with the following patch

>  Yann> +	  If you say 'y' here (the default), then all firmware files will
>  Yann> +	  be installed, so you can later switch to an alternate firmware.
>  Yann> +	  The firmware files will be installed thusly:
>  Yann> +	    - the 'default'  will be denoted with '_default' in filenames
> 
> That seems different from above where the default version doesn't have
> any suffix?

I guess the table above answers that.

> Do we really need this? Can't people just delete the files they don't
> want in a post build script like for everything else?

Yes, it is possible. But since a single firmware will ever be booted,
there is no reason to install all of them in the first place.

This last option is here for people that want to switch firmware at
/runtime/ (ie. with just a mv from within the target).

Of course, I'm fine with this not going in (but I'd be sad, as I'd
have to tweak my post-image scripts. ;-) ).

Regards,
Yann E. MORIN.
Yann E. MORIN June 6, 2013, 9:44 p.m. UTC | #3
Peter, All,

On 2013-06-04 08:55 +0200, Yann E. MORIN spake thusly:
> On Tuesday 04 June 2013 08:38:47 Peter Korsgaard wrote:
> > >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> > 
> >  Yann> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> >  Yann> Add two options to rpi-firmware:
> >  Yann>   - the first option to select the firmware being booted, amongst:
> >  Yann>     - the default one
> >  Yann>     - the cut-down one, for emergency
> >  Yann>   - the second to also install all firmwares
> >
[--SNIP--]
> > Do we really need this? Can't people just delete the files they don't
> > want in a post build script like for everything else?
> 
> Yes, it is possible. But since a single firmware will ever be booted,
> there is no reason to install all of them in the first place.
> 
> This last option is here for people that want to switch firmware at
> /runtime/ (ie. with just a mv from within the target).
> 
> Of course, I'm fine with this not going in (but I'd be sad, as I'd
> have to tweak my post-image scripts. ;-) ).

Should I drop this for good, or is there still the slightest chance this
can go in? ;-)

Regards,
Yann E. MORIN.
diff mbox

Patch

diff --git a/board/raspberrypi/readme.txt b/board/raspberrypi/readme.txt
index 3287795..720a0ac 100644
--- a/board/raspberrypi/readme.txt
+++ b/board/raspberrypi/readme.txt
@@ -34,9 +34,7 @@  After building, you should obtain this tree:
     +-- rpi-firmware
     |   +-- bootcode.bin
     |   +-- config.txt
-    |   +-- fixup_cd.dat
     |   +-- fixup.dat
-    |   +-- start_cd.elf
     |   `-- start.elf
     `-- zImage
 
@@ -52,9 +50,7 @@  At the root of the partition, the RaspberryPi must find the following files:
 
  * bootcode.bin
  * config.txt
- * fixup_cd.dat
  * fixup.dat
- * start_cd.elf
  * start.elf
  * zImage
 
@@ -83,9 +79,7 @@  After building, you should obtain this tree:
     +-- rpi-firmware
     |   +-- bootcode.bin
     |   +-- config.txt
-    |   +-- fixup_cd.dat
     |   +-- fixup.dat
-    |   +-- start_cd.elf
     |   `-- start.elf
     `-- zImage
 
@@ -104,9 +98,7 @@  You must copy theses files at the root of partition:
 
  * bootcode.bin
  * config.txt
- * fixup_cd.dat
  * fixup.dat
- * start_cd.elf
  * start.elf
  * zImage
 
diff --git a/package/rpi-firmware/Config.in b/package/rpi-firmware/Config.in
index eb10a8a..4573204 100644
--- a/package/rpi-firmware/Config.in
+++ b/package/rpi-firmware/Config.in
@@ -7,3 +7,48 @@  config BR2_PACKAGE_RPI_FIRMWARE
 
 	  https://github.com/raspberrypi/firmware
 
+if BR2_PACKAGE_RPI_FIRMWARE
+
+choice
+	bool "Firmware to boot"
+	default BR2_PACKAGE_RPI_FIRMWARE_DEFAULT
+	help
+	  There are two different firmware files:
+	    - the default firmware, that enables standard GPU features;
+	    - the cut-down firmware, for emergency situations, with only
+	      features required to boot a Linux kernel.
+
+config BR2_PACKAGE_RPI_FIRMWARE_DEFAULT
+	bool "default"
+	help
+	  The default firmware, that enables standard GPU features.
+
+config BR2_PACKAGE_RPI_FIRMWARE_CD
+	bool "cut-down ('cd', emergency)"
+	help
+	  The cut-down firmware, for emergency situations, with only
+	  features required to boot a Linux kernel.
+
+endchoice
+
+config BR2_PACKAGE_RPI_FIRMWARE_BOOT
+	string
+	default ""      if BR2_PACKAGE_RPI_FIRMWARE_DEFAULT
+	default "_cd"   if BR2_PACKAGE_RPI_FIRMWARE_CD
+
+config BR2_PACKAGE_RPI_FIRMWARE_ALL
+	bool "Install all firmwares"
+	default y
+	help
+	  If you say 'y' here (the default), then all firmware files will
+	  be installed, so you can later switch to an alternate firmware.
+	  The firmware files will be installed thusly:
+	    - the 'default'  will be denoted with '_default' in filenames
+	    - the 'cut-down' will be denoted with '_cd'      in filenames
+
+	  If you say 'n', then only the firmware you choose above will be
+	  installed.
+
+	  Unless you are sure about it, say 'y'.
+
+endif # BR2_PACKAGE_RPI_FIRMWARE
diff --git a/package/rpi-firmware/rpi-firmware.mk b/package/rpi-firmware/rpi-firmware.mk
index dcda6b0..ebcd753 100644
--- a/package/rpi-firmware/rpi-firmware.mk
+++ b/package/rpi-firmware/rpi-firmware.mk
@@ -9,13 +9,25 @@  RPI_FIRMWARE_SITE = http://github.com/raspberrypi/firmware/tarball/master
 RPI_FIRMWARE_LICENSE = BSD-3c
 RPI_FIRMWARE_LICENSE_FILES = boot/LICENCE.broadcom
 
-define RPI_FIRMWARE_INSTALL_TARGET_CMDS
+define RPI_FIRMWARE_INSTALL_TARGET_CMDS_BASE
 	$(INSTALL) -D -m 0644 $(@D)/boot/bootcode.bin $(BINARIES_DIR)/rpi-firmware/bootcode.bin
-	$(INSTALL) -D -m 0644 $(@D)/boot/start.elf $(BINARIES_DIR)/rpi-firmware/start.elf
+	$(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
+endef
+
+ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_ALL),y)
+define RPI_FIRMWARE_INSTALL_TARGET_CMDS_EXTRA
+	$(INSTALL) -D -m 0644 $(@D)/boot/start.elf $(BINARIES_DIR)/rpi-firmware/start_default.elf
 	$(INSTALL) -D -m 0644 $(@D)/boot/start_cd.elf $(BINARIES_DIR)/rpi-firmware/start_cd.elf
-	$(INSTALL) -D -m 0644 $(@D)/boot/fixup.dat $(BINARIES_DIR)/rpi-firmware/fixup.dat
+	$(INSTALL) -D -m 0644 $(@D)/boot/fixup.dat $(BINARIES_DIR)/rpi-firmware/fixup_default.dat
 	$(INSTALL) -D -m 0644 $(@D)/boot/fixup_cd.dat $(BINARIES_DIR)/rpi-firmware/fixup_cd.dat
-	$(INSTALL) -D -m 0644 package/rpi-firmware/config.txt $(BINARIES_DIR)/rpi-firmware/config.txt
+endef
+endif
+
+define RPI_FIRMWARE_INSTALL_TARGET_CMDS
+$(RPI_FIRMWARE_INSTALL_TARGET_CMDS_BASE)
+$(RPI_FIRMWARE_INSTALL_TARGET_CMDS_EXTRA)
 endef
 
 $(eval $(generic-package))