[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#627887: add support for jasper initramfs system



Package: live-build
Version: 3.0~a17-1
Severity: wishlist
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch oneiric

The Ubuntu ARM team wrote a system called jasper whose job is to help
with booting preinstalled ext2/ext3 ARM images:

Description: Configure a preinstalled ext2/3 system image
 Jasper is a tool to configure preinstalled ext2/3 images that were
 created using the ubuntu infrastructure from the initramfs.
 Such as armel omap3/4 images in Ubuntu 10.10 and beyond.
 .
 It grows the system partition of a preinstalled ext2/3 image to the
 full size of the SD card, configures fstab, loopback networking, adds
 the UUID to the kernel cmdline and properly sets up flash-kernel for
 the kernel package post installation scripts.

It's supported by livecd-rootfs, so I needed to add support for it to
live-build as well.  From live-build's point of view, I think it
basically counts as a new initramfs system, with the wrinkles that there
shouldn't be a boot=jasper parameter (it extends the default boot=local
instead) and I don't think it needs to do the user creation bits.

Patch attached.  What do you think?

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]
>From 7ed79bd4b34c58919c22e3fc502022a12b1a0b63 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@canonical.com>
Date: Wed, 25 May 2011 09:55:29 +0100
Subject: [PATCH] Add support for jasper initramfs system.

---
 manpages/en/lb_config.1             |    4 ++--
 scripts/build/lb_binary_grub        |   10 +++++++++-
 scripts/build/lb_binary_grub2       |   10 +++++++++-
 scripts/build/lb_binary_linux-image |    4 ++++
 scripts/build/lb_binary_manifest    |    5 +++++
 scripts/build/lb_binary_memtest     |    4 ++++
 scripts/build/lb_binary_net         |    4 ++++
 scripts/build/lb_binary_rootfs      |    4 ++++
 scripts/build/lb_binary_silo        |    7 ++++++-
 scripts/build/lb_binary_yaboot      |   10 +++++++++-
 scripts/build/lb_chroot_hacks       |    6 +++++-
 scripts/build/lb_config             |    2 +-
 12 files changed, 62 insertions(+), 8 deletions(-)

diff --git a/manpages/en/lb_config.1 b/manpages/en/lb_config.1
index a8a9c6f..a579ff6 100644
--- a/manpages/en/lb_config.1
+++ b/manpages/en/lb_config.1
@@ -109,7 +109,7 @@
 .br
 	[\fB\-\-includes\fR \fIPATH\fR]
 .br
-	[\fB\-\-initramfs\fR auto|none|live\-boot|casper]
+	[\fB\-\-initramfs\fR auto|none|live\-boot|casper|jasper]
 .br
 	[\fB\-\-initramfs\-compression\fR bzip2|gzip|lzma]
 .br
@@ -361,7 +361,7 @@ sets the hostname of the live system.
 \fBlb config\fR by default reads system defaults from /etc/live/build.conf and /etc/live/build.d when generating a new live system config directory. This is useful if you want to set global settings, such as mirror locations, and don't want to specify them all of the time.
 .IP "\fB\-\-includes\fR \fIPATH|none\fR" 4
 sets the path to the includes that live\-build is going to use, e.g. additional minimal documentation that you want to have on all live systems. By default, this is set to /usr/share/live/build/includes/. Choose none to disable inclusion of documentation.
-.IP "\fB\-\-initramfs\fR auto|none|live\-boot|casper" 4
+.IP "\fB\-\-initramfs\fR auto|none|live\-boot|casper|jasper" 4
 sets the name of package that contains the live system specific initramfs modification. By default, auto is used, which means that at build time of the image rather than on configuration time, the value will be expanded to casper when building ubuntu systems, to live\-boot for all other systems. Using 'none' is useful if the resulting system image should not be a live image (experimental).
 .IP "\fB\-\-initramfs\-compression\fR bzip2|gzip|lzma]
 defines the compression program to be used to compress the initramfs. Defaults to gzip.
diff --git a/scripts/build/lb_binary_grub b/scripts/build/lb_binary_grub
index d796750..7f70090 100755
--- a/scripts/build/lb_binary_grub
+++ b/scripts/build/lb_binary_grub
@@ -68,7 +68,7 @@ Grub_live_entry ()
 	APPEND="${4}"
 
 	LINUX_LIVE="${LINUX_LIVE}\ntitle\t\tDebian GNU/Linux - ${LABEL}"
-	LINUX_LIVE="${LINUX_LIVE}\nkernel\t\t/${KERNEL} boot=${INITFS} config LB_BOOTAPPEND_LIVE ${APPEND}"
+	LINUX_LIVE="${LINUX_LIVE}\nkernel\t\t/${KERNEL} ${INITFS:+boot=${INITFS} }config LB_BOOTAPPEND_LIVE ${APPEND}"
 	LINUX_LIVE="${LINUX_LIVE}\ninitrd\t\t/${INITRD}"
 }
 
