summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2013-06-06 16:06:25 +0200
committerSimon Rettberg2013-06-06 16:06:25 +0200
commitf87d136c49d21655cd966fa5ab07a242eb794342 (patch)
tree1610b8123ac3e9e52fd8b59abcb2d11eecbf6a3d
parent[vmchooser] put mount-var-lib in proper module, fix its PATH (diff)
parent[rootfs-stage31] add debug in the kernel command line: use with 'debug=<level... (diff)
downloadtm-scripts-f87d136c49d21655cd966fa5ab07a242eb794342.tar.gz
tm-scripts-f87d136c49d21655cd966fa5ab07a242eb794342.tar.xz
tm-scripts-f87d136c49d21655cd966fa5ab07a242eb794342.zip
Merge branch 'master' of simonslx:openslx-ng/tm-scripts
-rwxr-xr-xmltk31
-rwxr-xr-xremote/rootfs/rootfs-stage31/data/init14
2 files changed, 38 insertions, 7 deletions
diff --git a/mltk b/mltk
index 4635f5dd..3f8442a0 100755
--- a/mltk
+++ b/mltk
@@ -32,6 +32,7 @@ qnd_exit() {
[ $# -ge 1 ] && kill "$1"
}
+# source all helper functions files that are found under helper/*.inc
for HELPER in $ROOT_DIR/helper/*.inc; do
. "$HELPER" && continue
unset_quiet
@@ -100,7 +101,15 @@ initial_checks() {
pinfo "Kernel version: $KERNEL_VERSION"
pinfo "System's packet manager is $PACKET_MANAGER"
- # setup_target and export_target
+ # source the 2 central scripts:
+ # setup_target
+ # - builds all modules activated under the target directory
+ # (basic targets are 'stage31' and 'stage32')
+ # export_target
+ # - pack given target as a cpio or squashfs depending on
+ # the export type:
+ # stage31 (cpio archive of the complete stage31-filesystem)
+ # stage32 (cpio archive containing the squashfs'ed stage32-filesystem)
REMOTE_SETUP_TARGET="${ROOT_DIR}/remote/setup_target"
SERVER_EXPORT_TARGET="${ROOT_DIR}/server/export_target"
@@ -111,7 +120,11 @@ initial_checks() {
read_params() {
local MODE=""
local SUBMODE=""
- # select mode: remote or server
+ # mltk knows two modes in which to run:
+ # - remote: functions to be run on the reference system
+ # from which to build the mini-linux
+ # - server: functions for rsyncing the generated stage31/stage32
+ # to a server, exporting the stage31-/stage32-filesystems
case "$1" in
server)
MODE="SERVER"
@@ -130,8 +143,20 @@ read_params() {
esac
shift
+ # A target represents a set of modules to be build for a specific stage.
+ # i.e. a very basic stage31 includes:
+ # - busybox
+ # - kernel
+ # - rootfs-stage31
+ # a basic stage32 would also contain these and additionally:
+ # - systemd
+ # - dbus
+ # - pam
+ # for a GUI, you could add:
+ # - xorg
+ # - kdm
+ # - plymouth
TARGET=""
- # set target.
if [[ $1 != "-"* ]]; then
TARGET=$1
shift
diff --git a/remote/rootfs/rootfs-stage31/data/init b/remote/rootfs/rootfs-stage31/data/init
index ee90cf15..bf11d9aa 100755
--- a/remote/rootfs/rootfs-stage31/data/init
+++ b/remote/rootfs/rootfs-stage31/data/init
@@ -15,7 +15,7 @@
# debug shell
drop_shell() {
[ $# -gt 0 ] && echo $@
- echo "Dropping debug shell. CTRL + D will continue booting."
+ echo "CTRL + D will continue booting."
setsid sh -c 'exec sh </dev/tty1 >/dev/tty1 2>&1'
}
@@ -49,8 +49,8 @@ read KCL < /proc/cmdline
export KCL
for opts in ${KCL}; do
case ${opts} in
- debug*)
- DEBUG=1 ;;
+ debug=*)
+ DEBUG=${opts#debug=} ;;
splash*)
SPLASH=1 ;;
ip=*)
@@ -79,6 +79,8 @@ fi
mkdir -p /dev/shm/union /dev/shm/uniontmp /rorootfs
mount -n -t tmpfs none /dev/shm/uniontmp
+[ $DEBUG -ge 4 ] && drop_shell "Requested Debug Shell (before network)."
+
echo "Setup networking..." # Source script so the variables are still available to us
. "/bin/setup_network" || echo "Error setting up network"
@@ -93,7 +95,7 @@ else
mount -t squashfs /mnt/*.sqfs /rorootfs || drop_shell "Problem mounting Squashfs."
fi
-[ $DEBUG -ge 1 ] && drop_shell "Requested Debug Shell."
+[ $DEBUG -ge 3 ] && drop_shell "Requested Debug Shell: squashfs/nfs mounted, before aufs."
echo "Building aufs..."
mv /mnt/modprobing /dev/shm/uniontmp
@@ -102,6 +104,8 @@ mount -n -t aufs -o br:/dev/shm/uniontmp:/rorootfs=ro none /mnt || drop_shell "P
mkdir -p /mnt/uniontmp /mnt/tmp
mount -n --move /dev/shm/uniontmp /mnt/uniontmp || drop_shell "Problem moving uniontmp."
+[ $DEBUG -ge 2 ] && drop_shell "Requested Debug Shell: after aufs'ing."
+
# create udev rule for nic we booted from
cat > "/mnt/etc/udev/rules.d/70-net-boot-nic-name.rules" <<HEREEND
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="$MAC", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
@@ -118,6 +122,8 @@ SLX_PXE_DNS='$DNS_SERVER'
SLX_PXE_MAC='$BRIDGEMAC'
HEREEND
+[ $DEBUG -ge 1 ] && drop_shell "Requested Debug Shell: before switch_root."
+
for mnt in proc sys run ; do
umount -n "$mnt"
done