Commit cb013df1 authored by Ain's avatar Ain Committed by Natanael Copa
Browse files

Move code blocks for initializing the early userspace together

parent 06e34557
......@@ -7,20 +7,6 @@ sysroot=/sysroot
splashfile=/.splash.ctrl
repofile=/tmp/repositories
/bin/busybox mkdir -p /usr/bin /usr/sbin /proc /sys /dev $sysroot \
/media/cdrom /media/usb /tmp /run
/bin/busybox --install -s
# basic environment
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# needed devs
[ -c /dev/null ] || mknod -m 666 /dev/null c 1 3
# basic mounts
mount -t proc -o noexec,nosuid,nodev proc /proc
mount -t sysfs -o noexec,nosuid,nodev sysfs /sys
# some helpers
ebegin() {
last_emsg="$*"
......@@ -293,6 +279,34 @@ is_url() {
esac
}
/bin/busybox mkdir -p /usr/bin /usr/sbin /proc /sys /dev $sysroot \
/media/cdrom /media/usb /tmp /run
# Spread out busybox symlinks and make them available without full path
/bin/busybox --install -s
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Make sure /dev/null is a device node. If /dev/null does not exist yet, the command
# mounting the devtmpfs will create it implicitly as an file with the "2>" redirection.
# The -c check is required to deal with initramfs with pre-seeded device nodes without
# error message.
[ -c /dev/null ] || mknod -m 666 /dev/null c 1 3
mount -t proc -o noexec,nosuid,nodev proc /proc
mount -t sysfs -o noexec,nosuid,nodev sysfs /sys
mount -t devtmpfs -o exec,nosuid,mode=0755,size=2M devtmpfs /dev 2>/dev/null \
|| mount -t tmpfs -o exec,nosuid,mode=0755,size=2M tmpfs /dev
# pty device nodes (later system will need it)
[ -c /dev/ptmx ] || mknod -m 666 /dev/ptmx c 5 2
[ -d /dev/pts ] || mkdir -m 755 /dev/pts
mount -t devpts -o gid=5,mode=0620,noexec,nosuid devpts /dev/pts
# shared memory area (later system will need it)
[ -d /dev/shm ] || mkdir /dev/shm
mount -t tmpfs -o nodev,nosuid,noexec shm /dev/shm
# read the kernel options. we need surve things like:
# acpi_osi="!Windows 2006" xen-pciback.hide=(01:00.0)
set -- $(cat /proc/cmdline)
......@@ -356,18 +370,6 @@ for i in ${KOPT_blacklist//,/ }; do
echo "blacklist $i" >> /etc/modprobe.d/boot-opt-blacklist.conf
done
# setup /dev
mount -t devtmpfs -o exec,nosuid,mode=0755,size=2M devtmpfs /dev 2>/dev/null \
|| mount -t tmpfs -o exec,nosuid,mode=0755,size=2M tmpfs /dev
[ -d /dev/pts ] || mkdir -m 755 /dev/pts
[ -c /dev/ptmx ] || mknod -m 666 /dev/ptmx c 5 2
# make sure /dev/null is setup correctly
[ -f /dev/null ] && rm -f /dev/null
[ -c /dev/null ] || mknod -m 666 /dev/null c 1 3
mount -t devpts -o gid=5,mode=0620,noexec,nosuid devpts /dev/pts
[ -d /dev/shm ] || mkdir /dev/shm
mount -t tmpfs -o nodev,nosuid,noexec shm /dev/shm
# determine if we are going to need networking
if [ -n "$KOPT_ip" ] || [ -n "$KOPT_nbd" ] || \
is_url "$KOPT_apkovl" || is_url "$ALPINE_REPO"; then
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment