added x86_64_uclibc platform support

This commit is contained in:
wt
2025-08-17 14:23:39 +07:00
parent a605476c80
commit f1ad90c8bc
13 changed files with 5485 additions and 12 deletions
+6 -5
View File
@@ -27,11 +27,9 @@ case $1 in
if [ "$IMAGE_USABLE_ENABLE" = "y" ]; then
sdroot_usable
fi
sdroot
# kernel_with_rootfs
# uboot
# busybox_rootfs
# kernel
if [ "$IMAGE_ENABLE" = "y" ]; then
sdroot
fi
;;
dropbear)
dropbear
@@ -67,6 +65,9 @@ case $1 in
rootfs
sdroot_usable
;;
initramfs)
initramfs
;;
*)
printf "$UYELLOW** $0 script using: $0 {clean|build|download|rootfs}\n$RESET"
exit 1
+30
View File
@@ -0,0 +1,30 @@
#!/bin/sh
set -ex
mkdir -pv installer
cd installer
dd if=/dev/zero of=installer.img bs=1M count=100
sudo modprobe nbd
sudo qemu-nbd --connect /dev/nbd0 installer.img && sync
printf "o\nn\np\n\n\n\nw\n" | sudo fdisk /dev/nbd0 && sync
sudo mkfs.ext4 /dev/nbd0p1 && sync
sudo mount /dev/nbd0p1 /mnt
cd ../build/rootfs
tar -czvf /tmp/rootfs.tar.gz.tmp .
cd ../../installer
sudo tar -xvf /tmp/rootfs.tar.gz.tmp -C /mnt && sync
sudo grub-install --target=i386-pc --root-directory=/mnt /dev/nbd0 && sync
sudo cp ../grub/grub.cfg /mnt/boot/grub/grub.cfg && sync
rawuuid=$(echo $(sudo blkid /dev/nbd0p1 | echo $(awk '{print $2}')))
echo $rawuuid
uuidIN=(${rawuuid//=/ })
uuid=${uuidIN[1]}
echo $uuid
sudo sed -i "s/ROOTUUID/$uuid/g" /mnt/boot/grub/grub.cfg && sync
sudo sed -i "s/\/dev\/sda/UUID=$uuid/g" /mnt/etc/fstab && sync
sudo cp -v ../build/kernel/linux-6.1.91/arch/x86_64/boot/bzImage /mnt/boot/vmlinuz-6.1.91 && sync
sudo cp -v ../build/initramfs.img /mnt/boot && sync
sudo cp -v /tmp/rootfs.tar.gz.tmp /mnt/rootfs.tar.gz && sync
sudo umount /mnt
sudo qemu-nbd --disconnect /dev/nbd0
+26
View File
@@ -0,0 +1,26 @@
#!/bin/sh
set -ex
mkdir -pv qemu
cd qemu
dd if=/dev/zero of=rootfs.ext4 bs=1M count=100
mkfs.ext4 rootfs.ext4
cd ../build/rootfs
tar -czvf /tmp/rootfs.tar.gz.tmp .
cd ../../qemu
sudo mount -v rootfs.ext4 /mnt
sudo tar -xvf /tmp/rootfs.tar.gz.tmp -C /mnt
sudo umount -v rootfs.ext4
qemu-system-x86_64 \
-m 10G \
-smp 20 \
-enable-kvm \
-cpu host \
-kernel ../build/kernel/linux-6.1.91/arch/x86_64/boot/bzImage \
-append "root=/dev/sda init=/init" \
-initrd ../build/initramfs.img \
-hda rootfs.ext4 \
-device virtio-net-pci,netdev=hn0,id=nic1 \
-netdev bridge,id=hn0,br=virbr0