@@ -125,6 +125,10 @@ case "${LB_INITRAMFS}" in
 	live-boot)
 		INITFS="live"
 		;;
+
+	*)
+		INITFS=""
+		;;
 esac
 
 # Setting destination directory
@@ -135,6 +139,10 @@ case "${LB_BINARY_IMAGES}" in
 				DESTDIR_LIVE="binary/casper"
 				;;
 
+			jasper)
+				DESTDIR_LIVE="binary/jasper"
+				;;
+
 			live-boot)
 				DESTDIR_LIVE="binary/live"
 				;;
diff --git a/scripts/build/lb_binary_grub2 b/scripts/build/lb_binary_grub2
index 8f076b2..4cb344b 100755
--- a/scripts/build/lb_binary_grub2
+++ b/scripts/build/lb_binary_grub2
@@ -68,7 +68,7 @@ Grub_live_entry ()
 	APPEND="${4}"
 
 	LINUX_LIVE="${LINUX_LIVE}\nmenuentry \"Debian GNU/Linux - ${LABEL}\" {"
-	LINUX_LIVE="${LINUX_LIVE}\nlinux\t\t/${KERNEL} boot=${INITFS} config LB_BOOTAPPEND_LIVE ${APPEND}"
+	LINUX_LIVE="${LINUX_LIVE}\nlinux\t\t/${KERNEL} ${INITFS:+boot=${INITFS} }config LB_BOOTAPPEND_LIVE ${APPEND}"
 	LINUX_LIVE="${LINUX_LIVE}\ninitrd\t\t/${INITRD}"
 	LINUX_LIVE="${LINUX_LIVE}\n}"
 }
@@ -99,6 +99,10 @@ case "${LB_INITRAMFS}" in
 	live-boot)
 		INITFS="live"
 		;;
+
+	*)
+		INITFS=""
+		;;
 esac
 
 # Setting destination directory
@@ -109,6 +113,10 @@ case "${LB_BINARY_IMAGES}" in
 				DESTDIR_LIVE="binary/casper"
 				;;
 
+			jasper)
+				DESTDIR_LIVE="binary/jasper"
+				;;
+
 			live-boot)
 				DESTDIR_LIVE="binary/live"
 				;;
diff --git a/scripts/build/lb_binary_linux-image b/scripts/build/lb_binary_linux-image
index c5a8cc6..10495de 100755
--- a/scripts/build/lb_binary_linux-image
+++ b/scripts/build/lb_binary_linux-image
@@ -48,6 +48,10 @@ case "${LB_INITRAMFS}" in
 		DESTDIR="binary/casper"
 		;;
 
+	jasper)
+		DESTDIR="binary/jasper"
+		;;
+
 	live-boot)
 		DESTDIR="binary/live"
 		;;
diff --git a/scripts/build/lb_binary_manifest b/scripts/build/lb_binary_manifest
index 4b49133..96631f9 100755
--- a/scripts/build/lb_binary_manifest
+++ b/scripts/build/lb_binary_manifest
@@ -49,6 +49,11 @@ case "${LB_INITRAMFS}" in
 		SUFFIX="manifest"
 		;;
 
+	jasper)
+		INITFS="jasper"
+		SUFFIX="manifest"
+		;;
+
 	live-boot)
 		INITFS="live"
 		SUFFIX="packages"
diff --git a/scripts/build/lb_binary_memtest b/scripts/build/lb_binary_memtest
index a539ee6..a898937 100755
--- a/scripts/build/lb_binary_memtest
+++ b/scripts/build/lb_binary_memtest
@@ -84,6 +84,10 @@ case "${LB_INITRAMFS}" in
 		DESTDIR="binary/casper"
 		;;
 
+	jasper)
+		DESTDIR="binary/jasper"
+		;;
+
 	live-boot)
 		DESTDIR="binary/live"
 		;;
diff --git a/scripts/build/lb_binary_net b/scripts/build/lb_binary_net
index 9cac050..a1ef163 100755
--- a/scripts/build/lb_binary_net
+++ b/scripts/build/lb_binary_net
@@ -66,6 +66,10 @@ then
 			ORIGDIR="binary/casper"
 			;;
 
+		jasper)
+			ORIGDIR="binary/jasper"
+			;;
+
 		live-boot)
 			ORIGDIR="binary/live"
 			;;
diff --git a/scripts/build/lb_binary_rootfs b/scripts/build/lb_binary_rootfs
index 2e3e34e..e855971 100755
--- a/scripts/build/lb_binary_rootfs
+++ b/scripts/build/lb_binary_rootfs
@@ -53,6 +53,10 @@ case "${LB_INITRAMFS}" in
 		INITFS="casper"
 		;;
 
