mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-22 02:21:34 +00:00
Merge pull request #273 from ncopa/init-console
add console options from boot cmdline to inittab
This commit is contained in:
commit
092ec97a88
@ -1,13 +1,12 @@
|
||||
all: initrd.img.gz mobylinux-efi.iso
|
||||
|
||||
ETCFILES=etc/issue etc/motd etc/network/interfaces
|
||||
ETCFILES+=etc/securetty
|
||||
ETCFILES+=etc/securetty etc/inittab
|
||||
|
||||
initrd.img: Dockerfile mkinitrd.sh $(ETCFILES)
|
||||
initrd.img: Dockerfile mkinitrd.sh init $(ETCFILES)
|
||||
rm -f initrd.img
|
||||
$(MAKE) -C packages
|
||||
$(MAKE) -C kernel
|
||||
cp inittab.x86_64 etc/inittab
|
||||
docker-compose build moby
|
||||
docker-compose run --rm -T moby /bin/mkinitrd.sh
|
||||
|
||||
|
@ -4,11 +4,9 @@
|
||||
::sysinit:/sbin/openrc boot
|
||||
::wait:/sbin/openrc default
|
||||
|
||||
# Put a getty on the serial port
|
||||
ttyAMA0::respawn:/sbin/getty -L ttyAMA0 115200 vt100
|
||||
|
||||
# Stuff to do for the 3-finger salute
|
||||
::ctrlaltdel:/sbin/reboot
|
||||
|
||||
# Stuff to do before rebooting
|
||||
::shutdown:/sbin/rc shutdown
|
||||
|
36
alpine/init
36
alpine/init
@ -1,7 +1,43 @@
|
||||
#!/bin/sh
|
||||
|
||||
setup_console() {
|
||||
tty=${1%,*}
|
||||
speed=${1#*,}
|
||||
inittab="$2"
|
||||
securetty="$3"
|
||||
line=
|
||||
term="linux"
|
||||
[ "$speed" = "$1" ] && speed=115200
|
||||
|
||||
case "$tty" in
|
||||
ttyS*|ttyAMA*|ttyUSB*|ttyMFD*)
|
||||
line="-L"
|
||||
term="vt100"
|
||||
;;
|
||||
tty0)
|
||||
# skip current console
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
# skip consoles already in inittab
|
||||
grep -q "^$tty:" "$inittab" && return
|
||||
|
||||
echo "$tty::respawn:/sbin/getty $line $speed $tty $term" >> "$inittab"
|
||||
if ! grep -q -w "$tty" "$securetty"; then
|
||||
echo "$tty" >> "$securetty"
|
||||
fi
|
||||
}
|
||||
|
||||
/bin/mount -t tmpfs tmpfs /mnt
|
||||
|
||||
/bin/cp -a / /mnt 2>/dev/null
|
||||
|
||||
/bin/mount -t proc -o noexec,nosuid,nodev proc /proc
|
||||
for opt in $(cat /proc/cmdline); do
|
||||
case "$opt" in
|
||||
console=*)
|
||||
setup_console ${opt#console=} /mnt/etc/inittab /mnt/etc/securetty;;
|
||||
esac
|
||||
done
|
||||
|
||||
exec /bin/busybox switch_root /mnt /sbin/init
|
||||
|
@ -1,17 +0,0 @@
|
||||
# /etc/inittab
|
||||
|
||||
::sysinit:/sbin/openrc sysinit
|
||||
::sysinit:/sbin/openrc boot
|
||||
::wait:/sbin/openrc default
|
||||
|
||||
# Put a getty on the serial port
|
||||
ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100
|
||||
|
||||
# Put a getty on the console
|
||||
tty1::respawn:/sbin/getty 115200 tty1 linux
|
||||
|
||||
# Stuff to do for the 3-finger salute
|
||||
::ctrlaltdel:/sbin/reboot
|
||||
|
||||
# Stuff to do before rebooting
|
||||
::shutdown:/sbin/rc shutdown
|
Loading…
Reference in New Issue
Block a user