Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • qs2g22/meta-marfb
1 result
Show changes
Commits on Source (7)
# enable early console
# https://www.raspberrypi.com/documentation/computers/configuration.html#enabling-early-console-for-linux
CMDLINE:append = " modules.load=dwc2,g_serial"
CMDLINE:append = " earlycon=uart8250,mmio32,0x20215040"
#CMDLINE:append = " modules.load=dwc2,g_serial"
#CMDLINE:append = " earlycon=uart8250,mmio32,0x20215040"
#CMDLINE:append = " earlycon=pl011,mmio32,0x20201000"
CMDLINE:append = " init=/usr/sbin/fastinit.sh 3"
#CMDLINE:append = " init=/usr/sbin/fastinit.sh 3"
CMDLINE = "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"
.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.
.TH FASTINIT 8 "August 2024" "Version 0.1" "System Administration"
.TH FASTINIT 8 "August 2024" "Version 0.1" "System Administration Manual"
.SH NAME
fastinit.sh \- fast system initialisation
.SH SYNOPSIS
......@@ -26,6 +26,8 @@ and append the following line. Note that this file contains only one single line
.fi
.in
NEVER SET RUNLEVEL TO 0 OR 6 FROM THE KERNEL COMMAND LINE.
.SH RUNLEVEL
.B fastinit
supports several runlevels, which represent different states of the system. These include:
......@@ -39,6 +41,18 @@ Halt the system. Invokes
.B 1
Single-user mode. Supports serial, teletypes, proc, sysfs, GPIO. Bootfs is read-only. GPIO 23 (Pin 16) is set to high when boot is completed.
.TP
.B 2
Single-user mode with camera. Support runlevel 1 and camera. System is quiet (only kernel panic should be printed). Udev daemon is started. Level3d daemon is started, see also
.B level3d
(8). Marvision is started. Bootfs is readonly. GPIO 23 (Pin 16) is set to high when boot is completed. No teletype or login support.
The following kernel modules are started to make the camera work: bcm2835-codec, bcm2835-isp, bcm2835-v4l2, bcm2835-unicam, ov5647, i2c-mux-pinctrl, i2c-bcm2835, uio, fixed.
.TP
.B 3
Single-user mode with camera and networking. Support runlevel 2 and camera. Udev daemon is started. Bootfs is readonly. GPIO 23 (Pin 16) is set to high when boot is completed. Network interface local loopback (lo) is configured (inet=127.0.0.1, mask=255.0.0.0). Network interface wlan0 is configured (inet=192.168.1.1, bcast=192.168.1.255, mask=255.255.255.0). Hostapd daemon (AP support) is started. Dnsmasq daemon (DNS and DHCP support) is started. Fcgiwrap daemon (Fast CGI for nginx) is started. Nginx (HTTP support) is started. Message of the day is printed.
.TP
.B 5
SysVinit runlevel 5. Invokes
......@@ -65,12 +79,26 @@ Reboot.
Poweroff.
.SH BUGS
Bugs may be reported to <qs2g22@soton.ac.uk>.
.IP \[bu]
System will always halt if runlevel is set to 1 in kernel command line.
.IP \[bu]
System will always reboot if runlevel is set to 6 in kernel command line.
.IP \[bu]
Fastinit might print unwanted messages in runlevel 2.
.SH SEE ALSO
.BR init (8),
.BR poweroff (8),
.BR reboot (8),
.BR busybox (1),
.BR mount (8)
.BR mount (8),
.BR chlevel (1),
.BR level3d (8),
.BR print_motd (1)
.SH AUTHOR
......
SUMMARY = "Installs fast init script to replace SysVinit"
LICENSE = "CLOSED"
LICENSE = "GPL-3.0-or-later"
LIC_FILES_CHKSUM = "file://COPYING;md5=1c76c4cc354acaac30ed4d5eefea7245"
SRC_URI = "file://fastinit.sh"
SRC_URI = "file://fastinit.sh \
file://print_motd.sh \
file://chlevel.sh \
file://level3d.sh \
file://COPYING"
DEPENDS = "libgpiod"
......@@ -10,7 +15,10 @@ S = "${WORKDIR}"
do_install() {
install -d ${D}/usr/sbin
install -m 0755 ${WORKDIR}/fastinit.sh ${D}/usr/sbin/
install -m 0755 ${WORKDIR}/print_motd.sh ${D}/usr/sbin/
install -m 0755 ${WORKDIR}/chlevel.sh ${D}/usr/sbin
install -m 0755 ${WORKDIR}/level3d.sh ${D}/usr/sbin
}
FILES:${PN} = "/usr/sbin/fastinit.sh"
FILES:${PN} = "/usr/sbin/fastinit.sh /usr/sbin/print_motd.sh /usr/sbin/chlevel.sh /usr/sbin/level3d.sh"
This diff is collapsed.
#!/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
......@@ -20,16 +20,14 @@ level_zero() {
}
mountfs() {
log_to_kernel "mounting filesystems"
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -o ro /dev/mmcblk0p1 /boot
mount -t tmpfs -o size=100M tmpfs /var/volatile/log
mount -t tmpfs -o size=100M tmpfs /var/log
#mount -t tmpfs -o size=100M tmpfs /var/volatile/log
#mount -t tmpfs -o size=100M tmpfs /var/log
}
rwrootfs() {
log_to_kernel "remounting r/w root filesystems"
mount -o rw,remount /
}
......@@ -39,6 +37,7 @@ gp23hi() {
}
level_one() {
log_to_kernel "mounting filesystems"
mountfs
gp23hi
crit_to_kernel "host is up and ready"
......@@ -49,8 +48,6 @@ level_one() {
level_two() {
mountfs
rwrootfs
log_to_kernel "adding modules to linux kernel"
log_to_kernel "to be added: bcm2835-codec, bcm2835-isp, bcm2835-v4l2, bcm2835-unicam, ov5647, i2c-mux-pinctrl, i2c-bcm2835, uio, fixed"
modprobe bcm2835-codec # minors 0-4
modprobe bcm2835-isp # minors 5-12
modprobe bcm2835-v4l2
......@@ -63,13 +60,17 @@ level_two() {
udevd --daemon
udevadm trigger
gp23hi
crit_to_kernel "host is up and ready"
log_to_kernel "getting teletypes on ttyS0"
/sbin/getty -L 115200 ttyS0 vt100
/sbin/level3d.sh &
/usr/bin/marvision 1>/dev/null 2>/dev/null
# To avoid undefined behaviours when marvision exited abnormally,
# reboot the system.
reboot -f
}
level_three() {
log_to_kernel "mounting filesystems"
mountfs
log_to_kernel "remounting r/w root filesystems"
rwrootfs
log_to_kernel "adding modules to linux kernel"
log_to_kernel "to be added: bcm2835-codec, bcm2835-isp, bcm2835-v4l2, bcm2835-unicam, ov5647, i2c-mux-pinctrl, i2c-bcm2835, uio, fixed, brcmfmac"
......@@ -107,6 +108,7 @@ level_three() {
gp23hi
crit_to_kernel "host is up and ready"
log_to_kernel "getting teletypes on ttyS0"
/sbin/print_motd.sh
/sbin/getty -L 115200 ttyS0 vt100
}
......@@ -139,8 +141,6 @@ else
level_one
;;
2)
log_to_kernel "entering runlevel 2 (camera)"
log_to_kernel "runlevel 2: tty, serial, gpio, camera"
level_two
;;
3)
......
#!/bin/sh
/usr/local/gpiomon -c 0 -n 1 -q 24
# blocked until
/sbin/chlevel.sh 3
#!/bin/sh
less << EOF
$(uname -a)
Welcome to Minimal Autonomous Rover (MAR) GNU/Linux System!
MAR GNU/Linux is free and open-source software.
Copyright (C) 2024 Qiyang Sun and the MAR Project Maintainers.
University of Southampton
University Road, Southampton, United Kingdom SO17 1BJ
* Repository: https://git.soton.ac.uk/qs2g22/meta-marfb
* Support: mailto:qs2g22@soton.ac.uk
The programs included with the MAR GNU/Linux system are free software;
the exact distribution terms for each program are described in the
license/ and spdx/ folders of the release archives. MAR GNU/Linux is
distributed in the hope that it will be useful, but it comes with
ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
=> You receive this message of the day because of the fastinit
configuration. To change the runlevel, refer to manpage fastinit(8)
which is not shipped in this image. Message of the day should not be
printed to serial output because it will confuse the rover.
=> Heavy serial outputs like this affect performance.
=> Uptime: $(uptime)
Press 'q' to quit pager and continue.
EOF
clear
cat << EOF
Welcome to Minimal Autonomous Rover (MAR) GNU/Linux System!
MAR GNU/Linux is free and open-source software.
Copyright (C) 2024 Qiyang Sun and the MAR Project Maintainers.
The programs included with the MAR GNU/Linux system are free software;
the exact distribution terms for each program are described in the
license/ and spdx/ folders of the release archives. MAR GNU/Linux is
distributed in the hope that it will be useful, but it comes with
ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
* Change runlevel before connecting serial to rover.
* To read the full message again, run print_motd.sh.
EOF
sleep 1s
.TH LEVEL3D 8 "November 2024" "Version 0.1" "System Administration Commands and Daemon Manual"
.SH NAME
level3d.sh \- runlevel 3 daemon
.SH SYNOPSIS
.B /usr/sbin/level3d.sh &
.SH DESCRIPTION
Level3d.sh is blocked until GPIO 24 is high, and invoke /sbin/chlevel.sh 3.
.SH SEE ALSO
.BR chlevel (1),
.BR fastinit (8),
.SH AUTHOR
The
.B level3d
script was first written by Qiyang Sun <qs2g22@soton.ac.uk>, and is maintained by the MAR24 project maintainers.
.TH PRINT_MOTD 1 "November 2024" "Version 0.1" "General Commands Manual"
.SH NAME
print_motd.sh \- print message of the day
.SH SYNOPSIS
.B /usr/sbin/print_motd.sh
.SH DESCRIPTION
Prints uname, welcome message, copyright (free and open software) information, postal address, website, (non-)warranty, help, caveat and uptime information to the less pager, clear screen, prints welcome message, copyright (free and open software) information, (non-)warranty and help information to stdout, and wait 1 second.
.SH SEE ALSO
.BR runlevel (8),
.BR fastinit (8)
.SH AUTHOR
The
.B print_motd
script was first written by Qiyang Sun <qs2g22@soton.ac.uk>, and is maintained by the MAR24 project maintainers.