Jin LiveCD/Make Live
Ä¿³Î ¶
bootsplash ¶
squashfs ¶
unionfs ¶
ÆÐŰÁö ¼³Ä¡ ¶
LIVECD.build ¶
mkinitrd ¶
busybox ¶
gfxboot ¶
´Ü°èÀû °úÁ¤ ¶
ÀÛ¾÷ ³»¿ë 2005.10.30 ¶
mkdir $DEST/dev mkdir $DEST/media mkdir $DEST/mnt mkdir $DEST/proc mkdir $DEST/sys mkdir $DEST/tmp
gstreamer ¶
7 rpm -ivh indent-2.2.9-8.i386.rpm
8 rpm -ivh libIDL-devel-0.8.5-2.i386.rpm
9 rpm -ivh ORBit2-devel-2.12.1-3.i386.rpm
10 rpm -ivh GConf2-devel-2.10.0-4.i386.rpm
11 rpm -ivh gstreamer-plugins-*
12 rpm -ivh gstreamer-plugins-devel-0.8.8-6.i386.rpm
init, halt, reboot ¶
SQFS UNIONFS cdrom dev ramdisk static swap media mnt proc sys home -> /ramdisk/home root -> /ramdisk/root tmp -> /ramdisk/tmp bin -> /UNIONFS/bin boot -> /UNIONFS/boot etc -> /UNIONFS/etc lib -> /UNIONFS/lib misc -> /UNIONFS/misc opt -> /UNIONFS/opt sbin -> /UNIONFS/sbin selinux -> /UNIONFS/selinux srv -> /UNIONFS/srv usr -> /UNIONFS/usr var -> /UNIONFS/var
SQFS UNIONFS bootsplash cdrom init modules sbin -> static static bin -> /SQFS/bin boot -> /SQFS/boot lib -> /SQFS/lib opt -> /SQFS/opt usr -> /SQFS/usr dev etc media mnt proc root sys tmp
[root@localhost UNIONFS]# cat /proc/mounts rootfs / rootfs rw 0 0 none /sys sysfs rw 0 0 /dev/hdb2 /cdrom ext2 ro 0 0 /dev/loop0 /SQFS squashfs ro 0 0 /ramdisk /ramdisk tmpfs rw 0 0 /UNIONFS /UNIONFS unionfs rw,dirs=/ramdisk=rw:/SQFS=ro,debug=0,delete=whiteout,copyup=preserve 0 0 /proc /proc proc rw,nodiratime 0 0 /proc/bus/usb /proc/bus/usb usbfs rw 0 0 none /dev tmpfs rw 0 0 none /dev/pts devpts rw 0 0 none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
[root@localhost root]# cat /etc/mtab /dev/root / tmpfs rw 0 0 usbfs /proc/bus/usb usbfs rw 0 0 /dev/hdb2 /cdrom ext2 ro 0 0 /ramdisk /ramdisk tmpfs rw 0 0 none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
adios ¶
EjectCD()
{
local EJECT=$1 SQUASHFS
#just in case they are mounted, umount any squashfs mounts
for SQUASHFS in `grep squash /proc/mounts | cut -d' ' -f2`; do
umount $SQUASHFS
done
umount $BOOTCD_DIR
if [ "X${EJECT}" = "Xmessage-only" ]; then
echo; echo "You may now eject the CD."
else
eject /dev/cdrom
fi
}
Reboot()
{
Shutdown -r
}
Shutdown()
{
local HOW=$1
UnmountAllPartitions
grep -q cdrom /proc/mounts && EjectCD
echo
case $HOW in
-r) echo "Rebooting system ... "; reboot -f;;
*) echo "Halting system ... "; halt -f -p;;
esac
}
{{{
[root@localhost cdrom]# ls -l
ÇÕ°è 24
drwxr-xr-x 1 root root 791 5¿ù 17 10:28 bin
lrwxrwxrwx 1 root root 8 7¿ù 19 12:55 boot -> ../boot/
lrwxrwxrwx 1 root root 7 7¿ù 19 12:55 etc -> ../etc/
lrwxrwxrwx 1 root root 8 7¿ù 19 12:55 home -> ../home/
drwxr-xr-x 1 root root 10 6¿ù 20 11:50 initrd
drwxr-xr-x 1 root root 2127 6¿ù 10 14:29 lib
lrwxrwxrwx 1 root root 9 7¿ù 19 12:55 media -> ../media/
lrwxrwxrwx 1 root root 8 7¿ù 19 12:55 misc -> ../misc/
lrwxrwxrwx 1 root root 7 7¿ù 19 12:55 mnt -> ../mnt/
lrwxrwxrwx 1 root root 7 7¿ù 19 12:55 opt -> ../opt/
lrwxrwxrwx 1 root root 8 7¿ù 19 12:55 proc -> ../proc/
lrwxrwxrwx 1 root root 8 7¿ù 19 12:55 root -> ../root/
drwxr-xr-x 1 root root 2539 7¿ù 4 13:27 sbin
lrwxrwxrwx 1 root root 11 7¿ù 19 12:55 selinux -> ../selinux/
lrwxrwxrwx 1 root root 7 7¿ù 19 12:55 srv -> ../srv/
lrwxrwxrwx 1 root root 7 7¿ù 19 12:55 sys -> ../sys/
lrwxrwxrwx 1 root root 12 7¿ù 19 12:55 tftpboot -> ../tftpboot/
lrwxrwxrwx 1 root root 7 7¿ù 19 12:55 tmp -> ../tmp/
lrwxrwxrwx 1 root root 7 7¿ù 19 12:55 usr -> ../usr/
drwxr-xr-x 1 root root 308 7¿ù 14 13:28 var
initrd
drwxr-xr-x 2 root root 4096 5¿ù 25 15:14 adios
lrwxrwxrwx 1 root root 11 10¿ù 29 23:15 bin -> initrd/bin/
drwxr-xr-x 3 root root 4096 5¿ù 31 17:13 boot
drwxr-xr-x 19 root root 8192 5¿ù 25 15:58 dev
lrwxrwxrwx 1 root root 11 10¿ù 29 23:15 etc -> initrd/etc/
drwxr-xr-x 7 root root 4096 11¿ù 1 20:32 initrd
-rw-r--r-- 1 root root 964 8¿ù 15 21:04 kk
lrwxrwxrwx 1 root root 11 10¿ù 29 23:15 lib -> initrd/lib/
-rwxr-xr-x 1 root root 74412 7¿ù 20 12:53 linuxrc
drwxr-xr-x 5 root root 4096 5¿ù 25 16:01 media
drwxr-xr-x 2 root root 4096 5¿ù 25 15:14 misc
drwxr-xr-x 16 root root 4096 7¿ù 8 12:10 mnt
drwxr-xr-x 2 root root 4096 5¿ù 25 15:14 opt
drwxr-xr-x 2 root root 4096 5¿ù 25 15:14 proc
drwxr-xr-x 2 root root 4096 5¿ù 31 17:07 root
lrwxrwxrwx 1 root root 12 10¿ù 29 23:15 sbin -> initrd/sbin/
drwxr-xr-x 2 root root 4096 5¿ù 25 15:14 selinux
drwxr-xr-x 2 root root 4096 5¿ù 25 15:14 srv
drwxr-xr-x 2 root root 4096 5¿ù 25 15:14 sys
drwxrwxrwt 2 root root 4096 5¿ù 25 15:14 tmp
lrwxrwxrwx 1 root root 11 10¿ù 29 23:15 usr -> initrd/usr/
drwxr-xr-x 4 root root 4096 5¿ù 25 16:02 var
}}}
{{{
PrepareRealRootFilesystem()
# This function is called just before we exit the initrd environment.
# It replaces the initrd/busybox files with the real root filesystem files so
# that the kernel can start the init process and so on, as per a normal linux
# session. Plus a heap of other stuff.
{
local SQFS SQFS_DIRS DIR
[ $USE_UNIONFS = TRUE ] && modprobe unionfs >/dev/null
-----
# special case of loopback files not recommended
# setup links into /var
rm -f etc; rm -rf boot root tmp
ln -s var/boot var/etc var/home var/root var/tftpboot var/tmp /
if [ $ADIOSMOUNTED = FALSE ]; then
MountSquashFS adios /
ADIOSMOUNTED=TRUE
fi
# Replace busybox stuff with the real root files located in /adios and /var
if [ -f ${BOOTCD_DIR}/usr.sqfs ]; then
busybox rm -f usr
busybox mkdir usr
# allow for ext3 loopback filesystem similar to MountSquashFS usr /
if busybox [ $USE_UNIONFS = TRUE ]; then
busybox mkdir -p /mnt/usr /tmp/usr_cow
/initrd/bin/mount -r -o loop -t squashfs ${BOOTCD_DIR}/usr.sqfs /mnt/usr
/initrd/bin/mount -t unionfs -o dirs=/tmp/usr_cow:/mnt/usr none /usr
busybox echo "Mounting usr.sqfs on /usr with unionfs"
else
/initrd/bin/mount -r -o loop -t squashfs ${BOOTCD_DIR}/usr.sqfs /usr
busybox echo "Mounting usr.sqfs on /usr"
fi
busybox [ -f /usr/usr.loop ] &&
( busybox umount /usr; \
busybox mkdir -p /mnt/usr; \
/initrd/bin/mount -r -o loop -t squashfs ${BOOTCD_DIR}/usr.sqfs /mnt/usr; \
/initrd/bin/mount -r -o loop /mnt/usr/usr.loop /usr )
else
busybox rm -f usr
busybox echo "Linking /usr to /adios/usr"
busybox ln -s adios/usr /usr
fi
busybox rm -f bin lib sbin #remove links
busybox ln -s adios/bin adios/lib adios/sbin /
# magic for /mnt for UML children
busybox ln -s /var /etc /mnt
USE_UNIONFS=FALSE
# mount all the sqfs files in /opt (if any)
[ "$SQFS_DIR" != "$BOOTCD_DIR" ] && SQFS_DIRS="$BOOTCD_DIR $SQFS_DIR" || SQFS_DIRS=$BOOTCD_DIR
for DIR in $SQFS_DIRS; do
for SQFS in `ls ${DIR}/opt/*.sqfs`; do
SQFS=`basename ${SQFS%%.sqfs}`
mkdir -p /opt/${SQFS}
MountSquashFS $SQFS /opt/ $DIR
done
done
----
chmod 755 /var
# Delete files in initrd that are no longer needed. However we need to
# keep some files (eg busybox) coz they're used again at shutdown.
if [ $TRIMINITRD = "TRUE" ]; then
(rm -f /linuxrc /initrd/info /initrd/harddriveinstall)
(cd /initrd/sbin; rm -f *fsck *e2fs lvm)
(cd /initrd/usr; rm -rf share; rm -rf local)
fi
# Stuff to do on the *real* root filesystem. However we can only modify
# files under /var because the rest are in read-only squashfs files.
if [ $FIRST_BOOT = TRUE -o $REDETECT_HARDWARE = TRUE ]; then
cat /initrd/etc/fstab > /etc/fstab
(cd /etc; rm -f asound.state modprobe.conf* sysconfig/hwconf X11/xorg.conf*)
fi
[ $RUNLEVEL_CHANGED -eq 1 ] && sed -i "s#id:.#id:${RUNLEVEL}#" /etc/inittab
[ $DM_CHANGED -eq 1 ] && sed -i "s#^DISPLAYMANAGER=.*#DISPLAYMANAGER=${DM}#" /etc/sysconfig/desktop
[ $RHGB_CHANGED -eq 1 ] && sed -i "s#^GRAPHICAL=.*#GRAPHICAL=${RHGB}#" /etc/sysconfig/init
if [ $AUTOLOGIN_CHANGED -eq 1 ]; then
sed -i "s/^\(AutoLoginEnable=\).*$/\1${AUTOLOGIN}/" /etc/X11/xdm/kdmrc
sed -i "s/^\(AutomaticLoginEnable=\).*$/\1${AUTOLOGIN}/" /etc/X11/gdm/gdm.conf
fi
if [ $DESKTOP_CHANGED -eq 1 ]; then
sed -i "s#^DESKTOP=.*#DESKTOP=${DESKTOP}#" /etc/sysconfig/desktop
sed -i "s#^Session=.*#Session=${DESKTOP}#" /home/adios/.dmrc
chown adios.users /home/adios/.dmrc
fi
if [ $LANG_CHANGED -eq 1 ]; then
sed -i "s#^LANG=.*#LANG=${LANG}.utf8#" /etc/sysconfig/i18n
sed -i "s#^SUPPORTED=.*#SUPPORTED=${LANG}.utf8:${LANG}:${LANG%%_??}#" /etc/sysconfig/i18n
fi
if [ $KEYTABLE_CHANGED -eq 1 ]; then
sed -i "s#^KEYTABLE=.*#KEYTABLE=${KEYTABLE}#" /etc/sysconfig/keyboard
fi
if [ $UMLBRIDGE = TRUE ]; then
echo "/usr/local/sbin/umlbridge" >> /etc/rc.d/rc.local
fi
if [ $LAB_SERVER = TRUE ]; then
echo "/usr/local/sbin/labserver" >> /etc/rc.d/rc.local
fi
if [ "$CMDS" ]; then
echo "Executing: ${CMDS}"
eval "$CMDS"
sync
fi
# Setup X here so we can use rhgb (plus I don't really like the way fedora
# now runs system-config-display via kudzu)
if [ $RUNLEVEL -gt 3 -a ! -f $X_CONFIG_FILE ]; then
echo -n "Configuring X ... "
case $RESOLUTION in
system-config-display)
system-config-display ;;
Xorg)
Xorg -configure >/dev/null
egrep -v "ModulePath|FontPath" /x.conf.new | \
sed 's#\(.*RgbPath.*$\)#\1\n\tFontPath\t\"unix/:7100\"#g' > $X_CONFIG_FILE
rm -f /x.conf.new ;;
*) system-config-display --set-resolution=$RESOLUTION --set-depth=$DEPTH ;;
esac
fi
# fix init and halt before starting
# Makefile to add link for /sbin/init to /initrd/sbin/init
# Makefile to rm /var/etc/init.d/halt; ln -s /initrd/bin/busybox
# needs to be done before SELinux stuff so it gets labelled correctly
ln -s $REAL_ROOT_DEVNAME /dev/root
echo $REAL_ROOT_DEVNUM > /proc/sys/kernel/real-root-dev
if [ $SECURITY = lids -a $FIRST_BOOT = TRUE ]; then
echo -n "Updating LIDS dev/inode data ... "
lidsconf -U >/dev/null
lidsconf -U BOOT >/dev/null
lidsconf -U POSTBOOT >/dev/null
lidsconf -U SHUTDOWN >/dev/null
lidsconf -C >/dev/null
echo "Done."
elif [ $SECURITY = selinux ]; then
echo -n "Updating SELinux file labels ... "
if [ $FIRST_BOOT = TRUE ]; then
# make sure none of the selinux config files have future timestamps
hwclock --hctosys --localtime
find /etc/selinux -exec touch {} \;
# need to create /tmp/uml and give it the correct label
mkdir /var/tmp/uml
chown adios.users /var/tmp/uml
fi
# files in / are non-persistent and need to be relabelled each time
setfiles -q /etc/selinux/strict/src/policy/file_contexts/file_contexts / # and make sure all files in /var have the correct labels
setfiles -q /etc/selinux/strict/src/policy/file_contexts/file_contexts /var
sync
echo "Done."
fi
Debug on
if [ $REAL_ROOTFS_SHELL = TRUE ]; then
echo
echo -e "${WHITE}Dropping out to a shell on the real root filesystem."
echo -e "The init process will start when you exit this shell.${NORMAL}" echo
sh
fi
echo
}
}}}
{{{
TypicalLinuxrc
FindAdiosCD
PrepareRealRootFilesystem
}}}
* busybox ÀÇ ash ÀÇ ÇൿÀº ÀÌÇØÇÒ ¼ö ¾øÀ½.
* squashfs ·Î SQFS ¿¡ ¿Ã¸° ÈÄ Àý´ë°æ·Î¸¦ »ç¿ëÇÏ¿© ¸í·ÉÀ» ¼öÇàÇÒ °æ¿ì not found °¡ ³ª¿È.
* bin µð·ºÅ丮¸¦ ¸ÕÀú /SQFS/bin À¸·Î ¸µÅ© ½ÃÄѳõÀº °æ¿ì´Â ¼öÇàÀÌ µÊ.
=== 2005. 11. 2 ===
{{{
[root@localhost root]# cat /proc/mounts
rootfs / rootfs rw 0 0
none /sys sysfs rw 0 0
/dev/hdb2 /mnt/hdb2 ext2 ro 0 0
/dev/loop0 /SQFS squashfs ro 0 0
/dev/loop2 /USRFS squashfs ro 0 0
/ramdisk /ramdisk tmpfs rw 0 0
/UNIONFS /UNIONFS unionfs rw,dirs=/ramdisk/base=rw:/SQFS=ro,debug=0,delete=whiteout,copyup=preserve 0 0
none /UNIONFS1 unionfs rw,dirs=/ramdisk/usr=rw:/USRFS=ro,debug=0,delete=whiteout,copyup=preserve 0 0
/proc /proc proc rw,nodiratime 0 0
/proc/bus/usb /proc/bus/usb usbfs rw 0 0
none /dev tmpfs rw 0 0
none /dev/pts devpts rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
/dev/hdb1 /mnt/hdb1 ext2 rw,nosuid,nodev 0 0
}}}
[root@localhost root]# cat /etc/mtab
/dev/root / ext2 rw 0 0
usbfs /proc/bus/usb usbfs rw 0 0
/ramdisk /ramdisk tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
/dev/hdb1 /mnt/hdb1 ext2 rw,nosuid,nodev 0 0
[root@localhost root]# cat /etc/fstab # This file is edited by fstab-sync - see 'man fstab-sync' for details /dev/root / ext2 defaults 1 1 none /proc proc defaults 0 0 none /sys sysfs noauto 0 0 none /dev/pts devpts defaults 0 0 /dev/hdb2 /mnt/hdb2 ext2 noauto 0 0 # Added by BOOYO /dev/hdb1 /mnt/hdb1 ext2 noauto,users,exec 0 0 Çö »óÅÂ ¶
Á¶»çÇÒ °Í ¶
for i in bin etc lib sbin usr; do if /USRFS/usr/bin/test -d /$i; then mv /$i /$i.old && \ /SQFS/lib/ld-linux.so.2 --library-path /SQFS/lib /SQFS/bin/ln -snf /UNIONFS/$i /$i && \ rm -rf /$i.old else ln -snf /UNIONFS/$i /$i fi done
adios ¶
==== PutVar ===
¼ø¼ ¶
morphix ¶title Morphix kernel (cd)/boot/vmlinuz lang=us ramdisk_size=100000 init=/etc/init noapic acpi=off apm=power-off vga=791 splash=silent initrd=miniroot.gz quiet BOOT_IMAGE=morphix title Morphix | ACPI on kernel (cd)/boot/vmlinuz lang=us ramdisk_size=100000 init=/etc/init noapic vga=791 splash=silent initrd=miniroot.gz quiet BOOT_IMAGE=morphix title Morphix | Failsafe mode kernel (cd)/boot/vmlinuz lang=us ramdisk_size=100000 init=/etc/init acpi=off vga=normal nosound noapic noscsi nodma noapm nousb nopcmcia nofirewire noagp nomce nodhcp xmodule=vesa initrd=miniroot.gz BOOT_IMAGE=morphix title Morphix | Expert mode kernel (cd)/boot/vmlinuz lang=us ramdisk_size=100000 init=/etc/init noapic acpi=off apm=power-off vga=normal initrd=miniroot.gz BOOT_IMAGE=expert title Morphix | Copy media to ram before booting kernel (cd)/boot/vmlinuz lang=us ramdisk_size=100000 init=/etc/init noapic acpi=off apm=power-off vga=791 splash=silent initrd=miniroot.gz quiet BOOT_IMAGE=morphix toram title Morphix | Boot from USB v1 device kernel (cd)/boot/vmlinuz lang=us usbboot1 ramdisk_size=100000 init=/etc/init noapic acpi=off apm=power-off vga=791 splash=silent initrd=miniroot.gz quiet BOOT_IMAGE=morphix title Morphix | Boot from USB v2 device kernel (cd)/boot/vmlinuz lang=us usbboot2 ramdisk_size=100000 init=/etc/init noapic acpi=off apm=power-off vga=791 splash=silent initrd=miniroot.gz quiet BOOT_IMAGE=morphix title Morphix | Boot using persistant home kernel (cd)/boot/vmlinuz lang=us home=scan ramdisk_size=100000 init=/etc/init noapic acpi=off apm=power-off vga=791 splash=silent initrd=miniroot.gz quiet BOOT_IMAGE=morphix title Submenu -> Supported languages configfile (cd)/boot/grub/lang.lst title Submenu -> More boot options configfile (cd)/boot/grub/options.lst title Memtest | Memory diagnostic tool kernel (cd)/boot/memtest |
If it pours before seven, it has rained by eleven. |











