Skip to contentSkip to conversation

iso9660 support improvements

PATCH Superseded Thomas Petazzoni 4 participants 55 messages Jun 4, 2015 – Jun 7, 2015 VFS

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover iso9660 support improvements

Hello,

The following patch series brings a number of improvements to the ISO9660 support. It takes into account some of the patches that have been submitted on the topic, and that still sit in patchwork due to the patches not being completely appropriate, and hopefully re-implement the same features (and more) in a solution that is acceptable in Buildroot.

The main features are:

* Ability to put the root filesystem directly as the ISO9660 filesystem, instead of having to use an initrd/initramfs to embed the root filesystem.

* Support for using isolinux or Grub2 as alternate bootloaders to grub.

* Support for generating hybrid ISO images (which can boot from either CD-ROM or USB keys), when isolinux is used.

In sequence:

* Patch 1 extends the common filesystem infrastructure with a POST_GEN_HOOKS mechanism.

* Patch 2 convers the existing ISO9660 logic to use the common filesystem infrastructure.

* Patches 3 to 7 do some minor improvements/cleanups to the ISO9660 handling.

* Patch 8 adds the ability to put the root filesystem directly in the ISO9660 filesystem (keeping the possibility of using initrd/initramfs as alternate solutions)

* Patches 9/10 add support for isolinux and hybrid image generation.

* Patches 11/12 add support for Grub2

This series superseds the following patches:

http://patchwork.ozlabs.org/patch/430655/
http://patchwork.ozlabs.org/patch/328052/
http://patchwork.ozlabs.org/patch/328051/

Best regards,

Thomas

Thomas Petazzoni (12):
fs/common: add <fs>_POST_GEN_HOOKS support
fs/iso9660: convert to the filesystem infrastructure fs/iso9660: use if ... endif block instead of depends on fs/iso9660: enable Joliet extension
fs/iso9660: rename all variables to use the ROOTFS_ISO9660 prefix fs/iso9660: change the location of the splash image fs/iso9660: prepare cleaner kernel/initrd path handling fs/iso9660: support building a real iso9660 filesystem fs/iso9660: add support for isolinux
fs/iso9660: add hybrid image support
grub2: prepare and install El Torito image
fs/iso9660: add support for grub2

 boot/grub2/grub2.mk     |   2 +
 fs/common.mk            |   4 ++
 fs/iso9660/Config.in    |  85 +++++++++++++++++++---
 fs/iso9660/grub.cfg     |   7 ++
 fs/iso9660/iso9660.mk   | 184 +++++++++++++++++++++++++++++++++++++-----------
 fs/iso9660/isolinux.cfg |   6 ++
 fs/iso9660/menu.lst     |   6 +-
 7 files changed, 242 insertions(+), 52 deletions(-)
 create mode 100644 fs/iso9660/grub.cfg
 create mode 100644 fs/iso9660/isolinux.cfg
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/12 fs/common: add <fs>_POST_GEN_HOOKS support

The common filesystem infrastructure already supports a <fs>_PRE_GEN_HOOKS variable, which allows filesystem makefiles to register some actions to be done before the root filesystem image is generated.

This commit adds a similiar <fs>_POST_GEN_HOOKS variable, which will allow filesystem makefiles to do some actions after the filesystem image has been generated. It will initially be used by the iso9660 filesystem to delete the temporary directory it creates.

---
 fs/common.mk | 4 ++++
 1 file changed, 4 insertions(+)
fs/common.mk +4 -0
index 4387d06..40389bd 100644
@@ -16,6 +16,9 @@
 #  ROOTFS_$(FSTYPE)_PRE_GEN_HOOKS, a list of hooks to call before
 #  generating the filesystem image
 #
+#  ROOTFS_$(FSTYPE)_POST_GEN_HOOKS, a list of hooks to call after
+#  generating the filesystem image
+#
 #  ROOTFS_$(FSTYPE)_POST_TARGETS, the list of targets that should be
 #  run after running the main filesystem target. This is useful for
 #  initramfs, to rebuild the kernel once the initramfs is generated.
@@ -96,6 +99,7 @@ endif
 ifneq ($$(ROOTFS_$(2)_COMPRESS_CMD),)
 	PATH=$$(BR_PATH) $$(ROOTFS_$(2)_COMPRESS_CMD) $$@ > $$@$$(ROOTFS_$(2)_COMPRESS_EXT)
 endif
+	$$(foreach hook,$$(ROOTFS_$(2)_POST_GEN_HOOKS),$$(call $$(hook))$$(sep))
 
 rootfs-$(1)-show-depends:
 	@echo $$(ROOTFS_$(2)_DEPENDENCIES)
Signature · 1 line
2.1.0
#2 lore raw

PATCH 1/12 fs/common: add <fs>_POST_GEN_HOOKS support

Hi Thomas, all,

Quoted 11 lines · Thomas Petazzoni

The common filesystem infrastructure already supports a <fs>_PRE_GEN_HOOKS variable, which allows filesystem makefiles to register some actions to be done before the root filesystem image is generated.

This commit adds a similiar <fs>_POST_GEN_HOOKS variable, which will allow filesystem makefiles to do some actions after the filesystem image has been generated. It will initially be used by the iso9660 filesystem to delete the temporary directory it creates.

Regards,

Signature · 1 line
Samuel
#3 lore raw

PATCH 1/12 fs/common: add <fs>_POST_GEN_HOOKS support

In reply to Thomas Petazzoni

Thomas, All,

On 2015-06-04 17:05 +0200, Thomas Petazzoni spake thusly:

Quoted 11 lines

The common filesystem infrastructure already supports a <fs>_PRE_GEN_HOOKS variable, which allows filesystem makefiles to register some actions to be done before the root filesystem image is generated.

This commit adds a similiar <fs>_POST_GEN_HOOKS variable, which will allow filesystem makefiles to do some actions after the filesystem image has been generated. It will initially be used by the iso9660 filesystem to delete the temporary directory it creates.

Regards,
Yann E. MORIN.

Quoted 33 lines
---
 fs/common.mk | 4 ++++
 1 file changed, 4 insertions(+)
fs/common.mk +4 -0
index 4387d06..40389bd 100644
@@ -16,6 +16,9 @@
 #  ROOTFS_$(FSTYPE)_PRE_GEN_HOOKS, a list of hooks to call before
 #  generating the filesystem image
 #
+#  ROOTFS_$(FSTYPE)_POST_GEN_HOOKS, a list of hooks to call after
+#  generating the filesystem image
+#
 #  ROOTFS_$(FSTYPE)_POST_TARGETS, the list of targets that should be
 #  run after running the main filesystem target. This is useful for
 #  initramfs, to rebuild the kernel once the initramfs is generated.
@@ -96,6 +99,7 @@ endif
 ifneq ($$(ROOTFS_$(2)_COMPRESS_CMD),)
 	PATH=$$(BR_PATH) $$(ROOTFS_$(2)_COMPRESS_CMD) $$@ > $$@$$(ROOTFS_$(2)_COMPRESS_EXT)
 endif
+	$$(foreach hook,$$(ROOTFS_$(2)_POST_GEN_HOOKS),$$(call $$(hook))$$(sep))
 
 rootfs-$(1)-show-depends:
 	@echo $$(ROOTFS_$(2)_DEPENDENCIES)
Signature · 6 lines
2.1.0

_______________________________________________
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.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH 2/12 fs/iso9660: convert to the filesystem infrastructure

In reply to Thomas Petazzoni

Now that we have <fs>_POST_GEN_HOOKS, there is nothing that prevents the iso9660 filesystem logic from using the common filesystem infrastructure.

---
 fs/iso9660/iso9660.mk | 64 +++++++++++++++++++++++++--------------------------
 1 file changed, 31 insertions(+), 33 deletions(-)
fs/iso9660/iso9660.mk +31 -33
index 4ccfce9..5a29673 100644
@@ -2,9 +2,6 @@
 #
 # Build the iso96600 root filesystem image
 #
-# Cannot be converted to the ROOTFS_TARGET infrastructure, because of
-# the temporary construction in ISO9660_TARGET_DIR.
-#
 ################################################################################
 
 ISO9660_TARGET_DIR = $(BUILD_DIR)/iso9660
@@ -12,49 +9,50 @@ ISO9660_BOOT_MENU := $(call qstrip,$(BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU))
 
 ROOTFS_ISO9660_DEPENDENCIES = grub host-cdrkit host-fakeroot linux rootfs-cpio
 
