diff --git a/recipes-core/fastinit/chlevel.1 b/recipes-core/fastinit/chlevel.1 new file mode 100644 index 0000000000000000000000000000000000000000..8c57a5511ddbffbd938d2c5d1999849b490e11ef --- /dev/null +++ b/recipes-core/fastinit/chlevel.1 @@ -0,0 +1,19 @@ +.TH CHLEVEL 1 "November 2024" "Version 0.1" "General Commands Manual" +.SH NAME +chlevel.sh \- change fastinit runlevel +.SH SYNOPSIS +.B /usr/sbin/chlevel.sh +\fIrunlevel\fP +.SH DESCRIPTION + +Chlevel.sh remounts the boot filesystem, edit the kernel command line to change the runlevel and restart the system. + +.SH SEE ALSO +.BR runlevel (8), +.BR fastinit (8), +.BR mount (8) + +.SH AUTHOR +The +.B chlevel +script was first written by Qiyang Sun <qs2g22@soton.ac.uk>, and is maintained by the MAR24 project maintainers. diff --git a/recipes-core/fastinit/files/chlevel.sh b/recipes-core/fastinit/files/chlevel.sh new file mode 100755 index 0000000000000000000000000000000000000000..e196324a89526d1386019fcc5582b1dcbe564ca8 --- /dev/null +++ b/recipes-core/fastinit/files/chlevel.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +runlevel=$1 + +case $runlevel in + 1) + mount -o rw,remount /boot + cat > /boot/cmdline.txt <<EOF +quiet loglevel=0 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait logo.nologo net.ifnames=0 modules.load=dwc2,g_serial init=/usr/sbin/fastinit.sh 1 +EOF + reboot -f + ;; + 2) + mount -o rw,remount /boot + cat > /boot/cmdline.txt <<EOF +quiet loglevel=0 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait logo.nologo net.ifnames=0 modules.load=dwc2,g_serial init=/usr/sbin/fastinit.sh 2 +EOF + reboot -f + ;; + 3) + mount -o rw,remount /boot + cat > /boot/cmdline.txt <<EOF +dwc_otg.lpm_enable=0 console=serial0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait logo.nologo net.ifnames=0 modules.load=dwc2,g_serial earlycon=uart8250,mmio32,0x20215040 init=/usr/sbin/fastinit.sh 3 +EOF + reboot -f + ;; + 5) + mount -o rw,remount /boot + cat > /boot/cmdline.txt <<EOF +dwc_otg.lpm_enable=0 console=serial0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait logo.nologo net.ifnames=0 modules.load=dwc2,g_serial earlycon=uart8250,mmio32,0x20215040 init=/usr/sbin/fastinit.sh 5 +EOF + reboot -f + ;; + *) + echo "Invalid new runlevel" + ;; +esac +