buninu-linux 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +547 -190
- package/build-uki.sh +4 -2
- package/fetch-alpine.sh +78 -43
- package/index.js +4 -1
- package/initramfs/bin/ip +630 -0
- package/initramfs/bin/mount +401 -0
- package/initramfs/bin/poweroff +10 -0
- package/initramfs/bin/ps +256 -0
- package/initramfs/bin/reboot +10 -0
- package/initramfs/bin/tar +169 -0
- package/initramfs/bin/top +129 -0
- package/initramfs/bin/umount +71 -0
- package/initramfs/buninu/apps/bunmsh/CHANGELOG.md +36 -0
- package/initramfs/buninu/apps/bunmsh/README.md +7 -0
- package/initramfs/buninu/apps/bunmsh/package.json +1 -1
- package/initramfs/buninu/apps/bunmsh/src/fancy-ls.js +29 -14
- package/initramfs/buninu/apps/bunmsh/src/line-edit.js +43 -0
- package/initramfs/buninu/apps/bunmsh/src/main.js +15 -1
- package/initramfs/buninu/apps/bunmsh/src/mouse.js +29 -4
- package/initramfs/buninu/apps/bunmsh/src/shell.js +9 -1
- package/initramfs/buninu/apps/bunmsh/test/shell1.test.js +70 -0
- package/initramfs/buninu/apps/jsmdcui/CHANGELOG.md +10 -0
- package/initramfs/buninu/apps/jsmdcui/README.md +2 -0
- package/initramfs/buninu/apps/jsmdcui/package.json +1 -1
- package/initramfs/buninu/apps/jsmdcui/runtime/help/commands.md +4 -1
- package/initramfs/buninu/apps/jsmdcui/runtime/help/help.md +2 -0
- package/initramfs/buninu/apps/jsmdcui/src/index.js +40 -13
- package/initramfs/buninu/package.json +1 -1
- package/initramfs/init.js +164 -11
- package/initramfs/lib/dlopen.js +121 -0
- package/initramfs/lib/document.js +6 -0
- package/initramfs/lib/modprobe.js +235 -0
- package/initramfs/lib/power.js +35 -0
- package/initramfs/usr/share/doc/buninu-linux/ip.md +155 -0
- package/initramfs/usr/share/doc/buninu-linux/mount.md +155 -0
- package/initramfs/usr/share/doc/buninu-linux/poweroff.md +15 -0
- package/initramfs/usr/share/doc/buninu-linux/ps.md +94 -0
- package/initramfs/usr/share/doc/buninu-linux/reboot.md +15 -0
- package/initramfs/usr/share/doc/buninu-linux/tar.md +73 -0
- package/initramfs/usr/share/doc/buninu-linux/top.md +23 -0
- package/initramfs/usr/share/doc/buninu-linux/umount.md +48 -0
- package/package.json +2 -2
package/build-uki.sh
CHANGED
|
@@ -7,8 +7,10 @@ linux_flavor=${LINUX_FLAVOR:-virt}
|
|
|
7
7
|
kernel_release="6.18.52-0-$linux_flavor"
|
|
8
8
|
kernel_image="kernel/vmlinuz-$linux_flavor"
|
|
9
9
|
|
|
10
|
-
if [ ! -s "$kernel_image" ] ||
|
|
11
|
-
[
|
|
10
|
+
if [ ! -s "$kernel_image" ] || [ ! -s "initramfs/lib/modules/$kernel_release/modules.dep" ] || \
|
|
11
|
+
{ [ "${REAL_MACHINE:-}" = 1 ] && \
|
|
12
|
+
{ [ ! -s "initramfs/lib/modules/$kernel_release/kernel/drivers/hid/usbhid/usbhid.ko" ] || \
|
|
13
|
+
[ ! -s "initramfs/lib/modules/$kernel_release/kernel/drivers/acpi/battery.ko" ]; }; }; then
|
|
12
14
|
./fetch-alpine.sh
|
|
13
15
|
fi
|
|
14
16
|
./scripts/pack-initramfs.sh
|
package/fetch-alpine.sh
CHANGED
|
@@ -19,10 +19,8 @@ stub_sha256=8e64a5a3afee5f930e6e6716be726dc6d405530ac7f8fa5be6251dae68671ec9
|
|
|
19
19
|
|
|
20
20
|
kernel_release="6.18.52-0-$linux_flavor"
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"initramfs/lib/modules/$kernel_release/kernel/drivers/net" \
|
|
25
|
-
"initramfs/lib/modules/$kernel_release/kernel/drivers/virtio"
|
|
22
|
+
modules_root="initramfs/lib/modules/$kernel_release"
|
|
23
|
+
mkdir -p downloads kernel initramfs/lib "$modules_root"
|
|
26
24
|
|
|
27
25
|
. ./scripts/fetch.sh
|
|
28
26
|
|
|
@@ -30,51 +28,88 @@ fetch "$base/$linux_package" "$linux_package" "$linux_sha256"
|
|
|
30
28
|
fetch "$base/$musl_package" "$musl_package" "$musl_sha256"
|
|
31
29
|
fetch "$base/$stub_package" "$stub_package" "$stub_sha256"
|
|
32
30
|
|
|
33
|
-
tar --warning=no-unknown-keyword -xOf "downloads/$
|
|
34
|
-
"boot/vmlinuz-$linux_flavor" > "kernel/vmlinuz-$linux_flavor"
|
|
35
|
-
tar --warning=no-unknown-keyword -xOf "downloads/$musl_package" \
|
|
36
|
-
lib/ld-musl-x86_64.so.1 > initramfs/lib/ld-musl-x86_64.so.1
|
|
37
|
-
tar --warning=no-unknown-keyword -xOf "downloads/$stub_package" \
|
|
38
|
-
usr/lib/systemd/boot/efi/linuxx64.efi.stub > kernel/linuxx64.efi.stub
|
|
39
|
-
tar --warning=no-unknown-keyword -xOf "downloads/$linux_package" \
|
|
40
|
-
"lib/modules/$kernel_release/kernel/net/core/failover.ko.gz" \
|
|
41
|
-
| gzip -dc > "initramfs/lib/modules/$kernel_release/kernel/net/core/failover.ko"
|
|
42
|
-
tar --warning=no-unknown-keyword -xOf "downloads/$linux_package" \
|
|
43
|
-
"lib/modules/$kernel_release/kernel/drivers/net/net_failover.ko.gz" \
|
|
44
|
-
| gzip -dc > "initramfs/lib/modules/$kernel_release/kernel/drivers/net/net_failover.ko"
|
|
45
|
-
tar --warning=no-unknown-keyword -xOf "downloads/$linux_package" \
|
|
46
|
-
"lib/modules/$kernel_release/kernel/drivers/net/virtio_net.ko.gz" \
|
|
47
|
-
| gzip -dc > "initramfs/lib/modules/$kernel_release/kernel/drivers/net/virtio_net.ko"
|
|
31
|
+
extract() { tar --warning=no-unknown-keyword -xOf "downloads/$1" "$2"; }
|
|
48
32
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
33
|
+
extract "$linux_package" "boot/vmlinuz-$linux_flavor" > "kernel/vmlinuz-$linux_flavor"
|
|
34
|
+
extract "$musl_package" lib/ld-musl-x86_64.so.1 > initramfs/lib/ld-musl-x86_64.so.1
|
|
35
|
+
extract "$stub_package" usr/lib/systemd/boot/efi/linuxx64.efi.stub > kernel/linuxx64.efi.stub
|
|
36
|
+
|
|
37
|
+
# Kernel modules. The package's modules.dep says what each one needs, so a
|
|
38
|
+
# module is requested by name and its dependencies come along: on linux-lts
|
|
39
|
+
# virtio_net pulls in virtio, virtio_ring and virtio_pci, which linux-virt
|
|
40
|
+
# has built in. The initramfs gets a modules.dep trimmed to the shipped set,
|
|
41
|
+
# the fs-* lines of modules.alias and modules.builtin; /lib/modprobe.js reads
|
|
42
|
+
# those three files.
|
|
43
|
+
depfile="$(mktemp)"
|
|
44
|
+
selected="$(mktemp)"
|
|
45
|
+
trap 'rm -f "$depfile" "$selected" "$selected.names"' EXIT
|
|
46
|
+
extract "$linux_package" "lib/modules/$kernel_release/modules.dep" > "$depfile"
|
|
47
|
+
|
|
48
|
+
select_module() {
|
|
49
|
+
local name=$1 line path dep
|
|
50
|
+
line=$(grep -F -m1 -- "/$name.ko.gz:" "$depfile") \
|
|
51
|
+
|| { echo "error: module $name is not in $linux_package" >&2; exit 1; }
|
|
52
|
+
path=${line%%:*}
|
|
53
|
+
grep -qxF -- "$path" "$selected" && return
|
|
54
|
+
printf '%s\n' "$path" >> "$selected"
|
|
55
|
+
for dep in ${line#*:}; do
|
|
56
|
+
dep=${dep##*/}
|
|
57
|
+
select_module "${dep%.ko.gz}"
|
|
54
58
|
done
|
|
55
|
-
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
# Network: virtio-net for QEMU (init.js loads these at boot).
|
|
62
|
+
for module in failover net_failover virtio_net; do select_module "$module"; done
|
|
63
|
+
# Storage: what /bin/mount loads on demand. ext4 brings jbd2, mbcache and
|
|
64
|
+
# crc16; FAT, exFAT and NTFS ask the kernel for the NLS tables at mount
|
|
65
|
+
# time, which has no /sbin/modprobe to answer, so mount preloads them.
|
|
66
|
+
for module in virtio_blk ext4 ext2 vfat exfat ntfs3 nls_utf8 nls_cp437 nls_iso8859-1; do
|
|
67
|
+
select_module "$module"
|
|
68
|
+
done
|
|
56
69
|
|
|
57
70
|
if [ "${REAL_MACHINE:-}" = 1 ]; then
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
for module in \
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
# USB keyboard for the console; common storage paths (SATA/AHCI HDD and
|
|
72
|
+
# SSD, NVMe including Intel VMD, legacy PATA, and USB mass-storage/UAS);
|
|
73
|
+
# and the ACPI drivers behind
|
|
74
|
+
# /sys/class/power_supply (battery, ac), the power button and thermal
|
|
75
|
+
# zones — all modules on Alpine's kernels.
|
|
76
|
+
for module in usb-common usbcore xhci-hcd xhci-pci xhci-pci-renesas hid hid-generic usbhid \
|
|
77
|
+
sd_mod ahci ata_generic pata_acpi nvme vmd usb-storage uas \
|
|
78
|
+
battery ac button thermal; do
|
|
79
|
+
select_module "$module"
|
|
80
|
+
done
|
|
81
|
+
# Wired NICs: Intel (e1000/e1000e/igb/igc), Realtek (r8169 plus its PHY
|
|
82
|
+
# driver), Qualcomm Atheros (alx), Broadcom (tg3), and USB dongles.
|
|
83
|
+
# Android USB tethering commonly presents RNDIS, CDC ECM/NCM/EEM, or an
|
|
84
|
+
# older CDC subset/zaurus-compatible gadget. Selecting the leaf drivers
|
|
85
|
+
# recursively includes usbnet, mii, usbcore and usb-common from
|
|
86
|
+
# modules.dep. cfg.net unconditionally attempts every packaged
|
|
87
|
+
# kernel/drivers/net module, then matches USB and PCI modaliases.
|
|
88
|
+
for module in e1000 e1000e igb igc r8169 realtek alx tg3 \
|
|
89
|
+
r8152 ax88179_178a cdc_ether rndis_host cdc_ncm cdc_eem \
|
|
90
|
+
cdc_subset zaurus; do
|
|
91
|
+
select_module "$module"
|
|
75
92
|
done
|
|
76
93
|
fi
|
|
77
94
|
|
|
95
|
+
while read -r path; do
|
|
96
|
+
mkdir -p "$modules_root/$(dirname "$path")"
|
|
97
|
+
extract "$linux_package" "lib/modules/$kernel_release/$path" | gzip -dc > "$modules_root/${path%.gz}"
|
|
98
|
+
done < "$selected"
|
|
99
|
+
|
|
100
|
+
awk -F: 'NR == FNR { wanted[$0] = 1; next } $1 in wanted' "$selected" "$depfile" \
|
|
101
|
+
| sed 's/\.ko\.gz/.ko/g' > "$modules_root/modules.dep"
|
|
102
|
+
# modules.alias: the fs-* names, and the pci:/usb:/virtio: device ids of the modules
|
|
103
|
+
# shipped, so /lib/modprobe.js can match hardware to drivers.
|
|
104
|
+
sed 's|.*/||; s|\.ko\.gz$||; s|-|_|g' "$selected" | sort -u > "$selected.names"
|
|
105
|
+
extract "$linux_package" "lib/modules/$kernel_release/modules.alias" \
|
|
106
|
+
| awk -v names="$selected.names" '
|
|
107
|
+
BEGIN { while ((getline n < names) > 0) shipped[n] = 1 }
|
|
108
|
+
$2 ~ /^fs-/ { print; next }
|
|
109
|
+
$2 ~ /^(pci|usb|virtio):/ { m = $3; gsub("-", "_", m); if (m in shipped) print }
|
|
110
|
+
' > "$modules_root/modules.alias"
|
|
111
|
+
extract "$linux_package" "lib/modules/$kernel_release/modules.builtin" > "$modules_root/modules.builtin"
|
|
112
|
+
|
|
78
113
|
chmod 0755 initramfs/lib/ld-musl-x86_64.so.1
|
|
79
114
|
|
|
80
|
-
echo "Fetched Alpine linux-$linux_flavor kernel,
|
|
115
|
+
echo "Fetched Alpine linux-$linux_flavor kernel, $(wc -l < "$selected") modules, musl, and the x64 UKI stub."
|
package/index.js
CHANGED
|
@@ -190,7 +190,10 @@ function checkTools(selectedStages) {
|
|
|
190
190
|
if (missing.length > 0) {
|
|
191
191
|
fail(
|
|
192
192
|
`missing tools, nothing was run:\n ${missing.join("\n ")}\n` +
|
|
193
|
-
|
|
193
|
+
`
|
|
194
|
+
Run this command in Debian first:
|
|
195
|
+
apt install binutils-mingw-w64-x86-64 cpio curl dosfstools fakeroot mtools parted unzip
|
|
196
|
+
`,
|
|
194
197
|
);
|
|
195
198
|
}
|
|
196
199
|
}
|