r1987 - in branches/x86_64: packages/initramfs scripts

jhuntwork at linuxfromscratch.org jhuntwork at linuxfromscratch.org
Thu Jul 26 16:22:15 PDT 2007


Author: jhuntwork
Date: 2007-07-26 17:22:15 -0600 (Thu, 26 Jul 2007)
New Revision: 1987

Modified:
   branches/x86_64/packages/initramfs/Makefile
   branches/x86_64/packages/initramfs/init.in
   branches/x86_64/scripts/shutdown-helper
Log:
Merged r1950 to x86_64 branch

Modified: branches/x86_64/packages/initramfs/Makefile
===================================================================
--- branches/x86_64/packages/initramfs/Makefile	2007-07-26 23:16:44 UTC (rev 1986)
+++ branches/x86_64/packages/initramfs/Makefile	2007-07-26 23:22:15 UTC (rev 1987)
@@ -42,7 +42,7 @@
 	cp /usr/bin/stat $(WDIR)/bin
 	cp /usr/sbin/dmsetup $(WDIR)/sbin
 	find /lib/modules/*/kernel/drivers/{ata,base,block,cdrom,ide,ieee1394,firewire,hid,message,scsi,pcmcia,usb/{core,host,storage}} \
-	    /lib/modules/*/kernel/fs/{mbcache.ko,ext2,ext3,ext4,reiserfs,xfs,fat,vfat,ntfs,isofs,udf,nls} \
+	    /lib/modules/*/kernel/fs/{mbcache.ko,ext2,ext3,ext4,jbd,reiserfs,xfs,fat,vfat,ntfs,isofs,udf,nls} \
 	    /lib/modules/*/kernel/lib -type f | cpio --make-directories -p $(WDIR)
 	for a in /lib/modules/* ; do ver=$${a##*/} ; depmod -b $(WDIR) $$ver ; done
 	cd $(WDIR); find . | cpio -o -H newc | gzip -9 > ../initramfs_data.cpio.gz

Modified: branches/x86_64/packages/initramfs/init.in
===================================================================
--- branches/x86_64/packages/initramfs/init.in	2007-07-26 23:16:44 UTC (rev 1986)
+++ branches/x86_64/packages/initramfs/init.in	2007-07-26 23:22:15 UTC (rev 1987)
@@ -9,7 +9,7 @@
 init=/sbin/init
 root=
 rootdelay=
-rootfstype=ext3,ext2,auto
+rootfstype=auto
 ro="ro"
 noresume=0
 resume=
@@ -81,6 +81,10 @@
 		bs=1 count=1 skip=8 seek=47482 conv=notrunc 2>/dev/null
 	umount -n /.tmpfs/.cdrom
 	/sbin/losetup /dev/loop2 /.tmpfs/.fakecd.iso
+	if [ -d /.tmpfs/.partition ] ; then
+		/sbin/losetup -d /dev/loop3
+		umount -n /.tmpfs/.partition && rm -rf /.tmpfs/.partition
+	fi
 	ln -sf /dev/loop2 /dev/lfs-cd
 }
 
@@ -98,7 +102,6 @@
 	umount -n /.tmpfs/.cdrom
 }
 
-
 do_mount_cd() {
 	i=1
 	while [ ! -L /dev/lfs-cd ] ; do
@@ -135,8 +138,6 @@
 			sh
 		fi
 	done
-	mkdir /.tmpfs
-	mount -n -t tmpfs -o size=90% tmpfs /.tmpfs
 	mkdir /.tmpfs/.cdrom
 	detect_cd_type
 	if [ "$toram" = 1 ] ; then copy_cd_to_ram ; fi
@@ -150,8 +151,10 @@
 	echo "0 $SIZE snapshot /dev/loop0 /dev/loop1 p 8" | /sbin/dmsetup create lfs-cd
 	mount -n -t ext2 /dev/mapper/lfs-cd /.root
 	mount -n --move /.tmpfs /.root/dev/shm
+	if [ "$toram" != 1 ] && [ ! -d /.root/dev/shm/.partition ] ; then
+		cp -a /dev/lfs-cd /.root/dev/lfs-cd
+	fi
 	if [ "$toram" != 1 ] ; then
-		cp -a /dev/lfs-cd /.root/dev/lfs-cd
 		ln -sf /dev/shm/.cdrom/drivers /.root/drivers
 	fi
 	cat /etc/modprobe.conf >>/.root/etc/modprobe.conf
@@ -164,11 +167,27 @@
 	fi
 }
 
+do_mount_iso() {
+	DEVICE=${root#iso:}
+	FILE=${DEVICE#*:}
+	DEVICE=${DEVICE%%:*}
+	mkdir /.tmpfs/.partition
+	mount -n -t "$rootfstype" -o "$rootflags" "$DEVICE" /.tmpfs/.partition
+	/sbin/losetup /dev/loop3 "/.tmpfs/.partition/$FILE"
+	ln -sf /dev/loop3 /dev/lfs-cd
+	do_mount_cd
+}
+
 do_mount_root() {
 	mkdir /.root
 	[ -n "$rootflags" ] && rootflags="$rootflags,"
 	rootflags="$rootflags$ro"
 	case "$root" in
+	iso:*)
+		mkdir /.tmpfs
+		mount -n -t tmpfs -o size=90% tmpfs /.tmpfs
+		do_mount_iso
+		;;
 	*:*)
 		( IFS=":" ; mknod /dev/root b $root )
 		mount -n -t "$rootfstype" -o "$rootflags" /dev/root /.root
@@ -177,6 +196,8 @@
 		mount -n -t "$rootfstype" -o "$rootflags" "$root" /.root
 		;;
 	"")
+		mkdir /.tmpfs
+		mount -n -t tmpfs -o size=90% tmpfs /.tmpfs
 		do_mount_cd
 		;;
 	esac

Modified: branches/x86_64/scripts/shutdown-helper
===================================================================
--- branches/x86_64/scripts/shutdown-helper	2007-07-26 23:16:44 UTC (rev 1986)
+++ branches/x86_64/scripts/shutdown-helper	2007-07-26 23:22:15 UTC (rev 1987)
@@ -23,8 +23,8 @@
 /lib/libpthread.so.0
 /dev/console
 /dev/null
-/dev/lfs-cd
 /dev/loop0
+/dev/loop3
 /dev/mapper/control"
 
 case "$RUNLEVEL" in
@@ -68,13 +68,22 @@
 	TIMEOUT=".\$TIMEOUT"
 done
 [ "\$TIMEOUT" = "....." ] && fail
+
 dmsetup remove_all || fail
 losetup -d /dev/loop0 || fail
 umount -n /.cdrom || fail
-eject -r /dev/lfs-cd
-echo -n "Take the CD, close the CD-ROM tray and press Enter..."
-( sleep 30 ; halt ) &
-read ENTER
+
+if [ -d /.partition ] ; then
+	losetup -d /dev/loop3 || fail
+	umount -n /.partition || fail
+fi
+
+if [ -b /dev/lfs-cd ] ; then
+	eject -r /dev/lfs-cd
+	echo -n "Take the CD, close the CD-ROM tray and press Enter..."
+	( sleep 30 ; halt ) &
+	read ENTER
+fi
 halt
 EOF
 chmod 755 /dev/shm/sbin/init




More information about the livecd mailing list