Add initramfs-login
This commit is contained in:
parent
5746c8269f
commit
e9ddee7ef1
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
tftp/initramfs-login.img
|
17
Makefile
Normal file
17
Makefile
Normal file
@ -0,0 +1,17 @@
|
||||
all: tftp/initramfs-login.img
|
||||
|
||||
login/login: login/*.go
|
||||
GOOS=linux GOARCH=amd64 go build -tags netgo -ldflags '-w -extldflags "-static -lncurses"' -o $@ ./login
|
||||
|
||||
tftp/initramfs-login.img: initramfs-login login/login
|
||||
mkdir -p $</{bin,sbin,etc,proc,sys} $</usr/share/udhcpc/
|
||||
cp /bin/busybox $</bin
|
||||
cp /usr/share/udhcpc/default.script $</usr/share/udhcpc/default.script
|
||||
ln -sf busybox $</bin/sh
|
||||
ln -sf busybox $</sbin/hotplug
|
||||
|
||||
mkdir -p $</etc/terminfo/l
|
||||
cp /etc/terminfo/l/linux $</etc/terminfo/l/
|
||||
|
||||
cp login/login $</bin
|
||||
cd $< && find . -print0 | cpio -H newc --null -o | xz --best --check=crc32 > ../$@
|
1
initramfs-login/etc/mdev.conf
Normal file
1
initramfs-login/etc/mdev.conf
Normal file
@ -0,0 +1 @@
|
||||
$MODALIAS=.* 0:0 660 @modprobe "$MODALIAS"
|
15
initramfs-login/init
Executable file
15
initramfs-login/init
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
mount -t proc proc /proc
|
||||
mount -t sysfs sysfs /sys
|
||||
|
||||
echo 0 > /proc/sys/kernel/printk
|
||||
|
||||
busybox --install -s
|
||||
|
||||
mknod /dev/null c 1 3
|
||||
mknod /dev/tty c 5 0
|
||||
|
||||
mdev -s
|
||||
|
||||
exec setsid sh -c 'exec sh /init2 </dev/tty1 >/dev/tty1 2>&1'
|
11
initramfs-login/init2
Normal file
11
initramfs-login/init2
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
for mod in e100 e1000 e1000e 8139cp 8139too r8169 virtio-net; do
|
||||
modprobe "${mod}"
|
||||
done
|
||||
|
||||
ip link set eth0 up && udhcpc > /dev/null 2> /dev/null &
|
||||
|
||||
/bin/login
|
||||
|
||||
reboot -f
|
Reference in New Issue
Block a user