Changeset 1950

Show
Ignore:
Timestamp:
07/08/07 01:37:15 (1 year ago)
Author:
alexander
Message:

Made it possible to store the LiveCD ISO file on a partition and boot it.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/packages/initramfs/Makefile

    r1927 r1950  
    4242        cp /usr/sbin/dmsetup $(WDIR)/sbin 
    4343        find /lib/modules/*/kernel/drivers/{ata,base,block,cdrom,ide,message,scsi,pcmcia,usb/{core,host,storage,input}} \ 
    44             /lib/modules/*/kernel/fs/{mbcache.ko,ext2,ext3,ext4,reiserfs,xfs,fat,vfat,ntfs,isofs,udf,nls} \ 
     44            /lib/modules/*/kernel/fs/{mbcache.ko,ext2,ext3,ext4,jbd,reiserfs,xfs,fat,vfat,ntfs,isofs,udf,nls} \ 
    4545            /lib/modules/*/kernel/lib -type f | cpio --make-directories -p $(WDIR) 
    4646        for a in /lib/modules/* ; do ver=$${a##*/} ; depmod -b $(WDIR) $$ver ; done 
  • trunk/packages/initramfs/init.in

    r1939 r1950  
    99root= 
    1010rootdelay= 
    11 rootfstype=ext3,ext2,auto 
     11rootfstype=auto 
    1212ro="ro" 
    1313noresume=0 
     
    8181        umount -n /.tmpfs/.cdrom 
    8282        /sbin/losetup /dev/loop2 /.tmpfs/.fakecd.iso 
     83        if [ -d /.tmpfs/.partition ] ; then 
     84                /sbin/losetup -d /dev/loop3 
     85                umount -n /.tmpfs/.partition && rm -rf /.tmpfs/.partition 
     86        fi 
    8387        ln -sf /dev/loop2 /dev/lfs-cd 
    8488} 
     
    97101        umount -n /.tmpfs/.cdrom 
    98102} 
    99  
    100103 
    101104do_mount_cd() { 
     
    135138                fi 
    136139        done 
    137         mkdir /.tmpfs 
    138         mount -n -t tmpfs -o size=90% tmpfs /.tmpfs 
    139140        mkdir /.tmpfs/.cdrom 
    140141        detect_cd_type 
     
    150151        mount -n -t ext2 /dev/mapper/lfs-cd /.root 
    151152        mount -n --move /.tmpfs /.root/dev/shm 
     153        if [ "$toram" != 1 ] && [ ! -d /.root/dev/shm/.partition ] ; then 
     154                cp -a /dev/lfs-cd /.root/dev/lfs-cd 
     155        fi 
    152156        if [ "$toram" != 1 ] ; then 
    153                 cp -a /dev/lfs-cd /.root/dev/lfs-cd 
    154157                ln -sf /dev/shm/.cdrom/drivers /.root/drivers 
    155158        fi 
     
    162165                rm -f /.root/etc/udev/rules.d/76-network.rules 
    163166        fi 
     167} 
     168 
     169do_mount_iso() { 
     170        DEVICE=${root#iso:} 
     171        FILE=${DEVICE#*:} 
     172        DEVICE=${DEVICE%%:*} 
     173        mkdir /.tmpfs/.partition 
     174        mount -n -t "$rootfstype" -o "$rootflags" "$DEVICE" /.tmpfs/.partition 
     175        /sbin/losetup /dev/loop3 "/.tmpfs/.partition/$FILE" 
     176        ln -sf /dev/loop3 /dev/lfs-cd 
     177        do_mount_cd 
    164178} 
    165179 
     
    169183        rootflags="$rootflags$ro" 
    170184        case "$root" in 
     185        iso:*) 
     186                mkdir /.tmpfs 
     187                mount -n -t tmpfs -o size=90% tmpfs /.tmpfs 
     188                do_mount_iso 
     189                ;; 
    171190        *:*) 
    172191                ( IFS=":" ; mknod /dev/root b $root ) 
     
    177196                ;; 
    178197        "") 
     198                mkdir /.tmpfs 
     199                mount -n -t tmpfs -o size=90% tmpfs /.tmpfs 
    179200                do_mount_cd 
    180201                ;; 
  • trunk/scripts/shutdown-helper

    r1908 r1950  
    2424/dev/console 
    2525/dev/null 
    26 /dev/lfs-cd 
    2726/dev/loop0 
     27/dev/loop3 
    2828/dev/mapper/control" 
    2929 
     
    3737esac 
    3838 
    39 if [ ! -b /dev/lfs-cd ] ; then 
     39if [ ! -b /dev/lfs-cd ] && [ ! -d /.tmpfs/.partition ] ; then 
    4040        # The CD has been loaded into RAM 
    4141        $HALT 
     
    4646ln -s /proc/mounts /dev/shm/etc/mtab 
    4747echo "$FILES" | cpio -pLd --quiet /dev/shm 
     48if [ -b /dev/lfs-cd ] ; then cp -a /dev/lfs-cd /dev/shm/dev/lfs-cd ; fi 
     49 
    4850cat >/dev/shm/sbin/init <<EOF 
    4951#!/bin/sh 
     
    6769done 
    6870[ "\$TIMEOUT" = "....." ] && fail 
     71 
    6972dmsetup remove_all || fail 
    7073losetup -d /dev/loop0 || fail 
    7174umount -n /.cdrom || fail 
    72 eject -r /dev/lfs-cd 
    73 echo -n "Take the CD, close the CD-ROM tray and press Enter..." 
    74 ( sleep 30 ; halt ) & 
    75 read ENTER 
     75 
     76if [ -d /.partition ] ; then 
     77        losetup -d /dev/loop3 || fail 
     78        umount -n /.partition || fail 
     79fi 
     80 
     81if [ -b /dev/lfs-cd ] ; then 
     82        eject -r /dev/lfs-cd 
     83        echo -n "Take the CD, close the CD-ROM tray and press Enter..." 
     84        ( sleep 30 ; halt ) & 
     85        read ENTER 
     86fi 
    7687halt 
    7788EOF