-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_rootfs
executable file
·60 lines (51 loc) · 1.81 KB
/
build_rootfs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
set -e
cd poky
. oe-init-build-env
bitbake core-image-minimal
cd ../..
rm -rf rootfs
mkdir rootfs
pushd rootfs > /dev/null
CPIO="poky/build/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.cpio.lz4"
lz4 -dc ../$CPIO | cpio --extract --make-directories --format=newc --no-absolute-filenames
# Delete uneeded files
rm -rf ./usr/share/alsa
rm -rf ./usr/share/mime
rm -rf ./usr/share/icons
rm -rf ./usr/share/consolefonts
rm -rf ./usr/share/keymaps
mv ./usr/bin/qemu-system-x86_64 ./q
rm -rf ./usr/bin/qemu*
mv ./q ./usr/bin/qemu-system-x86_64
pushd ./usr/share/ > /dev/null
mv qemu qemu_bk
mkdir qemu
mv qemu_bk/bios-256k.bin qemu/
mv qemu_bk/efi-e1000e.rom qemu/
mv qemu_bk/efi-virtio.rom qemu/
mv qemu_bk/kvmvapic.bin qemu/
mv qemu_bk/linuxboot.bin qemu/
mv qemu_bk/linuxboot_dma.bin qemu/
mv qemu_bk/vgabios-stdvga.bin qemu/
rm -r qemu_bk
popd > /dev/null
# Auto login for SystemD
F="./lib/systemd/system/[email protected]"
sed -i -e 's/^\(ExecStart *=.*getty \)/\1--autologin root /' $F
F="./lib/systemd/system/[email protected]"
sed -i -e 's/^\(ExecStart *=.*getty \)/\1--autologin root /' $F
# Auto login for SysV
#F="./etc/inittab"
#sed -i 's/1:12345:respawn:\/sbin\/getty 38400 tty1/1:12345:respawn:\/sbin\/agetty --autologin root --noclear 38400 tty1 linux/' $F
# Change root shell to bash
sed ' /^root/ s#/bin/sh#/bin/bash# ' ./etc/passwd > p
mv p ./etc/passwd
# Auto start test on ttyS0 or tty1
#echo 'if [ $(tty) = "/dev/ttyS0" ]; then' >> ./home/root/.bash_profile
echo 'if [ $(tty) = "/dev/tty1" ]; then' >> ./home/root/.bash_profile
echo ' if grep inception=tmux_restore /proc/cmdline > /dev/null; then' >> ./home/root/.bash_profile
echo ' /inception/tmux_restore' >> ./home/root/.bash_profile
echo ' fi' >> ./home/root/.bash_profile
echo 'fi' >> ./home/root/.bash_profile
popd > /dev/null