diff options
author | Fernando Reyes (likewhoa) <design@missionaccomplish.com> | 2014-06-03 03:36:28 +0200 |
---|---|---|
committer | Rick Farina (Zero_Chaos) <zerochaos@gentoo.org> | 2015-08-11 14:21:16 -0400 |
commit | 4cfec5769e31d24d16c6cc582c5ab43f286f76b2 (patch) | |
tree | ba7d5ccf9a7a23480519befeec1bae07f078f1a9 /defaults | |
parent | dokeymap implementation for AUFS's union (diff) | |
download | genkernel-4cfec5769e31d24d16c6cc582c5ab43f286f76b2.tar.gz genkernel-4cfec5769e31d24d16c6cc582c5ab43f286f76b2.tar.bz2 genkernel-4cfec5769e31d24d16c6cc582c5ab43f286f76b2.zip |
A new bootstrapFS function has been added to cut on duplicate code
use which both aufs and squashfs boot types use and this it's moved
to the top of the boot process.
Diffstat (limited to 'defaults')
-rw-r--r-- | defaults/initrd.scripts | 70 | ||||
-rw-r--r-- | defaults/linuxrc | 29 |
2 files changed, 50 insertions, 49 deletions
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index fe563fe..eb5ed6a 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -177,6 +177,52 @@ devicelist(){ echo ${DEVICES} } +bootstrapFS() { + if [ "${USE_AUFS_NORMAL}" -eq '1' ]; then + # Directories used for rw changes in union mount filesystem + UNION=/union MEMORY=/memory + + # Mountpoint for the changesdev + CHANGESMNT=${NEW_ROOT}/mnt/changesdev + + if [ -z "$UID" ]; then + CHANGES=${MEMORY}/aufs_changes/default + else + CHANGES=${MEMORY}/aufs_changes/${UID} + fi + + mkdir -p ${MEMORY} ${UNION} ${CHANGESMNT} + else + # Legacy SquashFS implementation + good_msg "Making tmpfs for ${NEW_ROOT}" + mount -n -t tmpfs tmpfs ${NEW_ROOT} + fi + + # Setup the filesystem nodes and directories + for i in ${CDROOT_PATH} /mnt/livecd /mnt/key /mnt/gentoo /tmp /tmp/.initrd /dev /proc /run /sys; do + mkdir -p "${NEW_ROOT}${i}" + chmod 755 "${NEW_ROOT}${i}" + done + + [ ! -d "${CDROOT_PATH}" ] && mkdir -p "${CDROOT_PATH}" + [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3 + [ ! -e "${NEW_ROOT}/dev/zero" ] && mknod -m 660 "${NEW_ROOT}"/dev/zero c 1 5 + [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1 + [ ! -e "${NEW_ROOT}/dev/ttyS0" ] && mknod -m 600 "${NEW_ROOT}"/dev/ttyS0 c 4 64 + + # For SGI LiveCDs + if [ "${LOOPTYPE}" = "sgimips" ]; then + [ ! -e "${NEW_ROOT}/dev/sr0" ] && mknod "${NEW_ROOT}/dev/sr0" b 11 0 + [ ! -e "${NEW_ROOT}/dev/loop0" ] && mknod "${NEW_ROOT}/dev/loop0" b 7 0 + fi + + # Required for splash to work. Not an issue with the initrd as this + # device isn't created there and is not needed. + for minor in 0 1 ; do + [ ! -e "${NEW_ROOT}/dev/$minor" ] && mknod -m 600 "${NEW_ROOT}/dev/tty$minor" c 4 $minor + done +} + bootstrapCD() { local DEVICES= @@ -302,30 +348,8 @@ create_changefs() { } setup_aufs() { - # Directory used for rw changes in union mount filesystem - UNION=/union - MEMORY=/memory - # Mountpoint for the changesdev - CHANGESMNT=${NEW_ROOT}/mnt/changesdev - if [ -z "$UID" ] - then - CHANGES=${MEMORY}/aufs_changes/default - else - CHANGES=${MEMORY}/aufs_changes/${UID} - fi - - mkdir -p ${MEMORY} - mkdir -p ${UNION} - mkdir -p ${CHANGESMNT} - for i in dev mnt ${CDROOT_PATH} mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys - do - mkdir -p "${NEW_ROOT}/${i}" - chmod 755 "${NEW_ROOT}/${i}" - done - [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3 - [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1 - bootstrapCD + if [ -n "${AUFS}" ] then if [ "${AUFS}" = "detect" ] diff --git a/defaults/linuxrc b/defaults/linuxrc index da88bf0..0e40d16 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -458,40 +458,17 @@ rundebugshell "before setting up the root filesystem" if [ "${CDROOT}" = '1' ] then + # Setup the root filesystem + bootstrapFS + if [ "${USE_AUFS_NORMAL}" -eq '1' ] then setup_aufs CHROOT=${UNION} else CHROOT=${NEW_ROOT} - good_msg "Making tmpfs for ${NEW_ROOT}" - mount -n -t tmpfs tmpfs ${NEW_ROOT} - - for i in dev mnt ${CDROOT_PATH} proc run mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys - do - mkdir -p "${NEW_ROOT}/${i}" - chmod 755 "${NEW_ROOT}/${i}" - done - [ ! -d "${CDROOT_PATH}" ] && mkdir -p "${CDROOT_PATH}" - [ ! -e "${NEW_ROOT}/dev/null" ] && mknod -m 666 "${NEW_ROOT}"/dev/null c 1 3 - [ ! -e "${NEW_ROOT}/dev/zero" ] && mknod -m 666 "${NEW_ROOT}"/dev/zero c 1 5 - [ ! -e "${NEW_ROOT}/dev/console" ] && mknod -m 600 "${NEW_ROOT}"/dev/console c 5 1 - [ ! -e "${NEW_ROOT}/dev/ttyS0" ] && mknod -m 660 "${NEW_ROOT}"/dev/ttyS0 c 4 64 fi - # For SGI LiveCDs ... - if [ "${LOOPTYPE}" = "sgimips" ] - then - [ ! -e "${NEW_ROOT}/dev/sr0" ] && mknod "${NEW_ROOT}/dev/sr0" b 11 0 - [ ! -e "${NEW_ROOT}/dev/loop0" ] && mknod "${NEW_ROOT}/dev/loop0" b 7 0 - fi - - # Required for splash to work. Not an issue with the initrd as this - # device isn't created there and is not needed. - for minor in 0 1 ; do - [ ! -e "${NEW_ROOT}/dev/$minor" ] && mknod -m 600 "${NEW_ROOT}/dev/tty$minor" c 4 $minor - done - if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ] && [ "${USE_AUFS_NORMAL}" != '1' ] then bootstrapCD |