Skip to contentSkip to conversation

support for mini initramfs and added iso9660 improvements

PATCH New heiko at zuerker.org 2 participants 4 messages Dec 5, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support for mini initramfs and added iso9660 improvements

From: Heiko Zuerker <[email protected]>

Additionally, a small initramfs is now supported in order to initialize the system (like initrd).
iso9660 images has now many additional options, like the isolinux boot loader, use of the mini-initramfs for initialization and zisofs support.

---
 fs/initramfs/Config.in    |   25 ++++++++++++++++++++-----
 fs/initramfs/initramfs.mk |   41 ++++++++++++++++++++++++++++++++---------
 fs/iso9660/Config.in      |   16 ++++++++++++++++
 fs/iso9660/iso9660.mk     |   37 ++++++++++++++++++++++++++++++++++---
 4 files changed, 102 insertions(+), 17 deletions(-)
fs/initramfs/Config.in +20 -5
index 52f98f7..f8462f5 100644
@@ -2,6 +2,9 @@ config BR2_TARGET_DO_INITRAMFS
 	bool "initramfs for initial ramdisk of linux kernel"
 	depends on BR2_LINUX_KERNEL
 
+menu "initramfs options"
+depends on BR2_TARGET_DO_INITRAMFS
+
 choice
 	prompt "initramfs type"
 	default BR2_TARGET_ROOTFS_INITRAMFS
@@ -26,7 +29,7 @@ config BR2_TARGET_ROOTFS_INITRAMFS
 	  identical root filesystems, one embedded inside the kernel
 	  image, and one separatly.
 
-config BR2_TARGET_MINIMAL_INITRAMFS
+config BR2_TARGET_ROOTFS_MINI_INITRAMFS
 	bool "minimal"
 	help
 	  Only create a minimal initramfs to prepare system for boot.
@@ -34,10 +37,10 @@ config BR2_TARGET_MINIMAL_INITRAMFS
 
 endchoice
 
-config BR2_TARGET_MINIMAL_INITRAMFS_COPYLIST
+config BR2_TARGET_ROOTFS_MINI_INITRAMFS_COPYLIST
 	string "List with files to be copied"
 	depends on BR2_TARGET_DO_INITRAMFS
-	depends on BR2_TARGET_MINIMAL_INITRAMFS
+	depends on BR2_TARGET_ROOTFS_MINI_INITRAMFS
 	default ""
 	help
 	  The contents of this file list the files and directories
@@ -45,10 +48,10 @@ config BR2_TARGET_MINIMAL_INITRAMFS_COPYLIST
 	  All path names are relativ to the output/target directory.
 	  This is an optional parameter.
 
-config BR2_TARGET_MINIMAL_INITRAMFS_SKELETON
+config BR2_TARGET_ROOTFS_MINI_INITRAMFS_SKELETON
 	string "initramfs skeleton"
 	depends on BR2_TARGET_DO_INITRAMFS
-	depends on BR2_TARGET_MINIMAL_INITRAMFS
+	depends on BR2_TARGET_ROOTFS_MINI_INITRAMFS
 	default ""
 	help
 	  A skeleton directory which is copied before any files
@@ -56,5 +59,17 @@ config BR2_TARGET_MINIMAL_INITRAMFS_SKELETON
 	  directory structure.
 	  This is an optional parameter.
 
+config BR2_TARGET_ROOTFS_MINI_INITRAMFS_INSTALL_BUSYBOX
+	bool "copy and install busybox"
+	depends on BR2_TARGET_DO_INITRAMFS
+	depends on BR2_TARGET_ROOTFS_MINI_INITRAMFS
+	help
+	  Copy the busybox binary into the initramfs and create all
+	  symlinks.
+	  Busybox should be statically compiled for this.
+
+endmenu
+	  
 comment "initramfs requires a Linux kernel to be built"
 	depends on !BR2_LINUX_KERNEL
+
fs/initramfs/initramfs.mk +32 -9

58 lines not on this page · raw message

fs/iso9660/Config.in +16 -0
index f8118ce..2e4c375 100644
@@ -5,6 +5,9 @@ config BR2_TARGET_ROOTFS_ISO9660
 	help
 	  Build a bootable iso9660 image
 
+menu "iso image options"
+depends on BR2_TARGET_ROOTFS_ISO9660
+
 choice
 	prompt "Bootloader"
 	default BR2_TARGET_ROOTFS_ISO9660_BOOTLOADER_ISOLINUX
