Removed extra tmpfs from initramfs, limited size of newroot tempfs

This commit is contained in:
Matt Housh 2017-11-24 14:42:49 -06:00
parent 8b1a877e21
commit d8f081e6af

View File

@ -35,11 +35,6 @@ echoDone() {
# search for and mount the crux media, populate a tmpfs from it, # search for and mount the crux media, populate a tmpfs from it,
# and prepare /newroot for switch_root at the end of the script # and prepare /newroot for switch_root at the end of the script
find_and_mount_media() { find_and_mount_media() {
echo -e -n " ${BOLD}${BLUE}*${NORM} Creating and mounting tmpfs... "
mkdir /.tmpfs
mount -t tmpfs tmpfs /.tmpfs
checkReturn
grep -q "prefix=*" /proc/cmdline grep -q "prefix=*" /proc/cmdline
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
@ -52,10 +47,11 @@ find_and_mount_media() {
fi fi
done done
fi fi
MEDIAMNT=/.tmpfs/.media
MEDIAMNT=/media
mkdir -p ${MEDIAMNT}
echo -e " ${BOLD}${BLUE}*${NORM} Searching for the CRUX media..." echo -e " ${BOLD}${BLUE}*${NORM} Searching for the CRUX media..."
mkdir -p ${MEDIAMNT}
CRUXMEDIA="" CRUXMEDIA=""
CDROM_DEVICES="`awk '/drive name:/ { for (i=3;i<=NF;i++) { printf("%s ", $i) } }' /proc/sys/dev/cdrom/info`" CDROM_DEVICES="`awk '/drive name:/ { for (i=3;i<=NF;i++) { printf("%s ", $i) } }' /proc/sys/dev/cdrom/info`"
BLOCK_DEVICES="`grep -E '[shv]d' /proc/partitions | awk '{ print $4 }'`" BLOCK_DEVICES="`grep -E '[shv]d' /proc/partitions | awk '{ print $4 }'`"
@ -106,7 +102,7 @@ find_and_mount_media() {
echo -e " ${BOLD}${BLUE}*${NORM} Populating root filesystem..." echo -e " ${BOLD}${BLUE}*${NORM} Populating root filesystem..."
mkdir -p /newroot mkdir -p /newroot
echo -e -n " ${BOLD}${BLUE}*${NORM} Mounting new root filesystem... " echo -e -n " ${BOLD}${BLUE}*${NORM} Mounting new root filesystem... "
mount -t tmpfs tmpfs /newroot mount -t tmpfs -o size=320m tmpfs /newroot
checkReturn checkReturn
echo -e -n " ${BOLD}${BLUE}*${NORM} Copying files from rootfs.tar.xz... " echo -e -n " ${BOLD}${BLUE}*${NORM} Copying files from rootfs.tar.xz... "
tar -xJf ${MEDIAMNT}/${PREFIX}/rootfs.tar.xz -C /newroot tar -xJf ${MEDIAMNT}/${PREFIX}/rootfs.tar.xz -C /newroot
@ -120,11 +116,6 @@ find_and_mount_media() {
umount ${MEDIAMNT} umount ${MEDIAMNT}
rmdir ${MEDIAMNT} rmdir ${MEDIAMNT}
sed -i -e "s,#CRUXMEDIA#,${CRUXMEDIA}," /newroot/etc/fstab sed -i -e "s,#CRUXMEDIA#,${CRUXMEDIA}," /newroot/etc/fstab
echo -e -n " ${BOLD}${BLUE}*${NORM} Unmounting tmpfs... "
umount /.tmpfs
checkReturn
rmdir /.tmpfs
} }
/bin/busybox --install -s /bin /bin/busybox --install -s /bin
@ -158,12 +149,6 @@ then
DSHELL=1 DSHELL=1
fi fi
if [ ! -z "$DSHELL" ]
then
echo "Starting debug shell."
/bin/ash
fi
echo -e -n " ${BOLD}${BLUE}*${NORM} Populating /dev via mdev... " echo -e -n " ${BOLD}${BLUE}*${NORM} Populating /dev via mdev... "
mdev -s mdev -s
checkReturn checkReturn
@ -352,6 +337,12 @@ then
cp /bin/busybox /newroot/bin/ cp /bin/busybox /newroot/bin/
fi fi
if [ ! -z "$DSHELL" ]
then
echo "Starting debug shell."
/bin/ash
fi
echo -e " ${BOLD}${BLUE}*${NORM} Switching root.\n" echo -e " ${BOLD}${BLUE}*${NORM} Switching root.\n"
echo "$PRINTK" > /proc/sys/kernel/printk echo "$PRINTK" > /proc/sys/kernel/printk
echo > /proc/sys/kernel/hotplug echo > /proc/sys/kernel/hotplug