-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen
executable file
·114 lines (92 loc) · 1.94 KB
/
gen
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/sh
# Copyright (c) 2024, Firas Khalil Khana
# Distributed under the terms of the ISC License
ver=$(uname -r)
CERD=/var/lib/rad/clusters/cerata
GEND=../gen
MODD=/usr/lib/modules/$ver/kernel
rm -fr \
"$GEND" \
../initramfs
mkdir -p "$GEND"
cd "$GEND"
mkdir -p \
etc \
run \
usr/bin \
usr/lib/modules/$ver/kernel/drivers/usb \
var
mkdir -pm 555 \
proc \
sys
ln -fns usr/bin bin
ln -fns usr/lib lib
ln -fns usr/bin sbin
ln -fns bin usr/sbin
cp -af ../bubble/init .
cp -af \
"$CERD"/fs/group \
"$CERD"/fs/passwd \
"$CERD"/mdevd/mdev.conf \
etc
cp -af \
/usr/bin/blkid \
/usr/bin/kill \
/usr/bin/kmod \
/usr/bin/mdevd \
/usr/bin/mdevd-coldplug \
/usr/bin/mount \
/usr/bin/switch_root \
/usr/bin/toybox \
/usr/bin/yash \
usr/bin
ln -fns kmod usr/bin/modprobe
ln -fns yash usr/bin/sh
for i in $(toybox); do
ln -fns toybox usr/bin/$i
done
cp -af \
/usr/lib/ld-musl-x86_64.so.1 \
/usr/lib/libblkid.so* \
/usr/lib/libc.so \
/usr/lib/libcrypto.so* \
/usr/lib/liblzma.so* \
/usr/lib/libmount.so* \
/usr/lib/libskarnet.so* \
/usr/lib/libterminfo.so \
/usr/lib/libutmps.so* \
/usr/lib/libz.so* \
/usr/lib/libzstd.so* \
usr/lib
cp -af \
"$MODD"/arch \
"$MODD"/crypto \
"$MODD"/fs \
"$MODD"/lib \
usr/lib/modules/$ver/kernel
cp -af \
"$MODD"/drivers/ata \
"$MODD"/drivers/block \
"$MODD"/drivers/cdrom \
"$MODD"/drivers/gpu \
"$MODD"/drivers/hid \
"$MODD"/drivers/hwmon \
"$MODD"/drivers/input \
"$MODD"/drivers/md \
"$MODD"/drivers/message \
"$MODD"/drivers/nvme \
"$MODD"/drivers/scsi \
"$MODD"/drivers/usb/host \
"$MODD"/drivers/usb/storage \
"$MODD"/drivers/virtio \
usr/lib/modules/$ver/kernel/drivers
cp -af \
"$MODD"/../modules.builtin \
"$MODD"/../modules.builtin.modinfo \
"$MODD"/../modules.order \
usr/lib/modules/$ver
depmod -b . $ver
find . | cpio -o | zstd -22 --ultra -T0 --long > ../initramfs
cd ../bubble
rm -fr "$GEND"
echo "gen complete"