summaryrefslogtreecommitdiffstats
path: root/core/rootfs
diff options
context:
space:
mode:
Diffstat (limited to 'core/rootfs')
-rw-r--r--core/rootfs/rootfs-kernel/README1
-rw-r--r--core/rootfs/rootfs-kernel/module.build31
-rw-r--r--core/rootfs/rootfs-kernel/module.conf1
-rwxr-xr-xcore/rootfs/rootfs-stage31/data/init18
-rw-r--r--core/rootfs/rootfs-stage31/module.conf1
-rw-r--r--core/rootfs/rootfs-stage32/data/etc/systemd/system/load-gfx-driver.service9
l---------core/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/load-gfx-driver.service1
l---------core/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/zram-swap.service1
-rw-r--r--core/rootfs/rootfs-stage32/data/etc/systemd/system/zram-swap.service10
-rw-r--r--core/rootfs/rootfs-stage32/data/etc/tmpfiles.d/openslx-log.conf1
-rwxr-xr-xcore/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-load_gfx_driver16
-rwxr-xr-xcore/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-zram_swap115
-rw-r--r--core/rootfs/rootfs-stage32/module.build6
-rw-r--r--core/rootfs/rootfs-stage32/module.conf1
14 files changed, 52 insertions, 160 deletions
diff --git a/core/rootfs/rootfs-kernel/README b/core/rootfs/rootfs-kernel/README
new file mode 100644
index 00000000..87cb6c88
--- /dev/null
+++ b/core/rootfs/rootfs-kernel/README
@@ -0,0 +1 @@
+-- This module is mostly for the install mode --
diff --git a/core/rootfs/rootfs-kernel/module.build b/core/rootfs/rootfs-kernel/module.build
new file mode 100644
index 00000000..0ac57b6f
--- /dev/null
+++ b/core/rootfs/rootfs-kernel/module.build
@@ -0,0 +1,31 @@
+#!/bin/bash
+fetch_source() {
+ :
+}
+
+build() {
+ :
+}
+
+post_copy() {
+ # first copy kernel
+ copy_kernel
+
+ # now copy all the firmware and kernel modules
+ # to preserve the build environment, we copy instead of moving
+ mkdir -p "${TARGET_BUILD_DIR}/lib"
+ rsync -aAXv "${KERNEL_BASE_DIR}/lib/firmware" "${TARGET_BUILD_DIR}/lib" || \
+ perror "Failed to copy firmware to '${TARGET_BUILD_DIR}/lib'."
+ rsync -aAXv "${KERNEL_BASE_DIR}/lib/modules" "${TARGET_BUILD_DIR}/lib" || \
+ perror "Failed to copy kernel modules to '${TARGET_BUILD_DIR}/lib'."
+
+ # NOTE: if symlinks are present in ./lib/modules/<version>/kernel, they
+ # are likely pointing to mltk's kernel work dir, thus unusable in live
+ # systems. We just delete those for now.
+ for LINK in "${TARGET_BUILD_DIR}/lib/modules/${TARGET_KERNEL_LONG}/"{build,source}; do
+ if [ -h "${LINK}" ]; then
+ pinfo "Removing '${LINK}' as it won't point to a valid path on live systems."
+ unlink "${LINK}" || perror "Failed to unlink '${LINK}'."
+ fi
+ done
+}
diff --git a/core/rootfs/rootfs-kernel/module.conf b/core/rootfs/rootfs-kernel/module.conf
new file mode 100644
index 00000000..ce993cdd
--- /dev/null
+++ b/core/rootfs/rootfs-kernel/module.conf
@@ -0,0 +1 @@
+REQUIRED_MODULES="kernel"
diff --git a/core/rootfs/rootfs-stage31/data/init b/core/rootfs/rootfs-stage31/data/init
index 4615a4fb..5857362c 100755
--- a/core/rootfs/rootfs-stage31/data/init
+++ b/core/rootfs/rootfs-stage31/data/init
@@ -1,4 +1,4 @@
-#!/bin/ash
+#!/opt/openslx/bin/ash
# -----------------------------------------------------------------------------
#
# Copyright (c) 2012..2018 bwLehrpool-Projektteam
@@ -16,8 +16,18 @@
# First script for initial ramfs for OpenSLX linux stateless clients
#############################################################################
-# set PATH correctly
-export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/openslx/bin
+# set PATH correctly including busybox's in /opt/openslx/*
+export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/openslx/bin:/opt/openslx/sbin
+
+# TODO fix this ugly part...
+# some binaries have hardcoded path to /sbin, e.g. brctl needs /sbin/modprobe
+# to load bridge.ko - thus we provide this by symlinking busybox's sbin folder.
+# this hopefully covers most such hardcoded calls...
+[ ! -d /sbin ] && ln -s /opt/openslx/sbin /sbin
+# if /sbin is present, at least make sure we have modprobe...
+[ ! -e /sbin/modprobe ] && ln -s /opt/openslx/sbin/modprobe /sbin/modprobe
+# also make sure other script can use /bin/ash safely...
+[ ! -e /bin/ash ] && ln -s /opt/openslx/bin/busybox /bin/ash
# import common functions
. "/inc/functions"
@@ -153,7 +163,7 @@ showicon --icon "/opt/openslx/icons/active/??-rootfs.ppm"
# copy files needed for stage3.2 to FUTURE_ROOT
echo "Copying busybox etc. to stage32..."
-tar -cp /bin/* /sbin/* | tar -xp -C "${FUTURE_ROOT}/opt/openslx/"
+tar -cp /opt/openslx/bin/* /opt/openslx/sbin/* | tar -xp -C "${FUTURE_ROOT}/"
mkdir -p "${FUTURE_ROOT}/opt/openslx/inc"
cp -a "/inc/functions" "${FUTURE_ROOT}/opt/openslx/inc/"
diff --git a/core/rootfs/rootfs-stage31/module.conf b/core/rootfs/rootfs-stage31/module.conf
index e14b1c94..e95a1182 100644
--- a/core/rootfs/rootfs-stage31/module.conf
+++ b/core/rootfs/rootfs-stage31/module.conf
@@ -5,6 +5,7 @@ REQUIRED_BINARIES="
REQUIRED_MODULES="
busybox
kernel
+ slxlog
system-uuid
haveged
"
diff --git a/core/rootfs/rootfs-stage32/data/etc/systemd/system/load-gfx-driver.service b/core/rootfs/rootfs-stage32/data/etc/systemd/system/load-gfx-driver.service
deleted file mode 100644
index 0534f45c..00000000
--- a/core/rootfs/rootfs-stage32/data/etc/systemd/system/load-gfx-driver.service
+++ /dev/null
@@ -1,9 +0,0 @@
-[Unit]
-Description=Load DRM GFX driver and 3D
-Before=sysinit.target shutdown.target
-DefaultDependencies=no
-
-[Service]
-Type=oneshot
-ExecStart=/opt/openslx/scripts/systemd-load_gfx_driver
-RemainAfterExit=yes
diff --git a/core/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/load-gfx-driver.service b/core/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/load-gfx-driver.service
deleted file mode 120000
index b72d0453..00000000
--- a/core/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/load-gfx-driver.service
+++ /dev/null
@@ -1 +0,0 @@
-../load-gfx-driver.service \ No newline at end of file
diff --git a/core/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/zram-swap.service b/core/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/zram-swap.service
deleted file mode 120000
index c1754b11..00000000
--- a/core/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/zram-swap.service
+++ /dev/null
@@ -1 +0,0 @@
-../zram-swap.service \ No newline at end of file
diff --git a/core/rootfs/rootfs-stage32/data/etc/systemd/system/zram-swap.service b/core/rootfs/rootfs-stage32/data/etc/systemd/system/zram-swap.service
deleted file mode 100644
index a458b380..00000000
--- a/core/rootfs/rootfs-stage32/data/etc/systemd/system/zram-swap.service
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Setup zram swap partitions
-DefaultDependencies=no
-Wants=swap.target
-Before=swap.target
-
-[Service]
-Type=oneshot
-ExecStart=/opt/openslx/scripts/systemd-zram_swap
-RemainAfterExit=yes
diff --git a/core/rootfs/rootfs-stage32/data/etc/tmpfiles.d/openslx-log.conf b/core/rootfs/rootfs-stage32/data/etc/tmpfiles.d/openslx-log.conf
deleted file mode 100644
index 4d93fb9c..00000000
--- a/core/rootfs/rootfs-stage32/data/etc/tmpfiles.d/openslx-log.conf
+++ /dev/null
@@ -1 +0,0 @@
-d /var/log/openslx 0777 root root
diff --git a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-load_gfx_driver b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-load_gfx_driver
deleted file mode 100755
index 2d113638..00000000
--- a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-load_gfx_driver
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-if lsmod | grep -q '^nvidia\s'; then
- # nvidia kernel module was loaded in stage31 - download libs
- version=$( cat /sys/module/nvidia/version )
- if [ -n "$version" ]; then
- echo "Proprietary nvidia kernel drivers v$version loaded - fetch user space libs"
- /opt/openslx/scripts/systemd-download_slx_addons "nvidia-libs@$version"
- /opt/openslx/scripts/systemd-setup_slx_addons "nvidia-libs@$version" || exit 1
- fi
-fi
-
-# Seems we can finally always do that; in fact, not doing so seems to crash VMs left and right
-echo -e "# Written by load-gfx-driver\nSLX_VMWARE_3D=yes" >> "/opt/openslx/config"
-
-exit 0
diff --git a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-zram_swap b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-zram_swap
deleted file mode 100755
index 413ce215..00000000
--- a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-zram_swap
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/bin/ash
-# -----------------------------------------------------------------------------
-#
-# Copyright (c) 2013..2018 bwLehrpool-Projektteam
-#
-# This program/file is free software distributed under the GPL version 2.
-# See https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
-#
-# If you have any feedback please consult https://bwlehrpool.de and
-# send your feedback to support@bwlehrpool.de.
-#
-# General information about bwLehrpool can be found at https://bwlehrpool.de
-#
-# -----------------------------------------------------------------------------
-#
-# Local hard disk autodetection script for OpenSLX linux stateless clients,
-# detecting swap and special partitions
-
-#############################################################################
-
-
-# Add zram swap
-# Some older ubuntu kernels had a problem here, see https://bugs.launchpad.net/ubuntu/+source/linux-lts-raring/+bug/1217189
-# So make sure you're up to date
-
-make_swap () {
- [ $# -ne 3 ] && echo "make_swap: Wrong parameter count $#" && return 1
- local USE="$1"
- local DEV="$2"
- local STREAMS="$3"
- echo "$USE" > "/sys/block/zram${DEV}/disksize" || return 1
- [ -n "$STREAMS" ] && echo "$STREAMS" > "/sys/block/zram${DEV}/max_comp_streams"
- (
- mkswap "/dev/zram${DEV}"
- swapon "/dev/zram${DEV}" -p 1000 # high priority (in case we have hdd swap 0x82, prefer zram)
- ) &
-}
-
-# Count physical CPUs
-CPUS=$(cat /sys/devices/system/cpu/cpu*/topology/thread_siblings_list | sort -u | wc -l) # cat for *
-if [ -z "$CPUS" ]; then
- echo "ERROR: Could not determine CPU core count"
-else
- CPUS=1
-fi
-
-KERN=$(uname -r)
-if [ "${KERN%%.*}" -le 4 ]; then
- DEVS=$CPUS
- [ "$DEVS" -gt "16" ] && DEVS=16 # zram can only handle up to 32 devices, the system can apparently even just handle 29 swap partitions, so use a reasonable upper limit
- STREAMS=
-else
- DEVS=1
- STREAMS=$CPUS
-fi
-
-if [ -e "/sys/class/zram-control/hot_add" ]; then
- : # nothing to do, loaded and hot_add available
-elif ! modprobe zram "num_devices=$DEVS"; then
- echo "ERROR: Could not load zram module"
- exit 1
-fi
-
-TOTAL=$(grep ^MemTotal /proc/meminfo | awk '{print $2}')
-USE=$(( TOTAL / ( 2 * DEVS ) ))
-echo "Have $CPUS cores, $TOTAL kb mem, use $USE kb zram swap each for $DEVS devices."
-USE=$(( USE * 1024 ))
-DEV=0
-NUM=0
-FAILS=0
-while [ "$NUM" -lt "$DEVS" ]; do
- if [ -e "/sys/block/zram${DEV}" ]; then
- if ! [ -e "/sys/block/zram${DEV}/initstate" ] || [ "$(cat "/sys/block/zram${DEV}/initstate")" = 0 ]; then
- if make_swap "$USE" "$DEV" "$STREAMS"; then
- NUM=$(( NUM + 1 ))
- fi
- fi
- DEV=$(( DEV + 1 ))
- elif [ -e "/sys/class/zram-control/hot_add" ]; then
- DEV=$(cat /sys/class/zram-control/hot_add)
- if [ -z "$DEV" ]; then
- echo "ERROR: Cannot hot_add another zram device"
- break
- fi
- if make_swap "$USE" "$DEV" "$STREAMS"; then
- NUM=$(( NUM + 1 ))
- else
- FAILS=$(( FAILS + 1 ))
- if [ "$FAILS" -gt 4 ]; then
- echo "ERROR: Could not swap on hot added device -- giving up"
- break
- fi
- fi
- DEV=$(( DEV + 1 ))
- else
- echo "ERROR: Cannot add another zram device: No hot_add support"
- break
- fi
-done
-
-# Increase min free memory so we have enough mem available when trying to move
-# something to zram swap. We want 1%, or at least 64MiB
-CURRENT=$(cat "/proc/sys/vm/min_free_kbytes")
-TOTAL=$(awk '{ if ($1 == "MemTotal:") { print $2; exit } }' /proc/meminfo)
-WANT=$(( TOTAL / 100 ))
-[ "$WANT" -gt 65535 ] || WANT=65535 # minimum 64M
-if [ "$CURRENT" -lt "$WANT" ]; then
- echo "$WANT" > "/proc/sys/vm/min_free_kbytes"
-fi
-
-# Wait, so we don't trigger swap.target too early
-wait
-
-exit 0
-
diff --git a/core/rootfs/rootfs-stage32/module.build b/core/rootfs/rootfs-stage32/module.build
index f20c5196..d6760002 100644
--- a/core/rootfs/rootfs-stage32/module.build
+++ b/core/rootfs/rootfs-stage32/module.build
@@ -101,9 +101,9 @@ post_copy() {
init_users_and_groups
# quick fix for missing group in /etc/group
- add_group "lock"
- add_group "nogroup" 65534
- USERID=65534 GROUPID=65534 add_user "nobody"
+ add_system_group "lock"
+ add_system_group "nogroup" 65534
+ USERID=65534 GROUPID=65534 add_system_user "nobody"
# setup root account
PASSWORD= USER=root add_user
diff --git a/core/rootfs/rootfs-stage32/module.conf b/core/rootfs/rootfs-stage32/module.conf
index 5fb5a08a..f875a1eb 100644
--- a/core/rootfs/rootfs-stage32/module.conf
+++ b/core/rootfs/rootfs-stage32/module.conf
@@ -2,6 +2,7 @@
REQUIRED_MODULES="
kernel
vmware-version-check
+ slxlog
"
REQUIRED_BINARIES="
bash