@@ -34,7 +37,20 @@ config BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU
 
 config BR2_TARGET_ROOTFS_ISO9660_COPY_INITRAMFS
 	bool "copy initramfs into /boot"
+	select BR2_TARGET_DO_INITRAMFS
+	select BR2_PACKAGE_BUSYBOX
+	depends on BR2_TARGET_ROOTFS_ISO9660_BOOTLOADER_ISOLINUX
+
+config BR2_TARGET_ROOTFS_ISO9660_COMPRESS
+	bool "compress ISO image contents"
+	depends on BR2_TARGET_DO_INITRAMFS
 	depends on BR2_TARGET_ROOTFS_ISO9660_BOOTLOADER_ISOLINUX
+	help
+		Compresses the contents of the ISO image via mkzftree, creating
+		a ZISOFS.
+		You'll need a kernel with the CONFIG_ZISOFS option enabled.
 
+endmenu
+	
 comment "iso image requires a Linux kernel to be built"
 	depends on (BR2_i386 || BR2_x86_64) && !BR2_LINUX_KERNEL
fs/iso9660/iso9660.mk +34 -3
index 83b4cef..2a92497 100644
@@ -15,6 +15,7 @@ ifeq ($(BR2_TARGET_ROOTFS_ISO9660_SQUASH),y)
 ISO9660_OPTS+=-U
 endif
 
+### using grub as a boot loader and using the ext2 image
 ifeq ($(BR2_TARGET_ROOTFS_ISO9660_BOOTLOADER_GRUB),y)
 $(BINARIES_DIR)/rootfs.iso9660: host-cdrkit host-fakeroot linux26 rootfs-ext2 grub
 	@$(call MESSAGE,"Generating root filesystem image rootfs.iso9660")
@@ -39,9 +40,25 @@ $(BINARIES_DIR)/rootfs.iso9660: host-cdrkit host-fakeroot linux26 rootfs-ext2 gr
 	- at rm -rf $(ISO9660_TARGET_DIR)
 endif
 
+### using isolinux and the files directly on the CD
 ifeq ($(BR2_TARGET_ROOTFS_ISO9660_BOOTLOADER_ISOLINUX),y)
-$(BINARIES_DIR)/rootfs.iso9660: host-cdrkit linux26 syslinux
+
+extradeps=
+ifeq ($(BR2_TARGET_ROOTFS_ISO9660_COPY_INITRAMFS),y)
+	extradeps += mini-initramfs
+endif
+
+ISO9660_SOURCE_DIR = $(TARGET_DIR)
+
+ifeq ($(BR2_TARGET_ROOTFS_ISO9660_COMPRESS),y)
+	extradeps += host-zisofs-tools
+	ISO9660_SOURCE_DIR = $(BUILD_DIR)/iso9660.tmp
+endif
+
+$(BINARIES_DIR)/rootfs.iso9660: host-cdrkit linux26 syslinux $(extradeps)
 	@$(call MESSAGE,"Generating root filesystem image rootfs.iso9660")
+	genisoimage_extraoptions=
+	# Get the boot loader and kernel ready
 	mkdir -p $(TARGET_DIR)/boot/isolinux
 	cp $(BINARIES_DIR)/isolinux.bin $(TARGET_DIR)/boot/isolinux/
 	cp $(ISO9660_BOOT_MENU) $(TARGET_DIR)/boot/isolinux/isolinux.cfg
@@ -49,11 +66,25 @@ $(BINARIES_DIR)/rootfs.iso9660: host-cdrkit linux26 syslinux
 ifeq ($(BR2_TARGET_ROOTFS_ISO9660_COPY_INITRAMFS),y)
 	cp $(BINARIES_DIR)/initramfs.gz $(TARGET_DIR)/boot/
 endif
+ifeq ($(BR2_TARGET_ROOTFS_ISO9660_COMPRESS),y)	
+	# create the ZISOFS
+	genisoimage_extraoptions=-z
+	-rm -rf $(ISO9660_SOURCE_DIR)
+	@$(call MESSAGE,"Compressing iso filesystem...")
+	$(HOST_DIR)/usr/bin/mkzftree -z 9 -p $(BR2_JLEVEL) $(TARGET_DIR) $(ISO9660_SOURCE_DIR)
+	# now we need to restore the files which shouldn't be compressed
+	rm -rf $(ISO9660_SOURCE_DIR)/boot
+	cp -fdpR $(TARGET_DIR)/boot $(ISO9660_SOURCE_DIR)/
+endif
+	# Let's create the ISO image
 	$(HOST_DIR)/usr/bin/genisoimage -R -b boot/isolinux/isolinux.bin -c boot/boot.cat -no-emul-boot \
 		-boot-load-size 4 -boot-info-table -o $@ \
