|
|
@ -680,7 +680,7 @@ then
|
|
|
|
echo -n '.'
|
|
|
|
echo -n '.'
|
|
|
|
|
|
|
|
|
|
|
|
# /usr/src/linux/Documentation/initrd.txt:
|
|
|
|
# /usr/src/linux/Documentation/initrd.txt:
|
|
|
|
# exec chroot . /sbin/init </dev/console >/dev/console 2>&1
|
|
|
|
# exec chroot . /sbin/init </dev/console >/dev/console 2>&1
|
|
|
|
|
|
|
|
|
|
|
|
exec <dev/console >dev/console 2>&1
|
|
|
|
exec <dev/console >dev/console 2>&1
|
|
|
|
echo '.'
|
|
|
|
echo '.'
|
|
|
@ -691,58 +691,58 @@ then
|
|
|
|
EOF
|
|
|
|
EOF
|
|
|
|
elif [ "$0" = '/init' ]
|
|
|
|
elif [ "$0" = '/init' ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
[ ! -e /${CHROOT}/dev/console ] && mknod /${CHROOT}/dev/console c 5 1
|
|
|
|
[ ! -e ${CHROOT}/dev/console ] && mknod ${CHROOT}/dev/console c 5 1
|
|
|
|
[ ! -e /${CHROOT}/dev/tty1 ] && mknod /${CHROOT}/dev/tty1 c 4 1
|
|
|
|
[ ! -e ${CHROOT}/dev/tty1 ] && mknod ${CHROOT}/dev/tty1 c 4 1
|
|
|
|
echo -ne "${GOOD}>>${NORMAL}${BOLD} Booting (initramfs)"
|
|
|
|
echo -ne "${GOOD}>>${NORMAL}${BOLD} Booting (initramfs)"
|
|
|
|
|
|
|
|
|
|
|
|
cd ${CHROOT}
|
|
|
|
cd ${CHROOT}
|
|
|
|
mkdir /${CHROOT}/proc /${CHROOT}/sys 2>/dev/null
|
|
|
|
mkdir ${CHROOT}/proc ${CHROOT}/sys 2>/dev/null
|
|
|
|
echo -n '.'
|
|
|
|
echo -n '.'
|
|
|
|
umount /sys || echo '*: Failed to unmount the initrd /sys!'
|
|
|
|
umount /sys || echo '*: Failed to unmount the initrd /sys!'
|
|
|
|
umount /proc || echo '*: Failed to unmount the initrd /proc!'
|
|
|
|
umount /proc || echo '*: Failed to unmount the initrd /proc!'
|
|
|
|
echo -n '.'
|
|
|
|
echo -n '.'
|
|
|
|
|
|
|
|
|
|
|
|
exec <${CONSOLE} >${CONSOLE} 2>&1
|
|
|
|
exec <${CONSOLE} >${CONSOLE} 2>&1
|
|
|
|
echo '.'
|
|
|
|
echo '.'
|
|
|
|
|
|
|
|
|
|
|
|
# Cleanup initramfs in the background
|
|
|
|
# Cleanup initramfs in the background
|
|
|
|
# to reclaim initramfs tmpfs memoryspace
|
|
|
|
# to reclaim initramfs tmpfs memoryspace
|
|
|
|
|
|
|
|
|
|
|
|
INITRAMFS_FILES=`ls / | sed -e 's|dev||'`
|
|
|
|
INITRAMFS_FILES=`ls / | sed -e 's|dev||'`
|
|
|
|
INITRAMFS_FILES=`echo ${INITRAMFS_FILES}|sed -e "s|${CHROOT#/}||g"`
|
|
|
|
INITRAMFS_FILES=`echo ${INITRAMFS_FILES}|sed -e "s|${CHROOT#/}||g"`
|
|
|
|
|
|
|
|
|
|
|
|
if [ -n "${MEMORY}" ]
|
|
|
|
if [ -n "${MEMORY}" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
INITRAMFS_FILES=`echo ${INITRAMFS_FILES}|sed -e "s|${MEMORY#/}||g"`
|
|
|
|
INITRAMFS_FILES=`echo ${INITRAMFS_FILES}|sed -e "s|${MEMORY#/}||g"`
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ -n "${UNION}" ]
|
|
|
|
if [ -n "${UNION}" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
INITRAMFS_FILES=`echo ${INITRAMFS_FILES}|sed -e "s|${UNION#/}||g"`
|
|
|
|
INITRAMFS_FILES=`echo ${INITRAMFS_FILES}|sed -e "s|${UNION#/}||g"`
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
INITRAMFS_FILES=`echo ${INITRAMFS_FILES}|sed -e "s|newroot||g"`
|
|
|
|
INITRAMFS_FILES=`echo ${INITRAMFS_FILES}|sed -e "s|newroot||g"`
|
|
|
|
|
|
|
|
|
|
|
|
for i in ${INITRAMFS_FILES}
|
|
|
|
for i in ${INITRAMFS_FILES}
|
|
|
|
do
|
|
|
|
do
|
|
|
|
for j in `/bin/busybox find /$i 2> /dev/null`
|
|
|
|
for j in `/bin/busybox find /$i 2> /dev/null`
|
|
|
|
do
|
|
|
|
do
|
|
|
|
if /bin/busybox [ ! -d "$j" -a "$j" != "/bin/busybox" ]
|
|
|
|
if /bin/busybox [ ! -d "$j" -a "$j" != "/bin/busybox" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
/bin/busybox rm "$j"
|
|
|
|
/bin/busybox rm -f "$j"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if /bin/busybox [ -d "${j}" -a "${j}" != "/bin" -a "${j}" != "/dev" -a "${j}" != "/sys" ]
|
|
|
|
if /bin/busybox [ -d "${j}" -a "${j}" != "/bin" -a "${j}" != "/dev" -a "${j}" != "/sys" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
/bin/busybox rm -r "$j"
|
|
|
|
/bin/busybox rm -rf "$j"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
# End initramfs cleanup
|
|
|
|
# End initramfs cleanup
|
|
|
|
|
|
|
|
|
|
|
|
# Start the real root init
|
|
|
|
# Start the real root init
|
|
|
|
(/bin/busybox sleep 3; /bin/busybox rm -r /bin/busybox /dev) &
|
|
|
|
(/bin/busybox sleep 3; /bin/busybox rm -r /bin/busybox /dev) &
|
|
|
|
exec /bin/busybox chroot . /bin/sh <<- EOF
|
|
|
|
exec /bin/busybox chroot . /bin/sh <<- EOF
|
|
|
|
exec /sbin/init ${REAL_INIT}
|
|
|
|
exec /sbin/init ${REAL_INIT}
|
|
|
|
EOF
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|