これが 最終の nitrd.gz を 展開して出来た initrd の 中の init です。
initrd の 中の /sbin/init ではない
#!/bin/sh
export PATH=/bin
mount -t proc proc /proc
mount -t sysfs sys /sys
# squashfs.ko needs xz_dec.ko
for i in aufs squashfs ; do
insmod /lib/modules/$i.ko
done
# nls_euc-jp.ko needs vfat.ko
for i in isofs nls_iso8859-1 nls_ascii nls_cp932 cdrom loop sr_mod sg \
fat vfat nls_euc-jp ; do
insmod /lib/modules/$i.ko
done
# for keyboard operation
for i in hid usbhid hid-generic ; do
insmod /lib/modules/$i.ko
done
mount UUID=cd4b4e85-b0f7-4652-a787-7594c06c727d /cdrom 2> /dev/null
CD_DEV=UUID=cd4b4e85-b0f7-4652-a787-7594c06c727d
echo "CD_DEV=UUID=cd4b4e85-b0f7-4652-a787-7594c06c727d "
sleep 10
echo "`df`"
echo "mount dev Where ? "
sleep 10
# mount squashfs'ed rootfs image into /loop
losetup /dev/loop0 /cdrom/isolinux/rootimg.squash
mount -t squashfs /cdrom/isolinux/rootimg.squash /loop
mount -t tmpfs none /loop/tmp
for i in var bin etc lib run usr boot home sbin root opt srv misc net \
install ; do
mkdir -p /loop/tmp/ow/$i
mount -t aufs -o br:/loop/tmp/ow/$i:/loop/$i none /loop/$i
done
mkdir -p /loop/dev
mount -t tmpfs tmpfs /loop/dev
cp -a /dev/console /loop/dev
echo "CD_DEV: $CD_DEV"
echo $CD_DEV > /loop/etc/cd_dev
mount --bind /proc /loop/proc
mount --bind /sys /loop/sys
echo "pivot_root to /loop"
sleep 5
cd /loop
pivot_root . loop
exec chroot . /loop/sbin/init
にゃんたろう 拝!
2014年 3月 23日 日曜日 22:00:01 JST 作成