-		-J -l -R -iso-level 2 \
+		-J -l -R -iso-level 2 $(genisoimage_extraoptions) \
 		-allow-leading-dots -allow-lowercase -allow-multidot \
-		$(TARGET_DIR)
+		$(ISO9660_SOURCE_DIR)
+ifeq ($(BR2_TARGET_ROOTFS_ISO9660_COMPRESS),y)
+	rm -rf $(ISO9660_SOURCE_DIR)
+endif
 endif
 	
 rootfs-iso9660: $(BINARIES_DIR)/rootfs.iso9660
Signature · 1 line
1.7.3.2
#1 lore raw

PATCH 1/1 support for mini initramfs and added iso9660 improvements

Heiko,

fs/initramfs/Config.in config BR2_TARGET_ROOTFS_INITRAMFS · line 32

Quoted 2 lines · On Sun, 5 Dec 2010 09:23:03 -0600 heiko at zuerker.org wrote:
fs/initramfs/Config.in +1 -1
-config BR2_TARGET_MINIMAL_INITRAMFS
+config BR2_TARGET_ROOTFS_MINI_INITRAMFS

Something must be wrong in your patch, because it removes BR2_TARGET_MINIMAL_INITRAMFS, but this option does not exist in the current Buildroot.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

PATCH 1/1 support for mini initramfs and added iso9660 improvements

Quoted 6 lines

-----Original Message-----
From: buildroot-bounces at busybox.net [mailto:buildroot- bounces at busybox.net] On Behalf Of Thomas Petazzoni
Sent: Sunday, December 05, 2010 2:26 PM
To: buildroot at busybox.net
Subject: Re: [Buildroot] [PATCH] support for mini initramfs and added

iso9660

Quoted 7 lines

improvements

Heiko,

On Sun, 5 Dec 2010 09:23:03 -0600
heiko at zuerker.org wrote:

Quoted 6 lines

fs/initramfs/Config.in config BR2_TARGET_ROOTFS_INITRAMFS · line 32

Quoted 2 lines
fs/initramfs/Config.in +1 -1
-config BR2_TARGET_MINIMAL_INITRAMFS
+config BR2_TARGET_ROOTFS_MINI_INITRAMFS

Something must be wrong in your patch, because it removes BR2_TARGET_MINIMAL_INITRAMFS, but this option does not exist in the current Buildroot.

Crap....
This must be due to multiple commits on my side, I'll take a look and send an updated patch in hopefully later tonight.

Signature · 3 lines
Regards
   Heiko Zuerker
   http://www.devil-linux.org
#3 lore raw

PATCH 1/1 support for mini initramfs and added iso9660 improvements

I sent in a corrected version, let's hope it's right this time.

Signature · 3 lines
Regards
   Heiko Zuerker
   http://www.devil-linux.org
Quoted 6 lines

-----Original Message-----
From: buildroot-bounces at busybox.net [mailto:buildroot- bounces at busybox.net] On Behalf Of Heiko Zuerker
Sent: Sunday, December 05, 2010 2:44 PM
To: buildroot at busybox.net
Subject: Re: [Buildroot] [PATCH] support for mini initramfs and added

iso9660

Quoted 23 lines

improvements

Quoted 6 lines

-----Original Message-----
From: buildroot-bounces at busybox.net [mailto:buildroot- bounces at busybox.net] On Behalf Of Thomas Petazzoni
Sent: Sunday, December 05, 2010 2:26 PM
To: buildroot at busybox.net
Subject: Re: [Buildroot] [PATCH] support for mini initramfs and added

iso9660

Quoted 7 lines

improvements

Heiko,

On Sun, 5 Dec 2010 09:23:03 -0600
heiko at zuerker.org wrote:

Quoted 6 lines

fs/initramfs/Config.in config BR2_TARGET_ROOTFS_INITRAMFS · line 32

Quoted 2 lines
fs/initramfs/Config.in +1 -1
-config BR2_TARGET_MINIMAL_INITRAMFS
+config BR2_TARGET_ROOTFS_MINI_INITRAMFS

Something must be wrong in your patch, because it removes BR2_TARGET_MINIMAL_INITRAMFS, but this option does not exist in the current Buildroot.

Quoted 2 lines

Crap....
This must be due to multiple commits on my side, I'll take a look and send

an

Quoted 12 lines

updated patch in hopefully later tonight.

--

Regards
Heiko Zuerker
http://www.devil-linux.org

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