-$(BINARIES_DIR)/rootfs.iso9660: $(ROOTFS_ISO9660_DEPENDENCIES)
-	@$(call MESSAGE,"Generating root filesystem image rootfs.iso9660")
-	$(INSTALL) -D -m 0644 $(GRUB_DIR)/stage2/stage2_eltorito \
-		$(ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
-	$(INSTALL) -D -m 0644 $(ISO9660_BOOT_MENU) \
-		$(ISO9660_TARGET_DIR)/boot/grub/menu.lst
 ifeq ($(BR2_TARGET_GRUB_SPLASH),)
+define ROOTFS_ISO9660_SPLASHSCREEN
 	$(SED) '/^splashimage/d' $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
+endef
 else
+define ROOTFS_ISO9660_SPLASHSCREEN
 	$(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz \
 		$(ISO9660_TARGET_DIR)/splash.xpm.gz
+endef
 endif
-	$(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) $(ISO9660_TARGET_DIR)/kernel
+
 ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
+define ROOTFS_ISO9660_INITRD
 	$(SED) '/initrd/d'  $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
+endef
 else
+define ROOTFS_ISO9660_INITRD
 	$(INSTALL) -D -m 0644 $(BINARIES_DIR)/rootfs.cpio$(ROOTFS_CPIO_COMPRESS_EXT) \
 		$(ISO9660_TARGET_DIR)/initrd
+endef
 endif
-	# Use fakeroot to pretend all target binaries are owned by root
-	rm -f $(FAKEROOT_SCRIPT)
-	echo "chown -h -R 0:0 $(ISO9660_TARGET_DIR)" >> $(FAKEROOT_SCRIPT)
-	# Use fakeroot so mkisofs believes the previous fakery
-	echo "$(HOST_DIR)/usr/bin/genisoimage -R -b boot/grub/stage2_eltorito -no-emul-boot " \
-		"-boot-load-size 4 -boot-info-table -o $@ $(ISO9660_TARGET_DIR)" \
-		>> $(FAKEROOT_SCRIPT)
-	chmod a+x $(FAKEROOT_SCRIPT)
-	$(HOST_DIR)/usr/bin/fakeroot -- $(FAKEROOT_SCRIPT)
-	- at rm -f $(FAKEROOT_SCRIPT)
-	- at rm -rf $(ISO9660_TARGET_DIR)
 
-rootfs-iso9660: $(BINARIES_DIR)/rootfs.iso9660
+define ROOTFS_ISO9660_PREPARATION
+	$(INSTALL) -D -m 0644 $(GRUB_DIR)/stage2/stage2_eltorito \
+		$(ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
+	$(INSTALL) -D -m 0644 $(ISO9660_BOOT_MENU) \
+		$(ISO9660_TARGET_DIR)/boot/grub/menu.lst
+	$(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) $(ISO9660_TARGET_DIR)/kernel
+	$(ROOTFS_ISO9660_SPLASHSCREEN)
+	$(ROOTFS_ISO9660_INITRD)
+endef
 
-rootfs-iso9660-show-depends:
-	@echo $(ROOTFS_ISO9660_DEPENDENCIES)
+ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_PREPARATION
 
-.PHONY: rootfs-iso9660 rootfs-iso9660-show-depends
+define ROOTFS_ISO9660_CMD
+	$(HOST_DIR)/usr/bin/genisoimage -R -b boot/grub/stage2_eltorito \
+		-no-emul-boot -boot-load-size 4 -boot-info-table \
+		-o $@ $(ISO9660_TARGET_DIR)
+endef
 
-################################################################################
-#
-# Toplevel Makefile options
-#
-################################################################################
-ifeq ($(BR2_TARGET_ROOTFS_ISO9660),y)
-TARGETS_ROOTFS += rootfs-iso9660
-endif
+define ROOTFS_ISO9660_REMOVE_TEMPDIR
+	$(RM) -rf $(ISO9660_TARGET_DIR)
+endef
+
+ROOTFS_ISO9660_POST_GEN_HOOKS += ROOTFS_ISO9660_REMOVE_TEMPDIR
+
+$(eval $(call ROOTFS_TARGET,iso9660))
Signature · 1 line
2.1.0
#5 lore raw

PATCH 2/12 fs/iso9660: convert to the filesystem infrastructure

Hi Thomas,

Quoted 77 lines · Thomas Petazzoni

Now that we have <fs>_POST_GEN_HOOKS, there is nothing that prevents the iso9660 filesystem logic from using the common filesystem infrastructure.

---
 fs/iso9660/iso9660.mk | 64 +++++++++++++++++++++++++--------------------------
 1 file changed, 31 insertions(+), 33 deletions(-)
fs/iso9660/iso9660.mk +18 -22
index 4ccfce9..5a29673 100644
@@ -2,9 +2,6 @@
 #
 # Build the iso96600 root filesystem image
 #
-# Cannot be converted to the ROOTFS_TARGET infrastructure, because of
-# the temporary construction in ISO9660_TARGET_DIR.
-#
 ################################################################################
 
 ISO9660_TARGET_DIR = $(BUILD_DIR)/iso9660
@@ -12,49 +9,50 @@ ISO9660_BOOT_MENU := $(call qstrip,$(BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU))
 
 ROOTFS_ISO9660_DEPENDENCIES = grub host-cdrkit host-fakeroot linux rootfs-cpio
 
-$(BINARIES_DIR)/rootfs.iso9660: $(ROOTFS_ISO9660_DEPENDENCIES)
-       @$(call MESSAGE,"Generating root filesystem image rootfs.iso9660")
-       $(INSTALL) -D -m 0644 $(GRUB_DIR)/stage2/stage2_eltorito \
-               $(ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
-       $(INSTALL) -D -m 0644 $(ISO9660_BOOT_MENU) \
-               $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
 ifeq ($(BR2_TARGET_GRUB_SPLASH),)
+define ROOTFS_ISO9660_SPLASHSCREEN
        $(SED) '/^splashimage/d' $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
+endef
 else
+define ROOTFS_ISO9660_SPLASHSCREEN
        $(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz \
                $(ISO9660_TARGET_DIR)/splash.xpm.gz
+endef
 endif
-       $(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) $(ISO9660_TARGET_DIR)/kernel
+
 ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
+define ROOTFS_ISO9660_INITRD
        $(SED) '/initrd/d'  $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
+endef
 else
+define ROOTFS_ISO9660_INITRD
        $(INSTALL) -D -m 0644 $(BINARIES_DIR)/rootfs.cpio$(ROOTFS_CPIO_COMPRESS_EXT) \
                $(ISO9660_TARGET_DIR)/initrd
+endef
 endif
-       # Use fakeroot to pretend all target binaries are owned by root
-       rm -f $(FAKEROOT_SCRIPT)
-       echo "chown -h -R 0:0 $(ISO9660_TARGET_DIR)" >> $(FAKEROOT_SCRIPT)
-       # Use fakeroot so mkisofs believes the previous fakery
-       echo "$(HOST_DIR)/usr/bin/genisoimage -R -b boot/grub/stage2_eltorito -no-emul-boot " \
-               "-boot-load-size 4 -boot-info-table -o $@ $(ISO9660_TARGET_DIR)" \
-               >> $(FAKEROOT_SCRIPT)
-       chmod a+x $(FAKEROOT_SCRIPT)
-       $(HOST_DIR)/usr/bin/fakeroot -- $(FAKEROOT_SCRIPT)
-       - at rm -f $(FAKEROOT_SCRIPT)
-       - at rm -rf $(ISO9660_TARGET_DIR)
 
-rootfs-iso9660: $(BINARIES_DIR)/rootfs.iso9660
+define ROOTFS_ISO9660_PREPARATION
+       $(INSTALL) -D -m 0644 $(GRUB_DIR)/stage2/stage2_eltorito \
+               $(ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
+       $(INSTALL) -D -m 0644 $(ISO9660_BOOT_MENU) \
+               $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
+       $(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) $(ISO9660_TARGET_DIR)/kernel
+       $(ROOTFS_ISO9660_SPLASHSCREEN)
+       $(ROOTFS_ISO9660_INITRD)
+endef

fs/iso9660/iso9660.mk ISO9660_BOOT_MENU := $(call qstrip,$(BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU)) · line 49

Quoted 10 lines
fs/iso9660/iso9660.mk +5 -3
 
-rootfs-iso9660-show-depends:
-       @echo $(ROOTFS_ISO9660_DEPENDENCIES)
+ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_PREPARATION
 
-.PHONY: rootfs-iso9660 rootfs-iso9660-show-depends
+define ROOTFS_ISO9660_CMD
+       $(HOST_DIR)/usr/bin/genisoimage -R -b boot/grub/stage2_eltorito \
+               -no-emul-boot -boot-load-size 4 -boot-info-table \
+               -o $@ $(ISO9660_TARGET_DIR)

Why the fakeroot trickery on genisoimage call is gone? or why is it not needed anymore?

Quoted 20 lines
fs/iso9660/iso9660.mk +8 -9
+endef
 
-################################################################################
-#
-# Toplevel Makefile options
-#
-################################################################################
-ifeq ($(BR2_TARGET_ROOTFS_ISO9660),y)
-TARGETS_ROOTFS += rootfs-iso9660
-endif
+define ROOTFS_ISO9660_REMOVE_TEMPDIR
+       $(RM) -rf $(ISO9660_TARGET_DIR)
+endef
+
+ROOTFS_ISO9660_POST_GEN_HOOKS += ROOTFS_ISO9660_REMOVE_TEMPDIR
+
+$(eval $(call ROOTFS_TARGET,iso9660))
--

2.1.0

Quoted 4 lines

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

Regards,

Signature · 1 line
Samuel
#6 lore raw

PATCH 2/12 fs/iso9660: convert to the filesystem infrastructure

Dear Samuel Martin,

Quoted 7 lines · Samuel Martin

fs/iso9660/iso9660.mk ISO9660_BOOT_MENU := $(call qstrip,$(BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU)) · line 49

Quoted 4 lines
fs/iso9660/iso9660.mk +4 -0
+define ROOTFS_ISO9660_CMD
+       $(HOST_DIR)/usr/bin/genisoimage -R -b boot/grub/stage2_eltorito \
+               -no-emul-boot -boot-load-size 4 -boot-info-table \
+               -o $@ $(ISO9660_TARGET_DIR)

Why the fakeroot trickery on genisoimage call is gone? or why is it not needed anymore?

That's the whole point of moving to the common rootfs infrastructure:
all the fakeroot trickery is handled by it. Look at the ext2 or ubifs logic, none of them call fakeroot, because it's done in common code in fs/common.mk.

Thanks for the review!

Thomas

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

PATCH 2/12 fs/iso9660: convert to the filesystem infrastructure

In reply to Thomas Petazzoni

Thomas, All,

On 2015-06-04 17:05 +0200, Thomas Petazzoni spake thusly:

Quoted 5 lines

Now that we have <fs>_POST_GEN_HOOKS, there is nothing that prevents the iso9660 filesystem logic from using the common filesystem infrastructure.

However, see a comment below...

Quoted 19 lines
---
 fs/iso9660/iso9660.mk | 64 +++++++++++++++++++++++++--------------------------
 1 file changed, 31 insertions(+), 33 deletions(-)
fs/iso9660/iso9660.mk +0 -3
index 4ccfce9..5a29673 100644
@@ -2,9 +2,6 @@
 #
 # Build the iso96600 root filesystem image
 #
-# Cannot be converted to the ROOTFS_TARGET infrastructure, because of
-# the temporary construction in ISO9660_TARGET_DIR.
-#
 ################################################################################
 
 ISO9660_TARGET_DIR = $(BUILD_DIR)/iso9660

fs/iso9660/iso9660.mk ISO9660_BOOT_MENU := $(call qstrip,$(BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU)) · line 12

Quoted 10 lines
fs/iso9660/iso9660.mk +0 -6
@@ -12,49 +9,50 @@ ISO9660_BOOT_MENU := $(call qstrip,$(BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU))
 
 ROOTFS_ISO9660_DEPENDENCIES = grub host-cdrkit host-fakeroot linux rootfs-cpio
 
-$(BINARIES_DIR)/rootfs.iso9660: $(ROOTFS_ISO9660_DEPENDENCIES)
-	@$(call MESSAGE,"Generating root filesystem image rootfs.iso9660")
-	$(INSTALL) -D -m 0644 $(GRUB_DIR)/stage2/stage2_eltorito \
-		$(ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
-	$(INSTALL) -D -m 0644 $(ISO9660_BOOT_MENU) \
-		$(ISO9660_TARGET_DIR)/boot/grub/menu.lst
 ifeq ($(BR2_TARGET_GRUB_SPLASH),)

I know this was pre-existing code, but we usually prefer positive logic. Do you think you might arrange to fix the logic in this test with anotehr patch? ;-)

Regards,
Yann E. MORIN.

Quoted 77 lines
fs/iso9660/iso9660.mk +31 -24
+define ROOTFS_ISO9660_SPLASHSCREEN
 	$(SED) '/^splashimage/d' $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
+endef
 else
+define ROOTFS_ISO9660_SPLASHSCREEN
 	$(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz \
 		$(ISO9660_TARGET_DIR)/splash.xpm.gz
+endef
 endif
-	$(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) $(ISO9660_TARGET_DIR)/kernel
+
 ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
+define ROOTFS_ISO9660_INITRD
 	$(SED) '/initrd/d'  $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
+endef
 else
+define ROOTFS_ISO9660_INITRD
 	$(INSTALL) -D -m 0644 $(BINARIES_DIR)/rootfs.cpio$(ROOTFS_CPIO_COMPRESS_EXT) \
 		$(ISO9660_TARGET_DIR)/initrd
+endef
 endif
-	# Use fakeroot to pretend all target binaries are owned by root
-	rm -f $(FAKEROOT_SCRIPT)
-	echo "chown -h -R 0:0 $(ISO9660_TARGET_DIR)" >> $(FAKEROOT_SCRIPT)
-	# Use fakeroot so mkisofs believes the previous fakery
-	echo "$(HOST_DIR)/usr/bin/genisoimage -R -b boot/grub/stage2_eltorito -no-emul-boot " \
-		"-boot-load-size 4 -boot-info-table -o $@ $(ISO9660_TARGET_DIR)" \
-		>> $(FAKEROOT_SCRIPT)
-	chmod a+x $(FAKEROOT_SCRIPT)
-	$(HOST_DIR)/usr/bin/fakeroot -- $(FAKEROOT_SCRIPT)
-	- at rm -f $(FAKEROOT_SCRIPT)
-	- at rm -rf $(ISO9660_TARGET_DIR)
 
-rootfs-iso9660: $(BINARIES_DIR)/rootfs.iso9660
+define ROOTFS_ISO9660_PREPARATION
+	$(INSTALL) -D -m 0644 $(GRUB_DIR)/stage2/stage2_eltorito \
+		$(ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
+	$(INSTALL) -D -m 0644 $(ISO9660_BOOT_MENU) \
+		$(ISO9660_TARGET_DIR)/boot/grub/menu.lst
+	$(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) $(ISO9660_TARGET_DIR)/kernel
+	$(ROOTFS_ISO9660_SPLASHSCREEN)
+	$(ROOTFS_ISO9660_INITRD)
+endef
 
-rootfs-iso9660-show-depends:
-	@echo $(ROOTFS_ISO9660_DEPENDENCIES)
+ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_PREPARATION
 
-.PHONY: rootfs-iso9660 rootfs-iso9660-show-depends
+define ROOTFS_ISO9660_CMD
+	$(HOST_DIR)/usr/bin/genisoimage -R -b boot/grub/stage2_eltorito \
+		-no-emul-boot -boot-load-size 4 -boot-info-table \
+		-o $@ $(ISO9660_TARGET_DIR)
+endef
 
-################################################################################
-#
-# Toplevel Makefile options
-#
-################################################################################
-ifeq ($(BR2_TARGET_ROOTFS_ISO9660),y)
-TARGETS_ROOTFS += rootfs-iso9660
-endif
+define ROOTFS_ISO9660_REMOVE_TEMPDIR
+	$(RM) -rf $(ISO9660_TARGET_DIR)
+endef
+
+ROOTFS_ISO9660_POST_GEN_HOOKS += ROOTFS_ISO9660_REMOVE_TEMPDIR
+
+$(eval $(call ROOTFS_TARGET,iso9660))
Signature · 6 lines
2.1.0

_______________________________________________
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.  |
'------------------------------^-------^------------------^--------------------'
#8 lore raw

PATCH 2/12 fs/iso9660: convert to the filesystem infrastructure

Dear Yann E. MORIN,

Quoted 5 lines · Yann E. MORIN
Quoted 1 line

ifeq ($(BR2_TARGET_GRUB_SPLASH),)

I know this was pre-existing code, but we usually prefer positive logic. Do you think you might arrange to fix the logic in this test with anotehr patch? ;-)

Isn't that already positive logic?

"if BR2_TARGET_GRUB_SPLASH is disabled"

The other solution is:

ifneq ($(BR2_TARGET_GRUB_SPLASH),y)

which is "if not BR2_TARGET_GRUB_SPLASH is enabled"

which looks worse.

Am I missing something?

Thomas

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

PATCH 2/12 fs/iso9660: convert to the filesystem infrastructure

Thomas, All,

On 2015-06-06 02:42 +0200, Thomas Petazzoni spake thusly:

Quoted 14 lines · Yann E. MORIN
Quoted 6 lines
Quoted 2 lines

ifeq ($(BR2_TARGET_GRUB_SPLASH),)

I know this was pre-existing code, but we usually prefer positive logic. Do you think you might arrange to fix the logic in this test with anotehr patch? ;-)

Isn't that already positive logic?

"if BR2_TARGET_GRUB_SPLASH is disabled"

The other solution is:

Quoted 7 lines

ifneq ($(BR2_TARGET_GRUB_SPLASH),y)

which is "if not BR2_TARGET_GRUB_SPLASH is enabled"

which looks worse.

Am I missing something?

Well, sorry, I was not completely explicit. What I meant was:

    ifeq ($(BR2_TARGET_GRUB_SPLASH),y)
    define ROOTFS_ISO9660_SPLASHSCREEN
        $(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz \
            $(ISO9660_TARGET_DIR)/splash.xpm.gz
    endef
    else
    define ROOTFS_ISO9660_SPLASHSCREEN
        $(SED) '/^splashimage/d' $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
    endef
    endif

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
#10 lore raw

PATCH 2/12 fs/iso9660: convert to the filesystem infrastructure

Dear Yann E. MORIN,

Quoted 12 lines · Yann E. MORIN

Well, sorry, I was not completely explicit. What I meant was:

    ifeq ($(BR2_TARGET_GRUB_SPLASH),y)
    define ROOTFS_ISO9660_SPLASHSCREEN
        $(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz \
            $(ISO9660_TARGET_DIR)/splash.xpm.gz
    endef
    else
    define ROOTFS_ISO9660_SPLASHSCREEN
        $(SED) '/^splashimage/d' $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
    endef
    endif

Yes, but no.

The $(SED) '/^splashimage/d' case needs to be done in all cases if BR2_TARGET_GRUB_SPLASH is disabled (regardless whether we're using initrd/initramfs or a real iso9660 for the rootfs).

However, the $(INSTALL) needs to be done only if BR2_TARGET_GRUB_SPLASH=y *and* we are using an initrd/initramfs, not if we are using directly the rootfs in the iso9660 filesystem. So this part only needs to be done if BR2_TARGET_GRUB_SPLASH=y *and* ROOTFS_ISO9660_USE_INITRD=YES.

Best regards,

Thomas

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

PATCH 2/12 fs/iso9660: convert to the filesystem infrastructure

Thomas, All,

On 2015-06-06 16:57 +0200, Thomas Petazzoni spake thusly:

Quoted 20 lines · Yann E. MORIN
Quoted 12 lines

Well, sorry, I was not completely explicit. What I meant was:

    ifeq ($(BR2_TARGET_GRUB_SPLASH),y)
    define ROOTFS_ISO9660_SPLASHSCREEN
        $(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz \
            $(ISO9660_TARGET_DIR)/splash.xpm.gz
    endef
    else
    define ROOTFS_ISO9660_SPLASHSCREEN
        $(SED) '/^splashimage/d' $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
    endef
    endif

Yes, but no.

The $(SED) '/^splashimage/d' case needs to be done in all cases if BR2_TARGET_GRUB_SPLASH is disabled (regardless whether we're using initrd/initramfs or a real iso9660 for the rootfs).

Quoted 5 lines

However, the $(INSTALL) needs to be done only if BR2_TARGET_GRUB_SPLASH=y *and* we are using an initrd/initramfs, not if we are using directly the rootfs in the iso9660 filesystem. So this part only needs to be done if BR2_TARGET_GRUB_SPLASH=y *and* ROOTFS_ISO9660_USE_INITRD=YES.

Sorry, but we're speaking patch 2 here, so there is yet absolutely no reference to the initrd/initramfs/direct rootfs stuff, which you're only introducing much later in the series.

This patch is changing this code:

   21 ifeq ($(BR2_TARGET_GRUB_SPLASH),)
   22     $(SED) '/^splashimage/d' $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
   23 else
   24     $(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz \
   25         $(ISO9660_TARGET_DIR)/splash.xpm.gz
   26 endif

into:

   12 ifeq ($(BR2_TARGET_GRUB_SPLASH),)
   13 define ROOTFS_ISO9660_SPLASHSCREEN
   14     $(SED) '/^splashimage/d' $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
   15 endef
   16 else
   17 define ROOTFS_ISO9660_SPLASHSCREEN
   18     $(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz \
   19         $(ISO9660_TARGET_DIR)/splash.xpm.gz
   20 endef
   21 endif

So, what I suggested above is exactly the *same* condition, but with the 'if' and 'else' clauses reversed:

   12 ifeq ($(BR2_TARGET_GRUB_SPLASH),y)
   13 define ROOTFS_ISO9660_SPLASHSCREEN
   14     $(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz \
   15         $(ISO9660_TARGET_DIR)/splash.xpm.gz
   16 endef
   17 else
   18 define ROOTFS_ISO9660_SPLASHSCREEN
   19     $(SED) '/^splashimage/d' $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
   20 endef
   21 endif

See?

Now, what you said is true further in the series, and indeed does not warrant changing the ordering of the 'if' and 'else' clauses, as that would need to be switched again later.

And I maintain my ACK on this patch! ;-)

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
#12 lore raw

PATCH 2/12 fs/iso9660: convert to the filesystem infrastructure

In reply to Thomas Petazzoni
Quoted 5 lines · Thomas Petazzoni

Now that we have <fs>_POST_GEN_HOOKS, there is nothing that prevents the iso9660 filesystem logic from using the common filesystem infrastructure.

However, instead of doing the cleanup in a _POST_GEN_HOOK, I would skip the
cleanup completely. We normally don't clean up any build artefact, so why should we do it here?

Regards,
Arnout

[snip]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#13 lore raw

PATCH 2/12 fs/iso9660: convert to the filesystem infrastructure

Dear Arnout Vandecappelle,

Quoted 5 lines · Arnout Vandecappelle
Quoted 4 lines · Thomas Petazzoni

Now that we have <fs>_POST_GEN_HOOKS, there is nothing that prevents the iso9660 filesystem logic from using the common filesystem infrastructure.

Quoted 7 lines
Quoted 1 line

However, instead of doing the cleanup in a _POST_GEN_HOOK, I would skip the
cleanup completely. We normally don't clean up any build artefact, so why should we do it here?

That's actually true. The only advantage by cleaning up is that if you redo a build and the contents of the temporary directory have changed, it's properly accurate. But we could also do:

remove temp dir
create empty temp dir
do stuff
create image

and that's it.

Do you want to change it in this direction?

Thanks,

Thomas

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

PATCH 2/12 fs/iso9660: convert to the filesystem infrastructure

Thomas, All,

On 2015-06-06 02:43 +0200, Thomas Petazzoni spake thusly:

Quoted 12 lines

Dear Arnout Vandecappelle,

Quoted 9 lines · Arnout Vandecappelle
Quoted 5 lines · Thomas Petazzoni

Now that we have <fs>_POST_GEN_HOOKS, there is nothing that prevents the iso9660 filesystem logic from using the common filesystem infrastructure.

Quoted 7 lines
Quoted 3 lines

However, instead of doing the cleanup in a _POST_GEN_HOOK, I would skip the
cleanup completely. We normally don't clean up any build artefact, so why should we do it here?

That's actually true. The only advantage by cleaning up is that if you redo a build and the contents of the temporary directory have changed, it's properly accurate.

Not if the image building itself fails (e.g. FS too large for iso9660, or whatever other reason), so the temporary directory would still be there.

Quoted 10 lines

But we could also do:

remove temp dir
create empty temp dir
do stuff
create image

and that's it.

Do you want to change it in this direction?

That would be better, yes.

However, that really spawns the question of whether Buildroot should provide a clean, empty temporary directory from the onset, so we don't re-invent this logic everywhere.

I'll see what I can do about that...

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
#15 lore raw

PATCH 3/12 fs/iso9660: use if ... endif block instead of depends on

In reply to Thomas Petazzoni

In preparation to the addition of numerous additional options to the iso9660 filesystem logic, use a if ... endif block instead of a depends on for the only option that currently exists.

---
 fs/iso9660/Config.in | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/iso9660/Config.in +4 -1
index 50b4377..9d00ab8 100644
@@ -8,11 +8,14 @@ config BR2_TARGET_ROOTFS_ISO9660
 	help
 	  Build a bootable iso9660 image
 
+if BR2_TARGET_ROOTFS_ISO9660
+
 config BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU
 	string "Boot menu.lst file"
-	depends on BR2_TARGET_ROOTFS_ISO9660
 	default "fs/iso9660/menu.lst"
 
+endif
+
 comment "iso image needs a Linux kernel to be built"
 	depends on BR2_i386 || BR2_x86_64
 	depends on !BR2_LINUX_KERNEL
Signature · 1 line
2.1.0
#17 lore raw

PATCH 3/12 fs/iso9660: use if ... endif block instead of depends on

In reply to Thomas Petazzoni

Thomas, All,

On 2015-06-04 17:05 +0200, Thomas Petazzoni spake thusly:

Quoted 5 lines

In preparation to the addition of numerous additional options to the iso9660 filesystem logic, use a if ... endif block instead of a depends on for the only option that currently exists.

Maybe you could re-order that to come earlier in the series (since it is an easy patch, and does not depend on the previous ones)?

Regards,
Yann E. MORIN.

Quoted 31 lines
---
 fs/iso9660/Config.in | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/iso9660/Config.in +4 -1
index 50b4377..9d00ab8 100644
@@ -8,11 +8,14 @@ config BR2_TARGET_ROOTFS_ISO9660
 	help
 	  Build a bootable iso9660 image
 
+if BR2_TARGET_ROOTFS_ISO9660
+
 config BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU
 	string "Boot menu.lst file"
-	depends on BR2_TARGET_ROOTFS_ISO9660
 	default "fs/iso9660/menu.lst"
 
+endif
+
 comment "iso image needs a Linux kernel to be built"
 	depends on BR2_i386 || BR2_x86_64
 	depends on !BR2_LINUX_KERNEL
Signature · 6 lines
2.1.0

_______________________________________________
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.  |
'------------------------------^-------^------------------^--------------------'
#18 lore raw

PATCH 4/12 fs/iso9660: enable Joliet extension

In reply to Thomas Petazzoni

We already enable the Rockridge extension by default when building ISO9660, so let's also enable the Joliet extension which allows to support Unicode file names and long file names.

---
 fs/iso9660/iso9660.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/iso9660/iso9660.mk +1 -1
index 5a29673..6a04fe6 100644
@@ -44,7 +44,7 @@ endef
 ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_PREPARATION
 
 define ROOTFS_ISO9660_CMD
-	$(HOST_DIR)/usr/bin/genisoimage -R -b boot/grub/stage2_eltorito \
+	$(HOST_DIR)/usr/bin/genisoimage -J -R -b boot/grub/stage2_eltorito \
 		-no-emul-boot -boot-load-size 4 -boot-info-table \
 		-o $@ $(ISO9660_TARGET_DIR)
 endef
Signature · 1 line
2.1.0
#20 lore raw

PATCH 4/12 fs/iso9660: enable Joliet extension

In reply to Thomas Petazzoni

Thomas, All,

On 2015-06-04 17:05 +0200, Thomas Petazzoni spake thusly:

Quoted 5 lines

We already enable the Rockridge extension by default when building ISO9660, so let's also enable the Joliet extension which allows to support Unicode file names and long file names.

However, see a comment, below...

Quoted 9 lines
---
 fs/iso9660/iso9660.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/iso9660/iso9660.mk +0 -0
index 5a29673..6a04fe6 100644

fs/iso9660/iso9660.mk endef · line 47

Quoted 5 lines
fs/iso9660/iso9660.mk +1 -1
@@ -44,7 +44,7 @@ endef
 ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_PREPARATION
 
 define ROOTFS_ISO9660_CMD
-	$(HOST_DIR)/usr/bin/genisoimage -R -b boot/grub/stage2_eltorito \
+	$(HOST_DIR)/usr/bin/genisoimage -J -R -b boot/grub/stage2_eltorito \

Only tangentially related to your change:

-R is for RockRidge, but it seems using -r would be better:

-r This is like the -R option, but file ownership and modes are set
to more useful values. [--snip--]

Reading the full entry for -r is instructive, and makes it sound like that's what we would want to use instead of -R.

Regards,
Yann E. MORIN.

Quoted 10 lines
fs/iso9660/iso9660.mk +0 -0
 		-no-emul-boot -boot-load-size 4 -boot-info-table \
 		-o $@ $(ISO9660_TARGET_DIR)
 endef
Signature · 6 lines
2.1.0

_______________________________________________
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.  |
'------------------------------^-------^------------------^--------------------'
#21 lore raw

PATCH 4/12 fs/iso9660: enable Joliet extension

Dear Yann E. MORIN,

Quoted 9 lines · Yann E. MORIN

Only tangentially related to your change:

-R is for RockRidge, but it seems using -r would be better:

-r This is like the -R option, but file ownership and modes are set
to more useful values. [--snip--]

Reading the full entry for -r is instructive, and makes it sound like that's what we would want to use instead of -R.

I'm actually not sure. Let's list what -r is doing compared to -R:

* Setting uid:gid to 0:0 to all files. We already do that using fakeroot, and we also set some other ownership for specific files using <pkg>_PERMISSIONS and the device table. So getting all of that reset to 0:0 is wrong.

* Changing permissions all over. Why do we care? We already take care of dependencies, and -r makes everything world-readable, which we clearly don't want.

* It apparently clears the set-id bit, which would make all setuid application to break.

So, in fact I'm rather convinced that we should keep -R and not use -r.

Best regards,

Thomas

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

PATCH 4/12 fs/iso9660: enable Joliet extension

Thomas, All,

On 2015-06-06 02:46 +0200, Thomas Petazzoni spake thusly:

Quoted 19 lines · Yann E. MORIN
Quoted 10 lines

Only tangentially related to your change:

-R is for RockRidge, but it seems using -r would be better:

-r This is like the -R option, but file ownership and modes are set
to more useful values. [--snip--]

Reading the full entry for -r is instructive, and makes it sound like that's what we would want to use instead of -R.

I'm actually not sure. Let's list what -r is doing compared to -R:

* Setting uid:gid to 0:0 to all files. We already do that using fakeroot, and we also set some other ownership for specific files using <pkg>_PERMISSIONS and the device table. So getting all of that reset to 0:0 is wrong.

Quoted 8 lines

* Changing permissions all over. Why do we care? We already take care of dependencies, and -r makes everything world-readable, which we clearly don't want.

* It apparently clears the set-id bit, which would make all setuid application to break.

So, in fact I'm rather convinced that we should keep -R and not use -r.

Yes, you're right! :-)

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
#23 lore raw

PATCH 5/12 fs/iso9660: rename all variables to use the ROOTFS_ISO9660 prefix

In reply to Thomas Petazzoni

For consistency reasons, this commit renames all internal variables of iso9660.mk to use the ROOTFS_ISO9660 prefix.

While we're at it, replace a useless ':=' by '='.

---
 fs/iso9660/iso9660.mk | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
fs/iso9660/iso9660.mk +12 -12
index 6a04fe6..0c7ef3b 100644
@@ -4,39 +4,39 @@
 #
 ################################################################################
 
-ISO9660_TARGET_DIR = $(BUILD_DIR)/iso9660
-ISO9660_BOOT_MENU := $(call qstrip,$(BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU))
+ROOTFS_ISO9660_TARGET_DIR = $(BUILD_DIR)/iso9660
+ROOTFS_ISO9660_BOOT_MENU = $(call qstrip,$(BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU))
 
 ROOTFS_ISO9660_DEPENDENCIES = grub host-cdrkit host-fakeroot linux rootfs-cpio
 
 ifeq ($(BR2_TARGET_GRUB_SPLASH),)
 define ROOTFS_ISO9660_SPLASHSCREEN
-	$(SED) '/^splashimage/d' $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
+	$(SED) '/^splashimage/d' $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
 endef
 else
 define ROOTFS_ISO9660_SPLASHSCREEN
 	$(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz \
-		$(ISO9660_TARGET_DIR)/splash.xpm.gz
+		$(ROOTFS_ISO9660_TARGET_DIR)/splash.xpm.gz
 endef
 endif
 
 ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
 define ROOTFS_ISO9660_INITRD
-	$(SED) '/initrd/d'  $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
+	$(SED) '/initrd/d'  $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
 endef
 else
 define ROOTFS_ISO9660_INITRD
 	$(INSTALL) -D -m 0644 $(BINARIES_DIR)/rootfs.cpio$(ROOTFS_CPIO_COMPRESS_EXT) \
-		$(ISO9660_TARGET_DIR)/initrd
+		$(ROOTFS_ISO9660_TARGET_DIR)/initrd
 endef
 endif
 
 define ROOTFS_ISO9660_PREPARATION
 	$(INSTALL) -D -m 0644 $(GRUB_DIR)/stage2/stage2_eltorito \
-		$(ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
-	$(INSTALL) -D -m 0644 $(ISO9660_BOOT_MENU) \
-		$(ISO9660_TARGET_DIR)/boot/grub/menu.lst
-	$(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) $(ISO9660_TARGET_DIR)/kernel
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
+	$(INSTALL) -D -m 0644 $(ROOTFS_ISO9660_BOOT_MENU) \
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+	$(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) $(ROOTFS_ISO9660_TARGET_DIR)/kernel
 	$(ROOTFS_ISO9660_SPLASHSCREEN)
 	$(ROOTFS_ISO9660_INITRD)
 endef
@@ -46,11 +46,11 @@ ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_PREPARATION
 define ROOTFS_ISO9660_CMD
 	$(HOST_DIR)/usr/bin/genisoimage -J -R -b boot/grub/stage2_eltorito \
 		-no-emul-boot -boot-load-size 4 -boot-info-table \
-		-o $@ $(ISO9660_TARGET_DIR)
+		-o $@ $(ROOTFS_ISO9660_TARGET_DIR)
 endef
 
 define ROOTFS_ISO9660_REMOVE_TEMPDIR
-	$(RM) -rf $(ISO9660_TARGET_DIR)
+	$(RM) -rf $(ROOTFS_ISO9660_TARGET_DIR)
 endef
 
 ROOTFS_ISO9660_POST_GEN_HOOKS += ROOTFS_ISO9660_REMOVE_TEMPDIR
Signature · 1 line
2.1.0
#25 lore raw

PATCH 5/12 fs/iso9660: rename all variables to use the ROOTFS_ISO9660 prefix

In reply to Thomas Petazzoni

Thomas, All,

On 2015-06-04 17:05 +0200, Thomas Petazzoni spake thusly:

Quoted 6 lines

For consistency reasons, this commit renames all internal variables of iso9660.mk to use the ROOTFS_ISO9660 prefix.

While we're at it, replace a useless ':=' by '='.

Regards,
Yann E. MORIN.

Quoted 79 lines
---
 fs/iso9660/iso9660.mk | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
fs/iso9660/iso9660.mk +12 -12
index 6a04fe6..0c7ef3b 100644
@@ -4,39 +4,39 @@
 #
 ################################################################################
 
-ISO9660_TARGET_DIR = $(BUILD_DIR)/iso9660
-ISO9660_BOOT_MENU := $(call qstrip,$(BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU))
+ROOTFS_ISO9660_TARGET_DIR = $(BUILD_DIR)/iso9660
+ROOTFS_ISO9660_BOOT_MENU = $(call qstrip,$(BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU))
 
 ROOTFS_ISO9660_DEPENDENCIES = grub host-cdrkit host-fakeroot linux rootfs-cpio
 
 ifeq ($(BR2_TARGET_GRUB_SPLASH),)
 define ROOTFS_ISO9660_SPLASHSCREEN
-	$(SED) '/^splashimage/d' $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
+	$(SED) '/^splashimage/d' $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
 endef
 else
 define ROOTFS_ISO9660_SPLASHSCREEN
 	$(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz \
-		$(ISO9660_TARGET_DIR)/splash.xpm.gz
+		$(ROOTFS_ISO9660_TARGET_DIR)/splash.xpm.gz
 endef
 endif
 
 ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
 define ROOTFS_ISO9660_INITRD
-	$(SED) '/initrd/d'  $(ISO9660_TARGET_DIR)/boot/grub/menu.lst
+	$(SED) '/initrd/d'  $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
 endef
 else
 define ROOTFS_ISO9660_INITRD
 	$(INSTALL) -D -m 0644 $(BINARIES_DIR)/rootfs.cpio$(ROOTFS_CPIO_COMPRESS_EXT) \
-		$(ISO9660_TARGET_DIR)/initrd
+		$(ROOTFS_ISO9660_TARGET_DIR)/initrd
 endef
 endif
 
 define ROOTFS_ISO9660_PREPARATION
 	$(INSTALL) -D -m 0644 $(GRUB_DIR)/stage2/stage2_eltorito \
-		$(ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
-	$(INSTALL) -D -m 0644 $(ISO9660_BOOT_MENU) \
-		$(ISO9660_TARGET_DIR)/boot/grub/menu.lst
-	$(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) $(ISO9660_TARGET_DIR)/kernel
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
+	$(INSTALL) -D -m 0644 $(ROOTFS_ISO9660_BOOT_MENU) \
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+	$(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) $(ROOTFS_ISO9660_TARGET_DIR)/kernel
 	$(ROOTFS_ISO9660_SPLASHSCREEN)
 	$(ROOTFS_ISO9660_INITRD)
 endef
@@ -46,11 +46,11 @@ ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_PREPARATION
 define ROOTFS_ISO9660_CMD
 	$(HOST_DIR)/usr/bin/genisoimage -J -R -b boot/grub/stage2_eltorito \
 		-no-emul-boot -boot-load-size 4 -boot-info-table \
-		-o $@ $(ISO9660_TARGET_DIR)
+		-o $@ $(ROOTFS_ISO9660_TARGET_DIR)
 endef
 
 define ROOTFS_ISO9660_REMOVE_TEMPDIR
-	$(RM) -rf $(ISO9660_TARGET_DIR)
+	$(RM) -rf $(ROOTFS_ISO9660_TARGET_DIR)
 endef
 
 ROOTFS_ISO9660_POST_GEN_HOOKS += ROOTFS_ISO9660_REMOVE_TEMPDIR
Signature · 6 lines
2.1.0

_______________________________________________
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.  |
'------------------------------^-------^------------------^--------------------'
#26 lore raw

PATCH 6/12 fs/iso9660: change the location of the splash image

In reply to Thomas Petazzoni

In order to simplify the introduction of the support for using ISO9660 as the real root filesystem, this commit changes the location of the grub splash image. This makes it match where the splash image in $(TARGET_DIR).

---
 fs/iso9660/iso9660.mk | 2 +-
 fs/iso9660/menu.lst   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
fs/iso9660/iso9660.mk +1 -1
index 0c7ef3b..80971d3 100644
@@ -16,7 +16,7 @@ endef
 else
 define ROOTFS_ISO9660_SPLASHSCREEN
 	$(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz \
-		$(ROOTFS_ISO9660_TARGET_DIR)/splash.xpm.gz
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/splash.xpm.gz
 endef
 endif
 
fs/iso9660/menu.lst +1 -1
index c0bbff6..fd5c76a 100644
@@ -5,7 +5,7 @@ timeout		10
 color 		cyan/blue white/blue
 
 # Gets enabled/disabled depending on Grub support for splashimage
-splashimage	/splash.xpm.gz
+splashimage	/boot/grub/splash.xpm.gz
 
 # Used when a splashimage is enabled
 foreground 	000000
Signature · 1 line
2.1.0
#27 lore raw

PATCH 6/12 fs/iso9660: change the location of the splash image

Quoted 6 lines · Thomas Petazzoni

In order to simplify the introduction of the support for using ISO9660 as the real root filesystem, this commit changes the location of the grub splash image. This makes it match where the splash image in $(TARGET_DIR).

Regards,

Signature · 1 line
Samuel
#28 lore raw

PATCH 6/12 fs/iso9660: change the location of the splash image

In reply to Thomas Petazzoni

Thomas, All,

On 2015-06-04 17:05 +0200, Thomas Petazzoni spake thusly:

Quoted 4 lines

In order to simplify the introduction of the support for using ISO9660 as the real root filesystem, this commit changes the location of the grub splash image. This makes it match where the splash image in $(TARGET_DIR).

It looks like that last sentence is incorrect (missing verb?) and I had a bit of a hard time udnerstanding what it meant (but see later).

Quoted 1 line

(Comments below...)

Quoted 10 lines
---
 fs/iso9660/iso9660.mk | 2 +-
 fs/iso9660/menu.lst   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
fs/iso9660/iso9660.mk +0 -0
index 0c7ef3b..80971d3 100644

fs/iso9660/iso9660.mk endef · line 19

Quoted 5 lines
fs/iso9660/iso9660.mk +1 -1
@@ -16,7 +16,7 @@ endef
 else
 define ROOTFS_ISO9660_SPLASHSCREEN
 	$(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz \
-		$(ROOTFS_ISO9660_TARGET_DIR)/splash.xpm.gz
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/splash.xpm.gz

Since iso9660 already depends on grub, grub would have already installed
that file in $(TARGET_DIR) (and that's where I finally understood that
sentence of yours, above).

Also, fs images are generated after the post-build scripts and rootfs overlays, which would leave to the user the option to replace the bootsplash with its own.

So. maybe we should grab the image from $(TARGET_DIR) rather than picking it from the grub package?

Of course, that should be a separate patch.

Regards,
Yann E. MORIN.

Quoted 23 lines
fs/iso9660/iso9660.mk +0 -0
 endef
 endif
 
fs/iso9660/menu.lst +1 -1
index c0bbff6..fd5c76a 100644
@@ -5,7 +5,7 @@ timeout		10
 color 		cyan/blue white/blue
 
 # Gets enabled/disabled depending on Grub support for splashimage
-splashimage	/splash.xpm.gz
+splashimage	/boot/grub/splash.xpm.gz
 
 # Used when a splashimage is enabled
 foreground 	000000
Signature · 6 lines
2.1.0

_______________________________________________
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.  |
'------------------------------^-------^------------------^--------------------'
#29 lore raw

PATCH 7/12 fs/iso9660: prepare cleaner kernel/initrd path handling

In reply to Thomas Petazzoni

The iso9660.mk modifies the menu.lst file from Grub to set the correct initrd/kernel image locations. However, with the upcoming support of other bootloaders for iso9660 filesystems, we need to modify a bit this logic.

Instead of relying on the specific details of the grub menu.lst syntax, we introduce the __KERNEL_PATH__ and __INITRD_PATH__ magic keywords, which iso9660.mk will replace by the appropriate values. They can therefore be used where needed in grub menu.lst, and in similar configuration files of other bootloaders, as will be supported in the following commits.

---
 fs/iso9660/Config.in  |  5 +++++
 fs/iso9660/iso9660.mk | 11 ++++++++---
 fs/iso9660/menu.lst   |  4 ++--
 3 files changed, 15 insertions(+), 5 deletions(-)
fs/iso9660/Config.in +5 -0
index 9d00ab8..111158b 100644
@@ -13,6 +13,11 @@ if BR2_TARGET_ROOTFS_ISO9660
 config BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU
 	string "Boot menu.lst file"
 	default "fs/iso9660/menu.lst"
+	help
+	  Use this option to provide a custom Grub menu.lst file. Note
+	  that the strings __KERNEL_PATH__ and __INITRD_PATH__ will
+	  automatically be replaced by the path to the kernel and
+	  initrd images respectively.
 
 endif
 
fs/iso9660/iso9660.mk +8 -3
index 80971d3..2a8a447 100644
@@ -22,12 +22,14 @@ endif
 
 ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
 define ROOTFS_ISO9660_INITRD
-	$(SED) '/initrd/d'  $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+	$(SED) '/__INITRD_PATH__/d'  $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
 endef
 else
 define ROOTFS_ISO9660_INITRD
 	$(INSTALL) -D -m 0644 $(BINARIES_DIR)/rootfs.cpio$(ROOTFS_CPIO_COMPRESS_EXT) \
-		$(ROOTFS_ISO9660_TARGET_DIR)/initrd
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/initrd
+	$(SED) "s%__INITRD_PATH__%/boot/initrd%" \
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
 endef
 endif
 
@@ -36,7 +38,10 @@ define ROOTFS_ISO9660_PREPARATION
 		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
 	$(INSTALL) -D -m 0644 $(ROOTFS_ISO9660_BOOT_MENU) \
 		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
-	$(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) $(ROOTFS_ISO9660_TARGET_DIR)/kernel
+	$(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) \
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/$(LINUX_IMAGE_NAME)
+	$(SED) "s%__KERNEL_PATH__%/boot/$(LINUX_IMAGE_NAME)%" \
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
 	$(ROOTFS_ISO9660_SPLASHSCREEN)
 	$(ROOTFS_ISO9660_INITRD)
 endef
fs/iso9660/menu.lst +2 -2
index fd5c76a..8e8309f 100644
@@ -12,8 +12,8 @@ foreground 	000000
 background 	cccccc
 
 title		Buildroot ISO9660 image
-kernel		/kernel
-initrd		/initrd
+kernel		__KERNEL_PATH__
+initrd		__INITRD_PATH__
 
 title		Hard Drive (first partition)
 rootnoverify	(hd0)
Signature · 1 line
2.1.0
#30 lore raw

PATCH 7/12 fs/iso9660: prepare cleaner kernel/initrd path handling

Quoted 5 lines · Thomas Petazzoni

The iso9660.mk modifies the menu.lst file from Grub to set the correct initrd/kernel image locations. However, with the upcoming support of other bootloaders for iso9660 filesystems, we need to modify a bit this logic.

Quoted 8 lines

Instead of relying on the specific details of the grub menu.lst syntax, we introduce the __KERNEL_PATH__ and __INITRD_PATH__ magic keywords, which iso9660.mk will replace by the appropriate values. They can therefore be used where needed in grub menu.lst, and in similar configuration files of other bootloaders, as will be supported in the following commits.

Regards,

Signature · 1 line
Samuel
#31 lore raw

PATCH 7/12 fs/iso9660: prepare cleaner kernel/initrd path handling

In reply to Thomas Petazzoni

Thomas, All,

On 2015-06-04 17:05 +0200, Thomas Petazzoni spake thusly:

Quoted 5 lines

The iso9660.mk modifies the menu.lst file from Grub to set the correct initrd/kernel image locations. However, with the upcoming support of other bootloaders for iso9660 filesystems, we need to modify a bit this logic.

Quoted 8 lines

Instead of relying on the specific details of the grub menu.lst syntax, we introduce the __KERNEL_PATH__ and __INITRD_PATH__ magic keywords, which iso9660.mk will replace by the appropriate values. They can therefore be used where needed in grub menu.lst, and in similar configuration files of other bootloaders, as will be supported in the following commits.

Regards,
Yann E. MORIN.

Quoted 77 lines
---
 fs/iso9660/Config.in  |  5 +++++
 fs/iso9660/iso9660.mk | 11 ++++++++---
 fs/iso9660/menu.lst   |  4 ++--
 3 files changed, 15 insertions(+), 5 deletions(-)
fs/iso9660/Config.in +5 -0
index 9d00ab8..111158b 100644
@@ -13,6 +13,11 @@ if BR2_TARGET_ROOTFS_ISO9660
 config BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU
 	string "Boot menu.lst file"
 	default "fs/iso9660/menu.lst"
+	help
+	  Use this option to provide a custom Grub menu.lst file. Note
+	  that the strings __KERNEL_PATH__ and __INITRD_PATH__ will
+	  automatically be replaced by the path to the kernel and
+	  initrd images respectively.
 
 endif
 
fs/iso9660/iso9660.mk +8 -3
index 80971d3..2a8a447 100644
@@ -22,12 +22,14 @@ endif
 
 ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
 define ROOTFS_ISO9660_INITRD
-	$(SED) '/initrd/d'  $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+	$(SED) '/__INITRD_PATH__/d'  $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
 endef
 else
 define ROOTFS_ISO9660_INITRD
 	$(INSTALL) -D -m 0644 $(BINARIES_DIR)/rootfs.cpio$(ROOTFS_CPIO_COMPRESS_EXT) \
-		$(ROOTFS_ISO9660_TARGET_DIR)/initrd
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/initrd
+	$(SED) "s%__INITRD_PATH__%/boot/initrd%" \
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
 endef
 endif
 
@@ -36,7 +38,10 @@ define ROOTFS_ISO9660_PREPARATION
 		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
 	$(INSTALL) -D -m 0644 $(ROOTFS_ISO9660_BOOT_MENU) \
 		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
-	$(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) $(ROOTFS_ISO9660_TARGET_DIR)/kernel
+	$(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) \
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/$(LINUX_IMAGE_NAME)
+	$(SED) "s%__KERNEL_PATH__%/boot/$(LINUX_IMAGE_NAME)%" \
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
 	$(ROOTFS_ISO9660_SPLASHSCREEN)
 	$(ROOTFS_ISO9660_INITRD)
 endef
fs/iso9660/menu.lst +2 -2
index fd5c76a..8e8309f 100644
@@ -12,8 +12,8 @@ foreground 	000000
 background 	cccccc
 
 title		Buildroot ISO9660 image
-kernel		/kernel
-initrd		/initrd
+kernel		__KERNEL_PATH__
+initrd		__INITRD_PATH__
 
 title		Hard Drive (first partition)
 rootnoverify	(hd0)
Signature · 6 lines
2.1.0

_______________________________________________
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.  |
'------------------------------^-------^------------------^--------------------'
#32 lore raw

PATCH 7/12 fs/iso9660: prepare cleaner kernel/initrd path handling

In reply to Thomas Petazzoni

Thomas, All,

On 2015-06-04 17:05 +0200, Thomas Petazzoni spake thusly:

Quoted 11 lines

The iso9660.mk modifies the menu.lst file from Grub to set the correct initrd/kernel image locations. However, with the upcoming support of other bootloaders for iso9660 filesystems, we need to modify a bit this logic.

Instead of relying on the specific details of the grub menu.lst syntax, we introduce the __KERNEL_PATH__ and __INITRD_PATH__ magic keywords, which iso9660.mk will replace by the appropriate values. They can therefore be used where needed in grub menu.lst, and in similar configuration files of other bootloaders, as will be supported in the following commits.

You forgot to document in the commit log that you are also moving the locations where the kernel image and initrd files are now stored.

I understand this is needed later on when we add support for using the iso9660 directly as the rootfs, because the kernel will be forcibly installed in the target (with the appropriate Kconfig option), and that you also move the initrd to match.

Still, this is missing in the commit log (and I forgot to write this in my previous mail, sorry).

However, I trust you to come up with a delightfull-to-read explanation, so my Acked-by still stands! ;-)

Regards,
Yann E. MORIN.

Quoted 78 lines
---
 fs/iso9660/Config.in  |  5 +++++
 fs/iso9660/iso9660.mk | 11 ++++++++---
 fs/iso9660/menu.lst   |  4 ++--
 3 files changed, 15 insertions(+), 5 deletions(-)
fs/iso9660/Config.in +5 -0
index 9d00ab8..111158b 100644
@@ -13,6 +13,11 @@ if BR2_TARGET_ROOTFS_ISO9660
 config BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU
 	string "Boot menu.lst file"
 	default "fs/iso9660/menu.lst"
+	help
+	  Use this option to provide a custom Grub menu.lst file. Note
+	  that the strings __KERNEL_PATH__ and __INITRD_PATH__ will
+	  automatically be replaced by the path to the kernel and
+	  initrd images respectively.
 
 endif
 
fs/iso9660/iso9660.mk +8 -3
index 80971d3..2a8a447 100644
@@ -22,12 +22,14 @@ endif
 
 ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
 define ROOTFS_ISO9660_INITRD
-	$(SED) '/initrd/d'  $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+	$(SED) '/__INITRD_PATH__/d'  $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
 endef
 else
 define ROOTFS_ISO9660_INITRD
 	$(INSTALL) -D -m 0644 $(BINARIES_DIR)/rootfs.cpio$(ROOTFS_CPIO_COMPRESS_EXT) \
-		$(ROOTFS_ISO9660_TARGET_DIR)/initrd
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/initrd
+	$(SED) "s%__INITRD_PATH__%/boot/initrd%" \
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
 endef
 endif
 
@@ -36,7 +38,10 @@ define ROOTFS_ISO9660_PREPARATION
 		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
 	$(INSTALL) -D -m 0644 $(ROOTFS_ISO9660_BOOT_MENU) \
 		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
-	$(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) $(ROOTFS_ISO9660_TARGET_DIR)/kernel
+	$(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) \
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/$(LINUX_IMAGE_NAME)
+	$(SED) "s%__KERNEL_PATH__%/boot/$(LINUX_IMAGE_NAME)%" \
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
 	$(ROOTFS_ISO9660_SPLASHSCREEN)
 	$(ROOTFS_ISO9660_INITRD)
 endef
fs/iso9660/menu.lst +2 -2
index fd5c76a..8e8309f 100644
@@ -12,8 +12,8 @@ foreground 	000000
 background 	cccccc
 
 title		Buildroot ISO9660 image
-kernel		/kernel
-initrd		/initrd
+kernel		__KERNEL_PATH__
+initrd		__INITRD_PATH__
 
 title		Hard Drive (first partition)
 rootnoverify	(hd0)
Signature · 6 lines
2.1.0

_______________________________________________
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.  |
'------------------------------^-------^------------------^--------------------'
#33 lore raw

PATCH 8/12 fs/iso9660: support building a real iso9660 filesystem

In reply to Thomas Petazzoni

Until now, the iso9660 filesystem handling only supported using an initrd/initramfs to store the root filesystem, which is very different from what we do with the other filesystems.

This commit changes the iso9660 logic to also allow using directly an iso9660 filesystem to store the root filesystem. A new option, BR2_TARGET_ROOTFS_ISO9660_INITRD, is created to tell the iso9660 that we want to use an initrd and not directly the root filesystem in iso9660 format. This option defaults to 'y' to preserve the existing behavior.

After this commit, we therefore have three possibilities:

* BR2_TARGET_ROOTFS_ISO9660=y, with BR2_TARGET_ROOTFS_INITRAMFS and BR2_TARGET_ROOTFS_ISO9660_INITRD disabled. In this case, the iso9660 filesystem is directly the contents of the root filesystem (since is possible thanks to the Rockridge extensions that were already enabled using the -R option of genisoimage). Obviously, it means that the root filesystem is read-only.

* BR2_TARGET_ROOTFS_ISO9660=y and BR2_TARGET_ROOTFS_INITRAMFS=y (the value of BR2_TARGET_ROOTFS_ISO9660_INITRD doesn't matter). In this case, the root filesystem is already linked into the kernel image itself, as an initramfs. So the iso9660 filesystem doesn't contain the root filesystem as is, but just the bootloader and the kernel image.

* BR2_TARGET_ROOTFS_ISO9660=y, BR2_TARGET_ROOTFS_ISO9660_INITRD=y and BR2_TARGET_ROOTFS_INITRAMFS disabled. In this case, a separate initrd is used. The iso9660 filesystem only contains the bootloader, the kernel and the initrd.

In order to support the first case out of the box, root=/dev/sr0 is added on the kernel command line in the example Grub configuration file, so that the kernel knows where the root filesystem is located. This argument is ignored when initrd/initramfs are used.

---
 fs/iso9660/Config.in  |  27 ++++++++++++-
 fs/iso9660/iso9660.mk | 103 +++++++++++++++++++++++++++++++++++++++-----------
 fs/iso9660/menu.lst   |   2 +-
 3 files changed, 106 insertions(+), 26 deletions(-)
fs/iso9660/Config.in +25 -2
index 111158b..e300fdb 100644
@@ -2,11 +2,23 @@ config BR2_TARGET_ROOTFS_ISO9660
 	bool "iso image"
 	depends on (BR2_i386 || BR2_x86_64)
 	depends on BR2_LINUX_KERNEL
-	select BR2_TARGET_ROOTFS_CPIO
+	select BR2_LINUX_KERNEL_INSTALL_TARGET \
+	       if (!BR2_TARGET_ROOTFS_ISO9660_INITRD && !BR2_TARGET_ROOTFS_INITRAMFS)
 	select BR2_TARGET_GRUB
 	select BR2_TARGET_GRUB_FS_ISO9660
 	help
-	  Build a bootable iso9660 image
+	  Build a bootable ISO9660 image. By default, the root
+	  filesystem is directly packed as the ISO9660 filesystem,
+	  which means the root filesystem will be read-only. It
+	  requires ISO9660 filesystem support and CDROM support in the
+	  kernel.
+
+	  However, if BR2_TARGET_ROOTFS_INITRAMFS or
+	  BR2_TARGET_ROOTFS_ISO9660_INITRD have been enabled, the
+	  ISO9660 filesystem will only contain a kernel image and
+	  optionally an external initrd image. In this case, the
+	  filesystem being in RAM, it will be read/write. No ISO9660
+	  or CDROM support is needed in the kernel.
 
 if BR2_TARGET_ROOTFS_ISO9660
 
@@ -19,6 +31,17 @@ config BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU
 	  automatically be replaced by the path to the kernel and
 	  initrd images respectively.
 
+config BR2_TARGET_ROOTFS_ISO9660_INITRD
+	bool "Use initrd"
+	default y
+	select BR2_TARGET_ROOTFS_CPIO
+	help
+	  Enable this option to have the root filesystem bundled as an
+	  initrd/initramfs rather than directly as the ISO9660
+	  filesystem. With this option enabled, the ISO9660 will only
+	  contain a kernel image, an initrd image (unless an initramfs
+	  linked into the kernel is used) and the bootloader.
+
 endif
 
 comment "iso image needs a Linux kernel to be built"
fs/iso9660/iso9660.mk +80 -23

139 lines not on this page · raw message

fs/iso9660/menu.lst +1 -1
index 8e8309f..eb1ecef 100644
@@ -12,7 +12,7 @@ foreground 	000000
 background 	cccccc
 
 title		Buildroot ISO9660 image
-kernel		__KERNEL_PATH__
+kernel		__KERNEL_PATH__ root=/dev/sr0
 initrd		__INITRD_PATH__
 
 title		Hard Drive (first partition)
Signature · 1 line
2.1.0
#34 lore raw

PATCH 8/12 fs/iso9660: support building a real iso9660 filesystem

Hi Thomas, all,

Quoted 205 lines · Thomas Petazzoni

Until now, the iso9660 filesystem handling only supported using an initrd/initramfs to store the root filesystem, which is very different from what we do with the other filesystems.

This commit changes the iso9660 logic to also allow using directly an iso9660 filesystem to store the root filesystem. A new option, BR2_TARGET_ROOTFS_ISO9660_INITRD, is created to tell the iso9660 that we want to use an initrd and not directly the root filesystem in iso9660 format. This option defaults to 'y' to preserve the existing behavior.

After this commit, we therefore have three possibilities:

* BR2_TARGET_ROOTFS_ISO9660=y, with BR2_TARGET_ROOTFS_INITRAMFS and BR2_TARGET_ROOTFS_ISO9660_INITRD disabled. In this case, the iso9660 filesystem is directly the contents of the root filesystem (since is possible thanks to the Rockridge extensions that were already enabled using the -R option of genisoimage). Obviously, it means that the root filesystem is read-only.

* BR2_TARGET_ROOTFS_ISO9660=y and BR2_TARGET_ROOTFS_INITRAMFS=y (the value of BR2_TARGET_ROOTFS_ISO9660_INITRD doesn't matter). In this case, the root filesystem is already linked into the kernel image itself, as an initramfs. So the iso9660 filesystem doesn't contain the root filesystem as is, but just the bootloader and the kernel image.

* BR2_TARGET_ROOTFS_ISO9660=y, BR2_TARGET_ROOTFS_ISO9660_INITRD=y and BR2_TARGET_ROOTFS_INITRAMFS disabled. In this case, a separate initrd is used. The iso9660 filesystem only contains the bootloader, the kernel and the initrd.

In order to support the first case out of the box, root=/dev/sr0 is added on the kernel command line in the example Grub configuration file, so that the kernel knows where the root filesystem is located. This argument is ignored when initrd/initramfs are used.

---
 fs/iso9660/Config.in  |  27 ++++++++++++-
 fs/iso9660/iso9660.mk | 103 +++++++++++++++++++++++++++++++++++++++-----------
 fs/iso9660/menu.lst   |   2 +-
 3 files changed, 106 insertions(+), 26 deletions(-)
fs/iso9660/Config.in +25 -2
index 111158b..e300fdb 100644
@@ -2,11 +2,23 @@ config BR2_TARGET_ROOTFS_ISO9660
        bool "iso image"
        depends on (BR2_i386 || BR2_x86_64)
        depends on BR2_LINUX_KERNEL
-       select BR2_TARGET_ROOTFS_CPIO
+       select BR2_LINUX_KERNEL_INSTALL_TARGET \
+              if (!BR2_TARGET_ROOTFS_ISO9660_INITRD && !BR2_TARGET_ROOTFS_INITRAMFS)
        select BR2_TARGET_GRUB
        select BR2_TARGET_GRUB_FS_ISO9660
        help
-         Build a bootable iso9660 image
+         Build a bootable ISO9660 image. By default, the root
+         filesystem is directly packed as the ISO9660 filesystem,
+         which means the root filesystem will be read-only. It
+         requires ISO9660 filesystem support and CDROM support in the
+         kernel.
+
+         However, if BR2_TARGET_ROOTFS_INITRAMFS or
+         BR2_TARGET_ROOTFS_ISO9660_INITRD have been enabled, the
+         ISO9660 filesystem will only contain a kernel image and
+         optionally an external initrd image. In this case, the
+         filesystem being in RAM, it will be read/write. No ISO9660
+         or CDROM support is needed in the kernel.
 
 if BR2_TARGET_ROOTFS_ISO9660
 
@@ -19,6 +31,17 @@ config BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU
          automatically be replaced by the path to the kernel and
          initrd images respectively.
 
+config BR2_TARGET_ROOTFS_ISO9660_INITRD
+       bool "Use initrd"
+       default y
+       select BR2_TARGET_ROOTFS_CPIO
+       help
+         Enable this option to have the root filesystem bundled as an
+         initrd/initramfs rather than directly as the ISO9660
+         filesystem. With this option enabled, the ISO9660 will only
+         contain a kernel image, an initrd image (unless an initramfs
+         linked into the kernel is used) and the bootloader.
+
 endif
 
 comment "iso image needs a Linux kernel to be built"
fs/iso9660/iso9660.mk +73 -13
index 2a8a447..a3572e2 100644
@@ -4,49 +4,104 @@
 #
 ################################################################################
 
-ROOTFS_ISO9660_TARGET_DIR = $(BUILD_DIR)/iso9660
+#
+# We need to handle three cases:
+#
+#  1. The ISO9660 filesystem will really be the real root filesystem
+#     itself. This is when BR2_TARGET_ROOTFS_ISO9660_INITRD is
+#     disabled.
+#
+#  2. The ISO9660 filesystem will be a filesystem with just a kernel
+#     image, initrd and grub. This is when
+#     BR2_TARGET_ROOTFS_ISO9660_INITRD is enabled, but
+#     BR2_TARGET_ROOTFS_INITRAMFS is disabled.
+#
+#  3. The ISO9660 filesystem will be a filesystem with just a kernel
+#     image and grub. This is like (2), except that the initrd is
+#     built into the kernel image. This is when
+#     BR2_TARGET_ROOTFS_INITRAMFS is enabled (regardless of the value
+#     of BR2_TARGET_ROOTFS_ISO9660_INITRD).
+
 ROOTFS_ISO9660_BOOT_MENU = $(call qstrip,$(BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU))
 
-ROOTFS_ISO9660_DEPENDENCIES = grub host-cdrkit host-fakeroot linux rootfs-cpio
+ROOTFS_ISO9660_DEPENDENCIES = grub host-cdrkit host-fakeroot linux
+
+ifeq ($(BR2_TARGET_ROOTFS_ISO9660_INITRD),y)
+ROOTFS_ISO9660_USE_INITRD = YES
+endif
+
+ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
+ROOTFS_ISO9660_USE_INITRD = YES
+endif
+
+ifeq ($(ROOTFS_ISO9660_USE_INITRD),YES)
+ROOTFS_ISO9660_TARGET_DIR = $(BUILD_DIR)/iso9660
+else
+ROOTFS_ISO9660_TARGET_DIR = $(TARGET_DIR)
+endif
+
+define ROOTFS_ISO9660_PREPARATION
+       $(INSTALL) -D -m 0644 $(GRUB_DIR)/stage2/stage2_eltorito \
+               $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
+       $(INSTALL) -D -m 0644 $(ROOTFS_ISO9660_BOOT_MENU) \
+               $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+       $(SED) "s%__KERNEL_PATH__%/boot/$(LINUX_IMAGE_NAME)%" \
+               $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+endef
+
+ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_PREPARATION
 
+# Splash screen disabling
 ifeq ($(BR2_TARGET_GRUB_SPLASH),)
-define ROOTFS_ISO9660_SPLASHSCREEN
+define ROOTFS_ISO9660_DISABLE_SPLASHSCREEN
        $(SED) '/^splashimage/d' $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
 endef
-else
-define ROOTFS_ISO9660_SPLASHSCREEN
+ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_DISABLE_SPLASHSCREEN
+endif
+
+define ROOTFS_ISO9660_DISABLE_EXTERNAL_INITRD
+       $(SED) '/__INITRD_PATH__/d'  $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+endef
+
+ifeq ($(ROOTFS_ISO9660_USE_INITRD),YES)
+
+# Copy splashscreen to temporary filesystem
+ifeq ($(BR2_TARGET_GRUB_SPLASH),y)
+define ROOTFS_ISO9660_INSTALL_SPLASHSCREEN
        $(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz \
                $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/splash.xpm.gz
 endef
+ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_INSTALL_SPLASHSCREEN
 endif
 
-ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
-define ROOTFS_ISO9660_INITRD
-       $(SED) '/__INITRD_PATH__/d'  $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+# Copy the kernel to temporary filesystem
+define ROOTFS_ISO9660_COPY_KERNEL
+       $(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) \
+               $(ROOTFS_ISO9660_TARGET_DIR)/boot/$(LINUX_IMAGE_NAME)
 endef
-else
-define ROOTFS_ISO9660_INITRD
+
+ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_COPY_KERNEL
+
+# Copy initrd to temporary filesystem if needed
+ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),)
+ROOTFS_ISO9660_DEPENDENCIES += rootfs-cpio
+define ROOTFS_ISO9660_COPY_INITRD
        $(INSTALL) -D -m 0644 $(BINARIES_DIR)/rootfs.cpio$(ROOTFS_CPIO_COMPRESS_EXT) \
                $(ROOTFS_ISO9660_TARGET_DIR)/boot/initrd
        $(SED) "s%__INITRD_PATH__%/boot/initrd%" \
                $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
 endef
+ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_COPY_INITRD
+else
+ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_DISABLE_EXTERNAL_INITRD
 endif
 
-define ROOTFS_ISO9660_PREPARATION
-       $(INSTALL) -D -m 0644 $(GRUB_DIR)/stage2/stage2_eltorito \
-               $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito

fs/iso9660/iso9660.mk line 99

Quoted 10 lines
fs/iso9660/iso9660.mk +1 -9
-       $(INSTALL) -D -m 0644 $(ROOTFS_ISO9660_BOOT_MENU) \
-               $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
-       $(INSTALL) -D -m 0644 $(LINUX_IMAGE_PATH) \
-               $(ROOTFS_ISO9660_TARGET_DIR)/boot/$(LINUX_IMAGE_NAME)
-       $(SED) "s%__KERNEL_PATH__%/boot/$(LINUX_IMAGE_NAME)%" \
-               $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
-       $(ROOTFS_ISO9660_SPLASHSCREEN)
-       $(ROOTFS_ISO9660_INITRD)
-endef
+else # BR2_TARGET_ROOTFS_ISO9660_INITRD

s/BR2_TARGET_ROOTFS_ISO9660_INITRD/ROOTFS_ISO9660_USE_INITRD/

fs/iso9660/iso9660.mk line 103

Quoted 4 lines
fs/iso9660/iso9660.mk +4 -0
+
+ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_DISABLE_EXTERNAL_INITRD
+
+endif # BR2_TARGET_ROOTFS_ISO9660_INITRD

s/BR2_TARGET_ROOTFS_ISO9660_INITRD/ROOTFS_ISO9660_USE_INITRD/

Quoted 34 lines
fs/iso9660/iso9660.mk +2 -1
-ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_PREPARATION
 
 define ROOTFS_ISO9660_CMD
        $(HOST_DIR)/usr/bin/genisoimage -J -R -b boot/grub/stage2_eltorito \
@@ -54,10 +109,12 @@ define ROOTFS_ISO9660_CMD
                -o $@ $(ROOTFS_ISO9660_TARGET_DIR)
 endef
 
+ifeq ($(ROOTFS_ISO9660_USE_INITRD),YES)
 define ROOTFS_ISO9660_REMOVE_TEMPDIR
        $(RM) -rf $(ROOTFS_ISO9660_TARGET_DIR)
 endef
 
 ROOTFS_ISO9660_POST_GEN_HOOKS += ROOTFS_ISO9660_REMOVE_TEMPDIR
+endif
 
 $(eval $(call ROOTFS_TARGET,iso9660))
fs/iso9660/menu.lst +1 -2
index 8e8309f..eb1ecef 100644
@@ -12,7 +12,7 @@ foreground    000000
 background     cccccc
 
 title          Buildroot ISO9660 image
-kernel         __KERNEL_PATH__
+kernel         __KERNEL_PATH__ root=/dev/sr0
 initrd         __INITRD_PATH__
 
 title          Hard Drive (first partition)
--

2.1.0

Quoted 4 lines

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

Regards,

Signature · 1 line
Samuel
#35 lore raw

PATCH 8/12 fs/iso9660: support building a real iso9660 filesystem

In reply to Thomas Petazzoni

Thomas, All,

On 2015-06-04 17:05 +0200, Thomas Petazzoni spake thusly:

Quoted 10 lines

Until now, the iso9660 filesystem handling only supported using an initrd/initramfs to store the root filesystem, which is very different from what we do with the other filesystems.

This commit changes the iso9660 logic to also allow using directly an iso9660 filesystem to store the root filesystem. A new option, BR2_TARGET_ROOTFS_ISO9660_INITRD, is created to tell the iso9660 that we want to use an initrd and not directly the root filesystem in iso9660 format. This option defaults to 'y' to preserve the existing behavior.

Besides the comments by Samuel, here are mines...

Quoted 1 line

[--SNIP--]

fs/iso9660/iso9660.mk

Quoted 4 lines
fs/iso9660/iso9660.mk +0 -0
index 2a8a447..a3572e2 100644

[--SNIP--]

fs/iso9660/iso9660.mk

Quoted 2 lines
fs/iso9660/iso9660.mk +2 -0
+ifeq ($(BR2_TARGET_ROOTFS_ISO9660_INITRD),y)
+ROOTFS_ISO9660_USE_INITRD = YES

since we're later using that in an ifeq() clause, maybe we could use 'y' here...

fs/iso9660/iso9660.mk line 34

Quoted 4 lines
fs/iso9660/iso9660.mk +4 -0
+endif
+
+ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
+ROOTFS_ISO9660_USE_INITRD = YES

... and here, so the ifeq() clause looks like the others.

I understand using 'YES' also makes it obvious this is not a kconfig option, but a Makefile variable, so I would not mind keeping 'YES' if you prefer.

fs/iso9660/iso9660.mk line 37

Quoted 3 lines
fs/iso9660/iso9660.mk +3 -0
+endif
+
+ifeq ($(ROOTFS_ISO9660_USE_INITRD),YES)

Here, we'd have:

    ifeq ($(ROOTFS_ISO9660_USE_INITRD),y)

which looks more like what we are used to.

Quoted 1 line

+ROOTFS_ISO9660_TARGET_DIR = $(BUILD_DIR)/iso9660

Maybe it would be time to move that to a differently-named directory, like:

    ROOTFS_ISO9660_TARGET_DIR = $(BUILD_DIR)/rootfs-iso9660.tmp

so it is obvious it is not (and does not conflict with) a package build directory.

And ultimately, we should really introduce a temproray, scratch location where anyone is free to drop files/directories at will without polluting $(BUILD_DIR) (the downlaod scripts would also benefit from that scratchable location, btw).

[--SNIP--]

fs/iso9660/iso9660.mk line 86

Quoted 2 lines
fs/iso9660/iso9660.mk +2 -0
+# Copy initrd to temporary filesystem if needed
+ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),)

We usually use positive logic and test against 'y', unless there's no 'else' clause. So, maybe:

    ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
    ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_DISABLE_EXTERNAL_INITRD
    else
    blabla
    endif # BR2_TARGET_ROOTFS_INITRAMFS

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
#36 lore raw

PATCH 9/12 fs/iso9660: add support for isolinux

In reply to Thomas Petazzoni

Until now, the ISO9660 image generation logic was only supporting the Grub bootloader. This commit adds support to use isolinux (from syslinux) instead of grub, as an option.

From a Config.in point of view, we switch from having BR2_TARGET_ROOTFS_ISO9660 select BR2_TARGET_GRUB to using a 'depends on'. This is because for isolinux, we would need to select BR2_TARGET_SYSLINUX_ISOLINUX, but BR2_TARGET_SYSLINUX_ISOLINUX is part of a Kconfig 'choice', so we can't do a select. So instead, the BR2_TARGET_ROOTFS_ISO9660 now depends on either BR2_TARGET_GRUB or BR2_TARGET_SYSLINUX_ISOLINUX being available.

The .mk file is re-organized a bit to be a bit more generic:

- a variable called ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH is introduced to reflect the path to the bootloader configuration file (which is later modified to replace __KERNEL_PATH__ and __INITRD_PATH__ to the appropriate values)

- a variable called ROOTFS_ISO9660_BOOT_IMAGE is introduced to give the path to the bootloader-specific boot image, as needed by genisoimage -b option.

- a variable called ROOTFS_ISO9660_INSTALL_BOOTLOADER is introduced with the commands needed to do the bootloader-specific installation steps

This patch is based on previous patches submitted by Jerome Sagnole <[email protected]> and No? Rubinstein <[email protected]>.

---
 fs/iso9660/Config.in    | 35 ++++++++++++++++++++++++++---------
 fs/iso9660/iso9660.mk   | 43 ++++++++++++++++++++++++++++++++++---------
 fs/iso9660/isolinux.cfg |  6 ++++++
 3 files changed, 66 insertions(+), 18 deletions(-)
 create mode 100644 fs/iso9660/isolinux.cfg
fs/iso9660/Config.in +26 -9
index e300fdb..e7bf3c3 100644
@@ -2,10 +2,9 @@ config BR2_TARGET_ROOTFS_ISO9660
 	bool "iso image"
 	depends on (BR2_i386 || BR2_x86_64)
 	depends on BR2_LINUX_KERNEL
+	depends on BR2_TARGET_GRUB || BR2_TARGET_SYSLINUX_ISOLINUX
 	select BR2_LINUX_KERNEL_INSTALL_TARGET \
 	       if (!BR2_TARGET_ROOTFS_ISO9660_INITRD && !BR2_TARGET_ROOTFS_INITRAMFS)
-	select BR2_TARGET_GRUB
-	select BR2_TARGET_GRUB_FS_ISO9660
 	help
 	  Build a bootable ISO9660 image. By default, the root
 	  filesystem is directly packed as the ISO9660 filesystem,
@@ -22,13 +21,30 @@ config BR2_TARGET_ROOTFS_ISO9660
 
 if BR2_TARGET_ROOTFS_ISO9660
 
+choice
+	prompt "Bootloader"
+
+config BR2_TARGET_ROOTFS_ISO9660_GRUB
+	bool "grub"
+	depends on BR2_TARGET_GRUB
+	select BR2_TARGET_GRUB_FS_ISO9660
+
+config BR2_TARGET_ROOTFS_ISO9660_ISOLINUX
+	bool "isolinux"
+	depends on BR2_TARGET_SYSLINUX_ISOLINUX
+
+endchoice
+
 config BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU
-	string "Boot menu.lst file"
-	default "fs/iso9660/menu.lst"
+	string "Bootloader configuration file"
+	default "fs/iso9660/menu.lst" if BR2_TARGET_ROOTFS_ISO9660_GRUB
+	default "fs/iso9660/isolinux.cfg" if BR2_TARGET_ROOTFS_ISO9660_ISOLINUX
 	help
-	  Use this option to provide a custom Grub menu.lst file. Note
-	  that the strings __KERNEL_PATH__ and __INITRD_PATH__ will
-	  automatically be replaced by the path to the kernel and
+	  Use this option to provide a custom bootloader configuration
+	  file (menu.lst for Grub, isolinux.cfg for Isolinux).
+
+	  Note that the strings __KERNEL_PATH__ and __INITRD_PATH__
+	  will automatically be replaced by the path to the kernel and
 	  initrd images respectively.
 
 config BR2_TARGET_ROOTFS_ISO9660_INITRD
@@ -44,6 +60,7 @@ config BR2_TARGET_ROOTFS_ISO9660_INITRD
 
 endif
 
-comment "iso image needs a Linux kernel to be built"
+comment "iso image needs a Linux kernel and grub or isolinux to be built"
 	depends on BR2_i386 || BR2_x86_64
-	depends on !BR2_LINUX_KERNEL
+	depends on !BR2_LINUX_KERNEL || \
+		!(BR2_TARGET_GRUB || BR2_TARGET_SYSLINUX_ISOLINUX)
fs/iso9660/iso9660.mk +34 -9

86 lines not on this page · raw message

fs/iso9660/isolinux.cfg new file +6 -0
new file mode 100644
index 0000000..2bdf48b
@@ -0,0 +1,6 @@
+default 1
+display sample.msg
+label 1
+      kernel __KERNEL_PATH__
+      append initrd=__INITRD_PATH__
+      append root=/dev/sr0
Signature · 1 line
2.1.0
#37 lore raw

PATCH 9/12 fs/iso9660: add support for isolinux

Hi Thomas, all,

fs/iso9660/iso9660.mk

Quoted 105 lines · Thomas Petazzoni

Until now, the ISO9660 image generation logic was only supporting the Grub bootloader. This commit adds support to use isolinux (from syslinux) instead of grub, as an option.

From a Config.in point of view, we switch from having BR2_TARGET_ROOTFS_ISO9660 select BR2_TARGET_GRUB to using a 'depends on'. This is because for isolinux, we would need to select BR2_TARGET_SYSLINUX_ISOLINUX, but BR2_TARGET_SYSLINUX_ISOLINUX is part of a Kconfig 'choice', so we can't do a select. So instead, the BR2_TARGET_ROOTFS_ISO9660 now depends on either BR2_TARGET_GRUB or BR2_TARGET_SYSLINUX_ISOLINUX being available.

The .mk file is re-organized a bit to be a bit more generic:

- a variable called ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH is introduced to reflect the path to the bootloader configuration file (which is later modified to replace __KERNEL_PATH__ and __INITRD_PATH__ to the appropriate values)

- a variable called ROOTFS_ISO9660_BOOT_IMAGE is introduced to give the path to the bootloader-specific boot image, as needed by genisoimage -b option.

- a variable called ROOTFS_ISO9660_INSTALL_BOOTLOADER is introduced with the commands needed to do the bootloader-specific installation steps

This patch is based on previous patches submitted by Jerome Sagnole <[email protected]> and No? Rubinstein <[email protected]>.

---
 fs/iso9660/Config.in    | 35 ++++++++++++++++++++++++++---------
 fs/iso9660/iso9660.mk   | 43 ++++++++++++++++++++++++++++++++++---------
 fs/iso9660/isolinux.cfg |  6 ++++++
 3 files changed, 66 insertions(+), 18 deletions(-)
 create mode 100644 fs/iso9660/isolinux.cfg
fs/iso9660/Config.in +26 -9
index e300fdb..e7bf3c3 100644
@@ -2,10 +2,9 @@ config BR2_TARGET_ROOTFS_ISO9660
        bool "iso image"
        depends on (BR2_i386 || BR2_x86_64)
        depends on BR2_LINUX_KERNEL
+       depends on BR2_TARGET_GRUB || BR2_TARGET_SYSLINUX_ISOLINUX
        select BR2_LINUX_KERNEL_INSTALL_TARGET \
               if (!BR2_TARGET_ROOTFS_ISO9660_INITRD && !BR2_TARGET_ROOTFS_INITRAMFS)
-       select BR2_TARGET_GRUB
-       select BR2_TARGET_GRUB_FS_ISO9660
        help
          Build a bootable ISO9660 image. By default, the root
          filesystem is directly packed as the ISO9660 filesystem,
@@ -22,13 +21,30 @@ config BR2_TARGET_ROOTFS_ISO9660
 
 if BR2_TARGET_ROOTFS_ISO9660
 
+choice
+       prompt "Bootloader"
+
+config BR2_TARGET_ROOTFS_ISO9660_GRUB
+       bool "grub"
+       depends on BR2_TARGET_GRUB
+       select BR2_TARGET_GRUB_FS_ISO9660
+
+config BR2_TARGET_ROOTFS_ISO9660_ISOLINUX
+       bool "isolinux"
+       depends on BR2_TARGET_SYSLINUX_ISOLINUX
+
+endchoice
+
 config BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU
-       string "Boot menu.lst file"
-       default "fs/iso9660/menu.lst"
+       string "Bootloader configuration file"
+       default "fs/iso9660/menu.lst" if BR2_TARGET_ROOTFS_ISO9660_GRUB
+       default "fs/iso9660/isolinux.cfg" if BR2_TARGET_ROOTFS_ISO9660_ISOLINUX
        help
-         Use this option to provide a custom Grub menu.lst file. Note
-         that the strings __KERNEL_PATH__ and __INITRD_PATH__ will
-         automatically be replaced by the path to the kernel and
+         Use this option to provide a custom bootloader configuration
+         file (menu.lst for Grub, isolinux.cfg for Isolinux).
+
+         Note that the strings __KERNEL_PATH__ and __INITRD_PATH__
+         will automatically be replaced by the path to the kernel and
          initrd images respectively.
 
 config BR2_TARGET_ROOTFS_ISO9660_INITRD
@@ -44,6 +60,7 @@ config BR2_TARGET_ROOTFS_ISO9660_INITRD
 
 endif
 
-comment "iso image needs a Linux kernel to be built"
+comment "iso image needs a Linux kernel and grub or isolinux to be built"
        depends on BR2_i386 || BR2_x86_64
-       depends on !BR2_LINUX_KERNEL
+       depends on !BR2_LINUX_KERNEL || \
+               !(BR2_TARGET_GRUB || BR2_TARGET_SYSLINUX_ISOLINUX)
fs/iso9660/iso9660.mk +0 -0
index a3572e2..c95485c 100644

Grub is no longer required dependency, so it should be removed from the common dependency list (line 27).

Quoted 105 lines
fs/iso9660/iso9660.mk +34 -9
@@ -40,32 +40,56 @@ else
 ROOTFS_ISO9660_TARGET_DIR = $(TARGET_DIR)
 endif
 
-define ROOTFS_ISO9660_PREPARATION
+ifeq ($(BR2_TARGET_ROOTFS_ISO9660_GRUB),y)
+ROOTFS_ISO9660_DEPENDENCIES += grub
+ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH = \
+       $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+ROOTFS_ISO9660_BOOT_IMAGE = boot/grub/stage2_eltorito
+define ROOTFS_ISO9660_INSTALL_BOOTLOADER
        $(INSTALL) -D -m 0644 $(GRUB_DIR)/stage2/stage2_eltorito \
                $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
+endef
+else ifeq ($(BR2_TARGET_ROOTFS_ISO9660_ISOLINUX),y)
+ROOTFS_ISO9660_DEPENDENCIES += syslinux
+ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH = \
+       $(ROOTFS_ISO9660_TARGET_DIR)/isolinux/isolinux.cfg
+ROOTFS_ISO9660_BOOT_IMAGE = isolinux/isolinux.bin
+define ROOTFS_ISO9660_INSTALL_BOOTLOADER
+       $(INSTALL) -D -m 0644 $(SYSLINUX_DIR)/bios/core/isolinux.bin \
+               $(ROOTFS_ISO9660_TARGET_DIR)/isolinux/isolinux.bin
+       $(INSTALL) -D -m 0644 $(SYSLINUX_DIR)/bios/com32/elflink/ldlinux/ldlinux.c32 \
+               $(ROOTFS_ISO9660_TARGET_DIR)/isolinux/ldlinux.c32
+endef
+endif
+
+define ROOTFS_ISO9660_PREPARATION
        $(INSTALL) -D -m 0644 $(ROOTFS_ISO9660_BOOT_MENU) \
-               $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+               $(ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH)
        $(SED) "s%__KERNEL_PATH__%/boot/$(LINUX_IMAGE_NAME)%" \
-               $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+               $(ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH)
+       $(ROOTFS_ISO9660_INSTALL_BOOTLOADER)
 endef
 
 ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_PREPARATION
 
-# Splash screen disabling
+# Grub splash screen disabling
+ifeq ($(BR2_TARGET_ROOTFS_ISO9660_GRUB),y)
 ifeq ($(BR2_TARGET_GRUB_SPLASH),)
 define ROOTFS_ISO9660_DISABLE_SPLASHSCREEN
-       $(SED) '/^splashimage/d' $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+       $(SED) '/^splashimage/d' $(ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH)
 endef
 ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_DISABLE_SPLASHSCREEN
 endif
+endif
 
 define ROOTFS_ISO9660_DISABLE_EXTERNAL_INITRD
-       $(SED) '/__INITRD_PATH__/d'  $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+       $(SED) '/__INITRD_PATH__/d'  $(ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH)
 endef
 
 ifeq ($(ROOTFS_ISO9660_USE_INITRD),YES)
 
-# Copy splashscreen to temporary filesystem
+# Copy Grub splashscreen to temporary filesystem
+ifeq ($(BR2_TARGET_ROOTFS_ISO9660_GRUB),y)
 ifeq ($(BR2_TARGET_GRUB_SPLASH),y)
 define ROOTFS_ISO9660_INSTALL_SPLASHSCREEN
        $(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz \
@@ -73,6 +97,7 @@ define ROOTFS_ISO9660_INSTALL_SPLASHSCREEN
 endef
 ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_INSTALL_SPLASHSCREEN
 endif
+endif
 
 # Copy the kernel to temporary filesystem
 define ROOTFS_ISO9660_COPY_KERNEL
@@ -89,7 +114,7 @@ define ROOTFS_ISO9660_COPY_INITRD
        $(INSTALL) -D -m 0644 $(BINARIES_DIR)/rootfs.cpio$(ROOTFS_CPIO_COMPRESS_EXT) \
                $(ROOTFS_ISO9660_TARGET_DIR)/boot/initrd
        $(SED) "s%__INITRD_PATH__%/boot/initrd%" \
-               $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+               $(ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH)
 endef
 ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_COPY_INITRD
 else
@@ -104,7 +129,7 @@ endif # BR2_TARGET_ROOTFS_ISO9660_INITRD
 
 
 define ROOTFS_ISO9660_CMD
-       $(HOST_DIR)/usr/bin/genisoimage -J -R -b boot/grub/stage2_eltorito \
+       $(HOST_DIR)/usr/bin/genisoimage -J -R -b $(ROOTFS_ISO9660_BOOT_IMAGE) \
                -no-emul-boot -boot-load-size 4 -boot-info-table \
                -o $@ $(ROOTFS_ISO9660_TARGET_DIR)
 endef
fs/iso9660/isolinux.cfg new file +6 -1
new file mode 100644
index 0000000..2bdf48b
@@ -0,0 +1,6 @@
+default 1
+display sample.msg
+label 1
+      kernel __KERNEL_PATH__
+      append initrd=__INITRD_PATH__
+      append root=/dev/sr0
--

2.1.0

Quoted 4 lines

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

Regards,

Signature · 1 line
Samuel
#38 lore raw

PATCH 9/12 fs/iso9660: add support for isolinux

In reply to Thomas Petazzoni

Thomas, All,

On 2015-06-04 17:05 +0200, Thomas Petazzoni spake thusly:

Quoted 19 lines

Until now, the ISO9660 image generation logic was only supporting the Grub bootloader. This commit adds support to use isolinux (from syslinux) instead of grub, as an option.

From a Config.in point of view, we switch from having BR2_TARGET_ROOTFS_ISO9660 select BR2_TARGET_GRUB to using a 'depends on'. This is because for isolinux, we would need to select BR2_TARGET_SYSLINUX_ISOLINUX, but BR2_TARGET_SYSLINUX_ISOLINUX is part of a Kconfig 'choice', so we can't do a select. So instead, the BR2_TARGET_ROOTFS_ISO9660 now depends on either BR2_TARGET_GRUB or BR2_TARGET_SYSLINUX_ISOLINUX being available.

The .mk file is re-organized a bit to be a bit more generic:

- a variable called ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH is introduced to reflect the path to the bootloader configuration file (which is later modified to replace __KERNEL_PATH__ and __INITRD_PATH__ to the appropriate values)

Quoted 7 lines

- a variable called ROOTFS_ISO9660_BOOT_IMAGE is introduced to give the path to the bootloader-specific boot image, as needed by genisoimage -b option.

- a variable called ROOTFS_ISO9660_INSTALL_BOOTLOADER is introduced with the commands needed to do the bootloader-specific installation steps

This patch is quite large, and could benefit from being splitted in three:

- first patch introduces the ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH and ROOTFS_ISO9660_BOOT_IMAGE variables

- second patch to introduce the bootloader choice, but with only a single entrey 'grub', and the .mk re-organisation (still with only grub handling),

- then a third patch adds isolinux support.

That'd make it easier to review...

Since I'm quite interested in the end-result of this series (multi-format bootable images), I can help if you don;t have time. Just ping me... ;-)

(I tried to see if previous patches could be splitted, but you already did a pretty good job at that! :-) )

Quoted 3 lines

This patch is based on previous patches submitted by Jerome Sagnole <[email protected]> and No? Rubinstein <[email protected]>.

Thanks guys! :-)

Quoted 1 line

[--SNIP--]

Quoted 18 lines
fs/iso9660/iso9660.mk +7 -1
index a3572e2..c95485c 100644
@@ -40,32 +40,56 @@ else
 ROOTFS_ISO9660_TARGET_DIR = $(TARGET_DIR)
 endif
 
-define ROOTFS_ISO9660_PREPARATION
+ifeq ($(BR2_TARGET_ROOTFS_ISO9660_GRUB),y)
+ROOTFS_ISO9660_DEPENDENCIES += grub
+ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH = \
+	$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+ROOTFS_ISO9660_BOOT_IMAGE = boot/grub/stage2_eltorito
+define ROOTFS_ISO9660_INSTALL_BOOTLOADER
 	$(INSTALL) -D -m 0644 $(GRUB_DIR)/stage2/stage2_eltorito \
 		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
+endef

fs/iso9660/iso9660.mk else · line 61

Quoted 10 lines
fs/iso9660/iso9660.mk +10 -0
+else ifeq ($(BR2_TARGET_ROOTFS_ISO9660_ISOLINUX),y)
+ROOTFS_ISO9660_DEPENDENCIES += syslinux
+ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH = \
+	$(ROOTFS_ISO9660_TARGET_DIR)/isolinux/isolinux.cfg
+ROOTFS_ISO9660_BOOT_IMAGE = isolinux/isolinux.bin
+define ROOTFS_ISO9660_INSTALL_BOOTLOADER
+	$(INSTALL) -D -m 0644 $(SYSLINUX_DIR)/bios/core/isolinux.bin \
+		$(ROOTFS_ISO9660_TARGET_DIR)/isolinux/isolinux.bin
+	$(INSTALL) -D -m 0644 $(SYSLINUX_DIR)/bios/com32/elflink/ldlinux/ldlinux.c32 \
+		$(ROOTFS_ISO9660_TARGET_DIR)/isolinux/ldlinux.c32

syslinux/isolinux already installs isolinux.bin and the .c32 modules in $(BINARIES_DIR)/syslinux, so you should probably get them from there, rather than cherry-pick from the package dir (in case a later version bump moves them, like it did when I last updated the package).

Except ldlinux.c32 is not systematically installed; we should probably change that first (what use would we have of a syslinux/isolinux that can't load a Linux kernel? :-] ).

Quoted 72 lines
fs/iso9660/iso9660.mk +17 -8
+endef
+endif
+
+define ROOTFS_ISO9660_PREPARATION
 	$(INSTALL) -D -m 0644 $(ROOTFS_ISO9660_BOOT_MENU) \
-		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+		$(ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH)
 	$(SED) "s%__KERNEL_PATH__%/boot/$(LINUX_IMAGE_NAME)%" \
-		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+		$(ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH)
+	$(ROOTFS_ISO9660_INSTALL_BOOTLOADER)
 endef
 
 ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_PREPARATION
 
-# Splash screen disabling
+# Grub splash screen disabling
+ifeq ($(BR2_TARGET_ROOTFS_ISO9660_GRUB),y)
 ifeq ($(BR2_TARGET_GRUB_SPLASH),)
 define ROOTFS_ISO9660_DISABLE_SPLASHSCREEN
-	$(SED) '/^splashimage/d' $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+	$(SED) '/^splashimage/d' $(ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH)
 endef
 ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_DISABLE_SPLASHSCREEN
 endif
+endif
 
 define ROOTFS_ISO9660_DISABLE_EXTERNAL_INITRD
-	$(SED) '/__INITRD_PATH__/d'  $(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+	$(SED) '/__INITRD_PATH__/d'  $(ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH)
 endef
 
 ifeq ($(ROOTFS_ISO9660_USE_INITRD),YES)
 
-# Copy splashscreen to temporary filesystem
+# Copy Grub splashscreen to temporary filesystem
+ifeq ($(BR2_TARGET_ROOTFS_ISO9660_GRUB),y)
 ifeq ($(BR2_TARGET_GRUB_SPLASH),y)
 define ROOTFS_ISO9660_INSTALL_SPLASHSCREEN
 	$(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz \
@@ -73,6 +97,7 @@ define ROOTFS_ISO9660_INSTALL_SPLASHSCREEN
 endef
 ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_INSTALL_SPLASHSCREEN
 endif
+endif
 
 # Copy the kernel to temporary filesystem
 define ROOTFS_ISO9660_COPY_KERNEL
@@ -89,7 +114,7 @@ define ROOTFS_ISO9660_COPY_INITRD
 	$(INSTALL) -D -m 0644 $(BINARIES_DIR)/rootfs.cpio$(ROOTFS_CPIO_COMPRESS_EXT) \
 		$(ROOTFS_ISO9660_TARGET_DIR)/boot/initrd
 	$(SED) "s%__INITRD_PATH__%/boot/initrd%" \
-		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/menu.lst
+		$(ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH)
 endef
 ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_COPY_INITRD
 else
@@ -104,7 +129,7 @@ endif # BR2_TARGET_ROOTFS_ISO9660_INITRD
 
 
 define ROOTFS_ISO9660_CMD
-	$(HOST_DIR)/usr/bin/genisoimage -J -R -b boot/grub/stage2_eltorito \
+	$(HOST_DIR)/usr/bin/genisoimage -J -R -b $(ROOTFS_ISO9660_BOOT_IMAGE) \
 		-no-emul-boot -boot-load-size 4 -boot-info-table \
 		-o $@ $(ROOTFS_ISO9660_TARGET_DIR)
 endef
fs/iso9660/isolinux.cfg new file +0 -0
new file mode 100644
index 0000000..2bdf48b

fs/iso9660/isolinux.cfg line 2

Quoted 2 lines
fs/iso9660/isolinux.cfg new file +2 -0
@@ -0,0 +1,6 @@
+default 1
+display sample.msg

Where's that file comming from?

Also, there is the possibility for syslinux/isolinux to display graphics, too, but it is much more invvolved (but that'd be great!)

Regards,
Yann E. MORIN.

Quoted 11 lines
fs/iso9660/isolinux.cfg new file +4 -0
+label 1
+      kernel __KERNEL_PATH__
+      append initrd=__INITRD_PATH__
+      append root=/dev/sr0
Signature · 6 lines
2.1.0

_______________________________________________
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.  |
'------------------------------^-------^------------------^--------------------'
#39 lore raw

PATCH 9/12 fs/iso9660: add support for isolinux

Yann,

Quoted 5 lines · Yann E. MORIN

This patch is quite large, and could benefit from being splitted in three:

- first patch introduces the ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH and ROOTFS_ISO9660_BOOT_IMAGE variables

Quoted 7 lines

- second patch to introduce the bootloader choice, but with only a single entrey 'grub', and the .mk re-organisation (still with only grub handling),

- then a third patch adds isolinux support.

That'd make it easier to review...

True, this seems like a good split. I'll work on that.

Quoted 3 lines

Since I'm quite interested in the end-result of this series (multi-format bootable images), I can help if you don;t have time. Just ping me... ;-)

Actually, your review is arriving at exactly the right time. I'm having a 10+ hours flight tomorrow, which will be a perfect opportunity to prepare a v2 of this series.

I did the v1 on the 10+ hours flight to go, so having something to do on the return trip is great.

Quoted 11 lines

fs/iso9660/iso9660.mk else · line 61

Quoted 2 lines
fs/iso9660/iso9660.mk +2 -0
+	$(INSTALL) -D -m 0644 $(SYSLINUX_DIR)/bios/com32/elflink/ldlinux/ldlinux.c32 \
+		$(ROOTFS_ISO9660_TARGET_DIR)/isolinux/ldlinux.c32

syslinux/isolinux already installs isolinux.bin and the .c32 modules in $(BINARIES_DIR)/syslinux, so you should probably get them from there, rather than cherry-pick from the package dir (in case a later version bump moves them, like it did when I last updated the package).

Except ldlinux.c32 is not systematically installed; we should probably change that first (what use would we have of a syslinux/isolinux that can't load a Linux kernel? :-] ).

True, will change.

Quoted 11 lines

fs/iso9660/isolinux.cfg line 2

Quoted 8 lines
fs/iso9660/isolinux.cfg new file +2 -0
new file mode 100644
index 0000000..2bdf48b
@@ -0,0 +1,6 @@
+default 1
+display sample.msg

Where's that file comming from?

Quoted 2 lines

Also, there is the possibility for syslinux/isolinux to display graphics, too, but it is much more invvolved (but that'd be great!)

The precise reason why there is this leftover "display sample.msg" is because I tried to get the splash image support of isolinux to work. I didn't succeed and gave up (no Internet access while flying, so I was limited to just the isolinux documentation and source code) but forgot to kill that line. I'll kill it off for now, until someone interested enough in having a splash image with isolinux works on that.

Thanks again for the review!

Thomas

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

PATCH 9/12 fs/iso9660: add support for isolinux

Thomas, All,

On 2015-06-06 03:03 +0200, Thomas Petazzoni spake thusly:

Quoted 11 lines · Yann E. MORIN
Quoted 3 lines

Since I'm quite interested in the end-result of this series (multi-format bootable images), I can help if you don;t have time. Just ping me... ;-)

Actually, your review is arriving at exactly the right time. I'm having a 10+ hours flight tomorrow, which will be a perfect opportunity to prepare a v2 of this series.

I did the v1 on the 10+ hours flight to go, so having something to do on the return trip is great.

Happy flight! ;-)

Quoted 14 lines
Quoted 11 lines

fs/iso9660/isolinux.cfg line 2

Quoted 8 lines
fs/iso9660/isolinux.cfg new file +2 -0
new file mode 100644
index 0000000..2bdf48b
@@ -0,0 +1,6 @@
+default 1
+display sample.msg

Where's that file comming from?

Quoted 2 lines

Also, there is the possibility for syslinux/isolinux to display graphics, too, but it is much more invvolved (but that'd be great!)

Quoted 6 lines

The precise reason why there is this leftover "display sample.msg" is because I tried to get the splash image support of isolinux to work. I didn't succeed and gave up (no Internet access while flying, so I was limited to just the isolinux documentation and source code) but forgot to kill that line. I'll kill it off for now, until someone interested enough in having a splash image with isolinux works on that.

Yeah, I tried a lng time ago, and it was not easy. Hopefully, things have changed since then, but that can indeed be left as an exercise for the interested party! :-]

I'm not too fond of splahscreens in the bootloader anyway, so I won't press for that. I really prefer to have a quick boot that gives me a running kernel as fast as possible, so I can get access to the framebuffer from userland, and splash an image early in the boot process from userland. Bootloader-born splashscreen is for those that can't do fast boot! Hehehe! :-]

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
#41 lore raw

PATCH 10/12 fs/iso9660: add hybrid image support

In reply to Thomas Petazzoni

This commit adds a new option, which allows, when isolinux is used as the bootloader, to generate an "hybrid" ISO image. Such images can either be booted from CD-ROM or from USB keys. It simply uses the isohybrid tool provided by syslinux.

---
 fs/iso9660/Config.in  | 9 +++++++++
 fs/iso9660/iso9660.mk | 8 ++++++++
 2 files changed, 17 insertions(+)
fs/iso9660/Config.in +9 -0
index e7bf3c3..1b1f090 100644
@@ -58,6 +58,15 @@ config BR2_TARGET_ROOTFS_ISO9660_INITRD
 	  contain a kernel image, an initrd image (unless an initramfs
 	  linked into the kernel is used) and the bootloader.
 
+config BR2_TARGET_ROOTFS_ISO9660_HYBRID
+	bool "Build hybrid image"
+	depends on BR2_TARGET_ROOTFS_ISO9660_ISOLINUX
+	help
+	  Enable this option to build an hybrid image, i.e an image
+	  which can either be booted from a CD-ROM or from a device
+	  which BIOS considers a hard disk or ZIP disk, e.g. a USB key
+	  or similar.
+
 endif
 
 comment "iso image needs a Linux kernel and grub or isolinux to be built"
fs/iso9660/iso9660.mk +8 -0
index c95485c..792a770 100644
@@ -142,4 +142,12 @@ endef
 ROOTFS_ISO9660_POST_GEN_HOOKS += ROOTFS_ISO9660_REMOVE_TEMPDIR
 endif
 
+ifeq ($(BR2_TARGET_ROOTFS_ISO9660_HYBRID),y)
+define ROOTFS_ISO9660_GEN_HYBRID
+	$(HOST_DIR)/usr/bin/isohybrid $@
+endef
+
+ROOTFS_ISO9660_POST_GEN_HOOKS += ROOTFS_ISO9660_GEN_HYBRID
+endif
+
 $(eval $(call ROOTFS_TARGET,iso9660))
Signature · 1 line
2.1.0
#42 lore raw

PATCH 10/12 fs/iso9660: add hybrid image support

Thomas, all,

Quoted 6 lines · Thomas Petazzoni

This commit adds a new option, which allows, when isolinux is used as the bootloader, to generate an "hybrid" ISO image. Such images can either be booted from CD-ROM or from USB keys. It simply uses the isohybrid tool provided by syslinux.

Regards,

Signature · 1 line
Samuel
#43 lore raw

PATCH 10/12 fs/iso9660: add hybrid image support

In reply to Thomas Petazzoni

Thomas, All,

On 2015-06-04 17:05 +0200, Thomas Petazzoni spake thusly:

Quoted 6 lines

This commit adds a new option, which allows, when isolinux is used as the bootloader, to generate an "hybrid" ISO image. Such images can either be booted from CD-ROM or from USB keys. It simply uses the isohybrid tool provided by syslinux.

However, a comment, below...

fs/iso9660/iso9660.mk endef · line 147

Quoted 11 lines
fs/iso9660/iso9660.mk +3 -0
index c95485c..792a770 100644
@@ -142,4 +142,12 @@ endef
 ROOTFS_ISO9660_POST_GEN_HOOKS += ROOTFS_ISO9660_REMOVE_TEMPDIR
 endif
 
+ifeq ($(BR2_TARGET_ROOTFS_ISO9660_HYBRID),y)
+define ROOTFS_ISO9660_GEN_HYBRID
+	$(HOST_DIR)/usr/bin/isohybrid $@

The default partition type is 0x17, which is nothing very interesting. What about setting it to 0x96 instead, which is 'ISO-9660 file system':

https://en.wikipedia.org/wiki/Partition_type

Regards,
Yann E. MORIN.

Quoted 13 lines
fs/iso9660/iso9660.mk +5 -0
+endef
+
+ROOTFS_ISO9660_POST_GEN_HOOKS += ROOTFS_ISO9660_GEN_HYBRID
+endif
+
 $(eval $(call ROOTFS_TARGET,iso9660))
Signature · 6 lines
2.1.0

_______________________________________________
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.  |
'------------------------------^-------^------------------^--------------------'
#44 lore raw

PATCH 11/12 grub2: prepare and install El Torito image

In reply to Thomas Petazzoni

In order to support ISO9660 bootable images that rely on Grub 2, this commit modifies thr Grub 2 makefile to generate and install an El Torito image. Such an image is simply produced by concatenating the cdboot.img provided by Grub 2, and the Grub 2 image generated by Buildroot using grub-mkimage.

Since this action is so simple and cost-free, we don't bother adding a Grub 2 sub-option for that, and simply generate the El Torito image unconditionally.

---
 boot/grub2/grub2.mk | 2 ++
 1 file changed, 2 insertions(+)
boot/grub2/grub2.mk +2 -0
index 697f0ad..dd04bb3 100644
@@ -76,6 +76,8 @@ define GRUB2_IMAGE_INSTALLATION
 		-p "$(GRUB2_PREFIX)" \
 		$(if $(GRUB2_BUILTIN_CONFIG),-c $(GRUB2_BUILTIN_CONFIG)) \
 		$(GRUB2_BUILTIN_MODULES)
+	cat $(HOST_DIR)/usr/lib/grub/$(GRUB2_TUPLE)/cdboot.img \
+		$(GRUB2_IMAGE) > $(HOST_DIR)/usr/lib/grub/$(GRUB2_TUPLE)/grub-eltorito.img
 	mkdir -p $(dir $(GRUB2_CFG))
 	$(INSTALL) -D -m 0644 boot/grub2/grub.cfg $(GRUB2_CFG)
 endef
Signature · 1 line
2.1.0
#45 lore raw

PATCH 11/12 grub2: prepare and install El Torito image

Thomas, all,

Quoted 2 lines · Thomas Petazzoni

In order to support ISO9660 bootable images that rely on Grub 2, this commit modifies thr Grub 2 makefile to generate and install an El

s/thr/the/

Quoted 9 lines

Torito image. Such an image is simply produced by concatenating the cdboot.img provided by Grub 2, and the Grub 2 image generated by Buildroot using grub-mkimage.

Since this action is so simple and cost-free, we don't bother adding a Grub 2 sub-option for that, and simply generate the El Torito image unconditionally.

Regards,

Signature · 1 line
Samuel
#46 lore raw

PATCH 11/12 grub2: prepare and install El Torito image

In reply to Thomas Petazzoni

Thomas, All,

On 2015-06-04 17:05 +0200, Thomas Petazzoni spake thusly:

Quoted 20 lines

In order to support ISO9660 bootable images that rely on Grub 2, this commit modifies thr Grub 2 makefile to generate and install an El Torito image. Such an image is simply produced by concatenating the cdboot.img provided by Grub 2, and the Grub 2 image generated by Buildroot using grub-mkimage.

Since this action is so simple and cost-free, we don't bother adding a Grub 2 sub-option for that, and simply generate the El Torito image unconditionally.

---
 boot/grub2/grub2.mk | 2 ++
 1 file changed, 2 insertions(+)
boot/grub2/grub2.mk +0 -0
index 697f0ad..dd04bb3 100644

boot/grub2/grub2.mk define GRUB2_IMAGE_INSTALLATION · line 80

Quoted 5 lines
boot/grub2/grub2.mk +2 -0
@@ -76,6 +76,8 @@ define GRUB2_IMAGE_INSTALLATION
 		-p "$(GRUB2_PREFIX)" \
 		$(if $(GRUB2_BUILTIN_CONFIG),-c $(GRUB2_BUILTIN_CONFIG)) \
 		$(GRUB2_BUILTIN_MODULES)
+	cat $(HOST_DIR)/usr/lib/grub/$(GRUB2_TUPLE)/cdboot.img \
+		$(GRUB2_IMAGE) > $(HOST_DIR)/usr/lib/grub/$(GRUB2_TUPLE)/grub-eltorito.img

Purely cosmetic comment: since we anyway have long lines, I'd rather see the two input file on the same line, like:

    cat $(HOST_DIR)/usr/lib/grub/$(GRUB2_TUPLE)/cdboot.img $(GRUB2_IMAGE) \
        > $(HOST_DIR)/usr/lib/grub/$(GRUB2_TUPLE)/grub-eltorito.img

Otherwise:

Regards,
Yann E. MORIN.

Quoted 10 lines
boot/grub2/grub2.mk +0 -0
 	mkdir -p $(dir $(GRUB2_CFG))
 	$(INSTALL) -D -m 0644 boot/grub2/grub.cfg $(GRUB2_CFG)
 endef
Signature · 6 lines
2.1.0

_______________________________________________
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.  |
'------------------------------^-------^------------------^--------------------'
#47 lore raw

PATCH 11/12 grub2: prepare and install El Torito image

In reply to Thomas Petazzoni

Thomas, All,

On 2015-06-04 17:05 +0200, Thomas Petazzoni spake thusly:

Quoted 20 lines

In order to support ISO9660 bootable images that rely on Grub 2, this commit modifies thr Grub 2 makefile to generate and install an El Torito image. Such an image is simply produced by concatenating the cdboot.img provided by Grub 2, and the Grub 2 image generated by Buildroot using grub-mkimage.

Since this action is so simple and cost-free, we don't bother adding a Grub 2 sub-option for that, and simply generate the El Torito image unconditionally.

---
 boot/grub2/grub2.mk | 2 ++
 1 file changed, 2 insertions(+)
boot/grub2/grub2.mk +0 -0
index 697f0ad..dd04bb3 100644

boot/grub2/grub2.mk define GRUB2_IMAGE_INSTALLATION · line 80

Quoted 5 lines
boot/grub2/grub2.mk +2 -0
@@ -76,6 +76,8 @@ define GRUB2_IMAGE_INSTALLATION
 		-p "$(GRUB2_PREFIX)" \
 		$(if $(GRUB2_BUILTIN_CONFIG),-c $(GRUB2_BUILTIN_CONFIG)) \
 		$(GRUB2_BUILTIN_MODULES)
+	cat $(HOST_DIR)/usr/lib/grub/$(GRUB2_TUPLE)/cdboot.img \
+		$(GRUB2_IMAGE) > $(HOST_DIR)/usr/lib/grub/$(GRUB2_TUPLE)/grub-eltorito.img

In retrospect, I think you should install that in $(BINARIES_DIR), like is done for $(GRUB2_IMAGE), not in $(HOST_DIR).

Regards,
Yann E. MORIN.

Quoted 10 lines
boot/grub2/grub2.mk +0 -0
 	mkdir -p $(dir $(GRUB2_CFG))
 	$(INSTALL) -D -m 0644 boot/grub2/grub.cfg $(GRUB2_CFG)
 endef
Signature · 6 lines
2.1.0

_______________________________________________
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.  |
'------------------------------^-------^------------------^--------------------'
#48 lore raw

PATCH 11/12 grub2: prepare and install El Torito image

Dear Yann E. MORIN,

Quoted 5 lines · Yann E. MORIN
Quoted 5 lines
boot/grub2/grub2.mk +0 -0
index 697f0ad..dd04bb3 100644
@@ -76,6 +76,8 @@ define GRUB2_IMAGE_INSTALLATION
Quoted 8 lines

boot/grub2/grub2.mk define GRUB2_IMAGE_INSTALLATION · line 80

Quoted 5 lines
boot/grub2/grub2.mk +2 -0
 		-p "$(GRUB2_PREFIX)" \
 		$(if $(GRUB2_BUILTIN_CONFIG),-c $(GRUB2_BUILTIN_CONFIG)) \
 		$(GRUB2_BUILTIN_MODULES)
+	cat $(HOST_DIR)/usr/lib/grub/$(GRUB2_TUPLE)/cdboot.img \
+		$(GRUB2_IMAGE) > $(HOST_DIR)/usr/lib/grub/$(GRUB2_TUPLE)/grub-eltorito.img

In retrospect, I think you should install that in $(BINARIES_DIR), like is done for $(GRUB2_IMAGE), not in $(HOST_DIR).

Well, I had a reason to install it in HOST_DIR rather than BINARIES_DIR. Since I'm producing this image unconditionally, even if the user is not interested in ISO9660, I didn't want to clutter BINARIES_DIR with this file, which would appear as soon as the user enables grub2. So I preferred to install it together with all the other "internal" Grub images in HOST_DIR, and pick it up from there in the iso9660.mk logic.

Now, if you think cluttering BINARIES_DIR with this file only useful for ISO booting as soon as Grub 2 is enabled is fine, then I'll happily change it.

Thanks for the review!

Thomas

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

PATCH 11/12 grub2: prepare and install El Torito image

Thomas, All,

On 2015-06-06 02:57 +0200, Thomas Petazzoni spake thusly:

Quoted 24 lines · Yann E. MORIN
Quoted 14 lines

boot/grub2/grub2.mk define GRUB2_IMAGE_INSTALLATION · line 80

Quoted 11 lines
boot/grub2/grub2.mk +2 -0
index 697f0ad..dd04bb3 100644
@@ -76,6 +76,8 @@ define GRUB2_IMAGE_INSTALLATION
 		-p "$(GRUB2_PREFIX)" \
 		$(if $(GRUB2_BUILTIN_CONFIG),-c $(GRUB2_BUILTIN_CONFIG)) \
 		$(GRUB2_BUILTIN_MODULES)
+	cat $(HOST_DIR)/usr/lib/grub/$(GRUB2_TUPLE)/cdboot.img \
+		$(GRUB2_IMAGE) > $(HOST_DIR)/usr/lib/grub/$(GRUB2_TUPLE)/grub-eltorito.img

In retrospect, I think you should install that in $(BINARIES_DIR), like is done for $(GRUB2_IMAGE), not in $(HOST_DIR).

Well, I had a reason to install it in HOST_DIR rather than BINARIES_DIR. Since I'm producing this image unconditionally, even if the user is not interested in ISO9660, I didn't want to clutter BINARIES_DIR with this file, which would appear as soon as the user enables grub2. So I preferred to install it together with all the other "internal" Grub images in HOST_DIR, and pick it up from there in the iso9660.mk logic.

Quoted 3 lines

Now, if you think cluttering BINARIES_DIR with this file only useful for ISO booting as soon as Grub 2 is enabled is fine, then I'll happily change it.

Well, yes, I'd prefer that's what we do, for these reasons:

- first, that file is really small,

- second, we already do that for other bootloaders (like rpi-firmware),

- finally, we never said we only installed only the strictly minimum set of files,

- if the user really does not want it, there's still the post-build scripts to remove that extra file.

Quoted 1 line

Thanks for the review!

My pleasure! :-)

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
#50 lore raw

PATCH 12/12 fs/iso9660: add support for grub2

In reply to Thomas Petazzoni

After having extended the iso9660 support to allow isolinux as an alternative to grub, this commit adds grub2 as a third alternative. With the previous work done to support isolinux, adding support for grub2 is fairly trivial.

---
 fs/iso9660/Config.in  | 18 +++++++++++++++---
 fs/iso9660/grub.cfg   |  7 +++++++
 fs/iso9660/iso9660.mk |  9 +++++++++
 3 files changed, 31 insertions(+), 3 deletions(-)
 create mode 100644 fs/iso9660/grub.cfg
fs/iso9660/Config.in +15 -3
index 1b1f090..0bd09b9 100644
@@ -2,7 +2,9 @@ config BR2_TARGET_ROOTFS_ISO9660
 	bool "iso image"
 	depends on (BR2_i386 || BR2_x86_64)
 	depends on BR2_LINUX_KERNEL
-	depends on BR2_TARGET_GRUB || BR2_TARGET_SYSLINUX_ISOLINUX
+	depends on BR2_TARGET_GRUB || \
+		BR2_TARGET_GRUB2 || \
+		BR2_TARGET_SYSLINUX_ISOLINUX
 	select BR2_LINUX_KERNEL_INSTALL_TARGET \
 	       if (!BR2_TARGET_ROOTFS_ISO9660_INITRD && !BR2_TARGET_ROOTFS_INITRAMFS)
 	help
@@ -29,6 +31,15 @@ config BR2_TARGET_ROOTFS_ISO9660_GRUB
 	depends on BR2_TARGET_GRUB
 	select BR2_TARGET_GRUB_FS_ISO9660
 
+config BR2_TARGET_ROOTFS_ISO9660_GRUB2
+	bool "grub2"
+	depends on BR2_TARGET_GRUB2
+	help
+	  Use Grub 2 as the bootloader for the ISO9660 image. Make
+	  sure to enable the 'iso9660' module in
+	  BR2_TARGET_GRUB2_BUILTIN_MODULES and to use 'cd' as the boot
+	  partition in BR2_TARGET_GRUB2_BOOT_PARTITION=.
+
 config BR2_TARGET_ROOTFS_ISO9660_ISOLINUX
 	bool "isolinux"
 	depends on BR2_TARGET_SYSLINUX_ISOLINUX
@@ -38,6 +49,7 @@ endchoice
 config BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU
 	string "Bootloader configuration file"
 	default "fs/iso9660/menu.lst" if BR2_TARGET_ROOTFS_ISO9660_GRUB
+	default "fs/iso9660/grub.cfg" if BR2_TARGET_ROOTFS_ISO9660_GRUB2
 	default "fs/iso9660/isolinux.cfg" if BR2_TARGET_ROOTFS_ISO9660_ISOLINUX
 	help
 	  Use this option to provide a custom bootloader configuration
@@ -69,7 +81,7 @@ config BR2_TARGET_ROOTFS_ISO9660_HYBRID
 
 endif
 
-comment "iso image needs a Linux kernel and grub or isolinux to be built"
+comment "iso image needs a Linux kernel and grub(2) or isolinux to be built"
 	depends on BR2_i386 || BR2_x86_64
 	depends on !BR2_LINUX_KERNEL || \
-		!(BR2_TARGET_GRUB || BR2_TARGET_SYSLINUX_ISOLINUX)
+		!(BR2_TARGET_GRUB || BR2_TARGET_GRUB2 || BR2_TARGET_SYSLINUX_ISOLINUX)
fs/iso9660/grub.cfg new file +7 -0
new file mode 100644
index 0000000..b8329c3
@@ -0,0 +1,7 @@
+set default="0"
+set timeout="5"
+
+menuentry "Buildroot" {
+	linux __KERNEL_PATH__ root=/dev/sr0 console=tty1
+	initrd __INITRD_PATH__
+}
fs/iso9660/iso9660.mk +9 -0
index 792a770..9378d50 100644
@@ -49,6 +49,15 @@ define ROOTFS_ISO9660_INSTALL_BOOTLOADER
 	$(INSTALL) -D -m 0644 $(GRUB_DIR)/stage2/stage2_eltorito \
 		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/stage2_eltorito
 endef
+else ifeq ($(BR2_TARGET_ROOTFS_ISO9660_GRUB2),y)
+ROOTFS_ISO9660_DEPENDENCIES += grub2
+ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH = \
+	$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/grub.cfg
+ROOTFS_ISO9660_BOOT_IMAGE = boot/grub/grub-eltorito.img
+define ROOTFS_ISO9660_INSTALL_BOOTLOADER
+	$(INSTALL) -D -m 0644 $(HOST_DIR)/usr/lib/grub/$(GRUB2_TUPLE)/grub-eltorito.img \
+		$(ROOTFS_ISO9660_TARGET_DIR)/boot/grub/grub-eltorito.img
+endef
 else ifeq ($(BR2_TARGET_ROOTFS_ISO9660_ISOLINUX),y)
 ROOTFS_ISO9660_DEPENDENCIES += syslinux
 ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH = \
Signature · 1 line
2.1.0
#51 lore raw

PATCH 12/12 fs/iso9660: add support for grub2

Thomas, all,

Quoted 6 lines · Thomas Petazzoni

After having extended the iso9660 support to allow isolinux as an alternative to grub, this commit adds grub2 as a third alternative. With the previous work done to support isolinux, adding support for grub2 is fairly trivial.

Regards,

Signature · 1 line
Samuel
#52 lore raw

PATCH 12/12 fs/iso9660: add support for grub2

In reply to Thomas Petazzoni

Thomas, All,

On 2015-06-04 17:05 +0200, Thomas Petazzoni spake thusly:

Quoted 6 lines

After having extended the iso9660 support to allow isolinux as an alternative to grub, this commit adds grub2 as a third alternative. With the previous work done to support isolinux, adding support for grub2 is fairly trivial.

[--SNIP--]

fs/iso9660/Config.in config BR2_TARGET_ROOTFS_ISO9660_HYBRID · line 84

Quoted 2 lines
fs/iso9660/Config.in +1 -1
-comment "iso image needs a Linux kernel and grub or isolinux to be built"
+comment "iso image needs a Linux kernel and grub(2) or isolinux to be built"

I ghave to admit that reading this comment using the usual associativity of 'and' and 'or' makes it sound that we either want
- a kernel and grub/grub2,
- or isolinux

/me should sometime go back to the real world! :-]

fs/iso9660/grub.cfg line 5

Quoted 11 lines
fs/iso9660/grub.cfg new file +5 -0
new file mode 100644
index 0000000..b8329c3
@@ -0,0 +1,7 @@
+set default="0"
+set timeout="5"
+
+menuentry "Buildroot" {
+	linux __KERNEL_PATH__ root=/dev/sr0 console=tty1

Why do you forcibly pass the console setting?

fs/iso9660/grub.cfg line 7

Quoted 2 lines
fs/iso9660/grub.cfg new file +2 -0
+	initrd __INITRD_PATH__
+}

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
#53 lore raw

PATCH 12/12 fs/iso9660: add support for grub2

Dear Yann E. MORIN,

Quoted 7 lines · Yann E. MORIN

fs/iso9660/Config.in config BR2_TARGET_ROOTFS_ISO9660_HYBRID · line 84

Quoted 2 lines
fs/iso9660/Config.in +1 -1
-comment "iso image needs a Linux kernel and grub or isolinux to be built"
+comment "iso image needs a Linux kernel and grub(2) or isolinux to be built"

I ghave to admit that reading this comment using the usual associativity of 'and' and 'or' makes it sound that we either want
- a kernel and grub/grub2,
- or isolinux

True. Any suggestion to improve that?

comment "iso image needs (a Linux kernel && (grub(2) || isolinux))"

is probably a bit hard to read, no ? :-)

Quoted 4 lines

fs/iso9660/grub.cfg line 5

Quoted 2 lines
fs/iso9660/grub.cfg new file +2 -0
+menuentry "Buildroot" {
+	linux __KERNEL_PATH__ root=/dev/sr0 console=tty1

Why do you forcibly pass the console setting?

That's a good question. We don't have that for the grub and isolinux case, so I'm not sure why I added that for the grub2 case. I'll kill that and retest. Thanks for noticing!

Thomas

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

PATCH 12/12 fs/iso9660: add support for grub2

Thomas, All,

On 2015-06-06 02:59 +0200, Thomas Petazzoni spake thusly:

Quoted 12 lines

Dear Yann E. MORIN,

Quoted 7 lines · Yann E. MORIN

fs/iso9660/Config.in config BR2_TARGET_ROOTFS_ISO9660_HYBRID · line 84

Quoted 2 lines
fs/iso9660/Config.in +1 -1
-comment "iso image needs a Linux kernel and grub or isolinux to be built"
+comment "iso image needs a Linux kernel and grub(2) or isolinux to be built"

I ghave to admit that reading this comment using the usual associativity of 'and' and 'or' makes it sound that we either want
- a kernel and grub/grub2,
- or isolinux

Quoted 5 lines

True. Any suggestion to improve that?

comment "iso image needs (a Linux kernel && (grub(2) || isolinux))"

is probably a bit hard to read, no ? :-)

iso image needs a Linux kernel and one of grub, grub2 or isolinux

Quoted 8 lines
Quoted 4 lines

fs/iso9660/grub.cfg line 5

Quoted 2 lines
fs/iso9660/grub.cfg new file +2 -0
+menuentry "Buildroot" {
+	linux __KERNEL_PATH__ root=/dev/sr0 console=tty1

Why do you forcibly pass the console setting?

That's a good question. We don't have that for the grub and isolinux case, so I'm not sure why I added that for the grub2 case. I'll kill that and retest. Thanks for noticing!

He! :-)

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'