From 675849d2d245fd7154e92de7471392bccbd614d8 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Wed, 19 Oct 2011 13:11:02 +0200 Subject: [PATCH] livecd: add dual kernel support in post.sh script (but not currently enabled for livecd-root target) --- platforms/bootusb/initramfs-include.sh | 96 -------------------------- platforms/livecd/post.inc.sh | 92 ++++++++++++++++-------- 2 files changed, 64 insertions(+), 124 deletions(-) delete mode 100644 platforms/bootusb/initramfs-include.sh diff --git a/platforms/bootusb/initramfs-include.sh b/platforms/bootusb/initramfs-include.sh deleted file mode 100644 index c0f4ac5..0000000 --- a/platforms/bootusb/initramfs-include.sh +++ /dev/null @@ -1,96 +0,0 @@ -FOUND_ISO= -#RAMSIZE=100000 -o "size=${RAMSIZE}k" - -msg ":: Creating new root ramdisk (dinamic size=${RAMSIZE}k) on /dev/shm..." -mkdir -p /flash /cdrom /squashfs /newroot - -# -# findiso(): looks for ISO9660 images stored in flash root -# -findiso(){ - msg ":: Looking for openmamba ISO cdrom images" - - # try removable devices only - for i in /flash/openmamba-*.iso; do - /bin/losetup /dev/loop0 $i - if mount -r -t iso9660 /dev/loop0 /cdrom >/dev/null 2>&1; then - if test -r /cdrom/rootfs.compressed; then - msg ":: Valid ISO image $i found..." - FOUND_ISO="$i" - return 0 - fi - umount /cdrom - fi - /bin/losetup /dev/loop0 - done - return 1 -} - -#/sbin/splash_util -c repaint ${splash_add} -t default --mesg="Looking for cdrom device" --progress="4444" - -while true; do - msg ":: root device is ${root}" - if ! mount -t ext3 ${root} /flash >/dev/null 2>&1; then - if ! mount -t ext2 ${root} /flash >/dev/null 2>&1; then - err ":: Unable to mount USB rootfs. Supported filesystems are ext2 and ext3." - fi - fi - findiso - if [ "$FOUND_ISO" ]; then -# /sbin/splash_util -c repaint ${splash_add} -t default --mesg="Mounting compressed filesystem" --progress="5555" - msg ":: Mounting compressed filesystem" - /bin/losetup /dev/loop1 /cdrom/rootfs.compressed - mount -r -t squashfs /dev/loop1 /squashfs - - if [ "${unionfs}" != "off" -a "${unionfs}" != "OFF" ]; then - - [ "${unionfs}" = "reset" ] && { - msg ":: Resetting unionfs data in rwroot" - mkdir -p /flash/old - mv /flash/rwroot /flash/old/ - } - msg ":: Mounting unionfs" - mkdir -p /flash/rwroot - mount -t unionfs -o dirs=/flash/rwroot=rw:/squashfs=ro unionfs /newroot - mkdir -p /newroot/squashfs /newroot/flash /newroot/cdrom - mount -n -o move /squashfs /newroot/squashfs - mount -n -o move /flash /newroot/flash - mount -n -o move /cdrom /newroot/cdrom - else - msg ":: Creating directories and symlinks on ramdisk..." - /bin/mount -t tmpfs /dev/shm /newroot - mkdir -p \ - /newroot/tmp /newroot/proc /newroot/sys \ - /newroot/initrd /newroot/mnt /newroot/media \ - /newroot/oldroot /newroot/squashfs /newroot/flash \ - /newroot/cdrom - mount -n -o move /squashfs /newroot/squashfs - mount -n -o move /flash /newroot/flash - mount -n -o move /cdrom /newroot/cdrom - ln -s squashfs/bin /newroot/bin - ln -s squashfs/boot /newroot/boot - ln -s squashfs/lib /newroot/lib - ln -s squashfs/opt /newroot/opt - ln -s squashfs/sbin /newroot/sbin - ln -s squashfs/srv /newroot/srv - ln -s squashfs/usr /newroot/usr - - chroot /newroot /bin/cp -a \ - /squashfs/dev /squashfs/home /squashfs/var \ - /squashfs/etc /squashfs/root / - fi - - # Create empty utmp and wtmp - #:> /newroot/var/run/utmp - #:> /newroot/var/run/wtmp - - [ "${init}" ] || init=/sbin/init - msg ":: Running init, runlevel:${runlevel}" - exec run-init /newroot ${init} ${runlevel} - msg ":: Could not run init; opening a command prompt." - /bin/sh.shared - else - msg ":: Could not find a valid ISO image; opening a command prompt." - /bin/sh.shared - fi -done diff --git a/platforms/livecd/post.inc.sh b/platforms/livecd/post.inc.sh index 20b1914..0bf2bd2 100644 --- a/platforms/livecd/post.inc.sh +++ b/platforms/livecd/post.inc.sh @@ -7,20 +7,24 @@ [ -e $MOUNTDIR2/boot/isolinux ] || mkdir -p $MOUNTDIR2/boot/isolinux -chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${KERNEL_EXTRAVER} +ISOID= +for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do + chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${K} + LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \ + --filesystems "ext3 ext4 unionfs squashfs isofs reiserfs reiser4" \ + --nomdadmconf --nolvmconf \ + /boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \ + ${KERNEL_MAJVER}${K} -LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \ - --filesystems "ext3 ext4 unionfs squashfs isofs reiserfs reiser4" \ - --nomdadmconf --nolvmconf \ - /boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \ - ${KERNEL_MAJVER}${KERNEL_EXTRAVER} + # Note: isolinux requires 8.3 filenames + cp $MOUNTDIR/boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \ + $MOUNTDIR2/boot/initrd${ISOID}.gz -# Note: isolinux requires 8.3 filenames -cp $MOUNTDIR/boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \ - $MOUNTDIR2/boot/initrmfs.gz + cp $MOUNTDIR/boot/vmlinuz-${KERNEL_MAJVER}${K} \ + $MOUNTDIR2/boot/vmlinuz${ISOID} -cp $MOUNTDIR/boot/vmlinuz-${KERNEL_MAJVER}${KERNEL_EXTRAVER} \ - $MOUNTDIR2/boot/vmlinuz + ISOID=$(($ISOID + 1)) +done # add buildinfo buildinfo="`cat $MOUNTDIR/etc/openmamba-release` ${PLATFORM}" @@ -30,26 +34,58 @@ cat > $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF PROMPT 0 TIMEOUT 20 DEFAULT vesamenu.c32 -MENU TITLE ${buildinfo} (${KERNEL_MAJVER}${KERNEL_EXTRAVER} kernel) +MENU TITLE ${buildinfo} (${KERNEL_MAJVER} kernel) MENU BACKGROUND openmamba.png MENU COLOR TITLE 1;32;49 #ff00993d #00000000 std +_EOF -LABEL kms -MENU LABEL default - kernel /boot/vmlinuz - append initrd=/boot/initrmfs.gz root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} ro selinux=0 quiet splash vga=792 -LABEL vga1024 -MENU LABEL VGA 1024x768 (no modeset) - kernel /boot/vmlinuz - append initrd=/boot/initrmfs.gz root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} ro selinux=0 quiet splash vga=792 nomodeset -LABEL vga800 -MENU LABEL VGA 800x600 (no modeset) - kernel /boot/vmlinuz - append initrd=/boot/initrmfs.gz root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} ro selinux=0 quiet splash vga=789 nomodeset -LABEL debug -MENU LABEL Debug mode - kernel /boot/vmlinuz - append initrd=/boot/initrmfs.gz root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} ro selinux=0 rddebug rdshell +ISOID= +for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do + cat >> $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF +LABEL default-${KERNEL_MAJVER}${K} +MENU LABEL default (${KERNEL_MAJVER}${K}) + kernel /boot/vmlinuz${ISOID} + append initrd=/boot/initrd${ISOID}.gz root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} ro selinux=0 quiet splash vga=792 +_EOF + ISOID=$(($ISOID + 1)) +done + +echo "MENU SEPARATOR" >> $MOUNTDIR2/boot/isolinux.conf +ISOID= +for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do + cat >> $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF +LABEL vga800-${KERNEL_MAJVER}${K} +MENU LABEL VGA 800x600 no modeset (${KERNEL_MAJVER}${K}) + kernel /boot/vmlinuz${ISOID} + append initrd=/boot/initrd${ISOID}.gz root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} ro selinux=0 quiet splash vga=789 nomodeset +_EOF + ISOID=$(($ISOID + 1)) +done + +ISOID= +for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do + cat >> $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF +LABEL vga1024-${KERNEL_MAJVER}${K} +MENU LABEL VGA 1024x768 no modeset (${KERNEL_MAJVER}${K}) + kernel /boot/vmlinuz${ISOID} + append initrd=/boot/initrd${ISOID}.gz root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} ro selinux=0 quiet splash vga=792 nomodeset +_EOF + ISOID=$(($ISOID + 1)) +done + +echo "MENU SEPARATOR" >> $MOUNTDIR2/boot/isolinux.conf +ISOID= +for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do + cat >> $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF +LABEL debug-${KERNEL_MAJVER}${K} +MENU LABEL Debug mode (${KERNEL_MAJVER}${K}) + kernel /boot/vmlinuz${ISOID} + append initrd=/boot/initrd${ISOID}.gz root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} ro selinux=0 rddebug nomodeset +_EOF + ISOID=$(($ISOID + 1)) +done + +cat >> $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF MENU SEPARATOR LABEL memtest MENU LABEL Memory test