+	jasper)
+		INITFS="jasper"
+		;;
+
 	live-boot)
 		INITFS="live"
 		;;
diff --git a/scripts/build/lb_binary_silo b/scripts/build/lb_binary_silo
index ac2e2d0..83366ac 100755
--- a/scripts/build/lb_binary_silo
+++ b/scripts/build/lb_binary_silo
@@ -82,7 +82,7 @@ Silo_live_entry ()
 	LINUX_LIVE="${LINUX_LIVE}\nimage=${DIRECTORY}/${KERNEL}\n"
 	LINUX_LIVE="${LINUX_LIVE}\t  label=${LABEL}\n"
 	LINUX_LIVE="${LINUX_LIVE}\t  initrd=${DIRECTORY}/${INITRD}\n"
-	LINUX_LIVE="${LINUX_LIVE}\t  append=\"boot=${INITFS} config LB_BOOTAPPEND_LIVE ${APPEND}\"\n"
+	LINUX_LIVE="${LINUX_LIVE}\t  append=\"${INITFS:+boot=${INITFS} }config LB_BOOTAPPEND_LIVE ${APPEND}\"\n"
 }
 
 Silo_install_entry ()
@@ -113,6 +113,11 @@ case "${LB_INITRAMFS}" in
 		DESTDIR_LIVE="binary/casper"
 		;;
 
+	jasper)
+		INITFS=""
+		DESTDIR_LIVE="binary/jasper"
+		;;
+
 	live-boot)
 		INITFS="live"
 		DESTDIR_LIVE="binary/live"
diff --git a/scripts/build/lb_binary_yaboot b/scripts/build/lb_binary_yaboot
index ee2452b..f21056a 100755
--- a/scripts/build/lb_binary_yaboot
+++ b/scripts/build/lb_binary_yaboot
@@ -72,7 +72,7 @@ Yaboot_live_entry ()
 	LINUX_LIVE="${LINUX_LIVE}\nimage=${DIRECTORY}/${KERNEL}\n"
 	LINUX_LIVE="${LINUX_LIVE}\tlabel=${LABEL}\n"
 	LINUX_LIVE="${LINUX_LIVE}\tinitrd=${DIRECTORY}/${INITRD}\n"
-	LINUX_LIVE="${LINUX_LIVE}\tappend=\"boot=${INITFS} config LB_BOOTAPPEND_LIVE ${APPEND}\"\n"
+	LINUX_LIVE="${LINUX_LIVE}\tappend=\"${INITFS:+boot=${INITFS} }config LB_BOOTAPPEND_LIVE ${APPEND}\"\n"
 	LINUX_LIVE="${LINUX_LIVE}\tinitrd-size=10240\n"
 }
 
@@ -132,6 +132,10 @@ case "${LB_INITRAMFS}" in
 	live-boot)
 		INITFS="live"
 		;;
+
+	*)
+		INITFS=""
+		;;
 esac
 
 # Setting destination directory
@@ -142,6 +146,10 @@ case "${LB_BINARY_IMAGES}" in
 				DESTDIR_LIVE="binary/casper"
 				;;
 
+			jasper)
+				DESTDIR_LIVE="binary/jasper"
+				;;
+
 			live-boot)
 				DESTDIR_LIVE="binary/live"
 				;;
diff --git a/scripts/build/lb_chroot_hacks b/scripts/build/lb_chroot_hacks
index 4c26deb..bbb39ce 100755
--- a/scripts/build/lb_chroot_hacks
+++ b/scripts/build/lb_chroot_hacks
@@ -255,9 +255,13 @@ case "${LB_INITRAMFS}" in
 	live-boot)
 		ID="1000"
 		;;
+
+	*)
+		ID=""
+		;;
 esac
 
-if [ -d chroot/home/${LB_USERNAME} ]
+if [ -d chroot/home/${LB_USERNAME} ] && [ "${ID}" ]
 then
 	chown -R --quiet ${ID}:${ID} chroot/home/${LB_USERNAME}
 fi
diff --git a/scripts/build/lb_config b/scripts/build/lb_config
index f2c6bdc..bbcdf8f 100755
--- a/scripts/build/lb_config
+++ b/scripts/build/lb_config
@@ -79,7 +79,7 @@ USAGE="${PROGRAM}   [--apt apt|aptitude]\n\
 \t    [--hostname NAME]\n\
 \t    [--ignore-system-defaults]\n\
 \t    [--includes PATH|none]\n\
-\t    [--initramfs auto|none|live-boot|casper]\n\
+\t    [--initramfs auto|none|live-boot|casper|jasper]\n\
 \t    [--initramfs-compression bzip2|gzip|lzma]\n\
 \t    [--initsystem sysvinit|runit|systemd|upstart|none]\n\
 \t    [--interactive shell]\n\
-- 
1.7.4.1


Reply to: