krata: rework cross-compilation

This commit is contained in:
Alex Zenla
2024-03-21 21:31:10 +00:00
parent 332a1bba26
commit 0191e5b2c1
27 changed files with 321 additions and 131 deletions

View File

@ -1,12 +1,13 @@
#!/bin/sh
set -e
TARGET_ARCH="${1}"
apk add --update-cache alpine-base \
linux-lts linux-firmware-none \
mkinitfs dosfstools e2fsprogs \
tzdata chrony
apk add --allow-untrusted /mnt/target/os/krata.apk
apk add --allow-untrusted "/mnt/target/os/krata-${TARGET_ARCH}.apk"
for SERVICE in kratad kratanet
do
@ -74,7 +75,7 @@ rm -rf /var/cache/apk/*
rm -rf /.dockerenv
cd /
rm -f /mnt/target/os/rootfs.tar
tar cf /mnt/target/os/rootfs.tar --numeric-owner \
rm -f "/mnt/target/os/rootfs-${TARGET_ARCH}.tar"
tar cf "/mnt/target/os/rootfs-${TARGET_ARCH}.tar" --numeric-owner \
--exclude 'mnt/**' --exclude 'proc/**' \
--exclude 'sys/**' --exclude 'dev/**' .

View File

@ -1,9 +1,20 @@
#!/bin/sh
set -e
TARGET_ARCH="${1}"
TARGET_ARCH_ALT="${2}"
apk add --update-cache grub-efi
grub-install --target=x86_64-efi --efi-directory=/boot/efi --no-nvram --skip-fs-probe --bootloader-id=BOOT
mv /boot/efi/EFI/BOOT/grubx64.efi /boot/efi/EFI/BOOT/BOOTX64.efi
grub-install --target="${TARGET_ARCH_ALT}-efi" --efi-directory=/boot/efi --no-nvram --skip-fs-probe --bootloader-id=BOOT
FROM_EFI_FILE="grubx64.efi"
TO_EFI_FILE="BOOTX64.efi"
if [ "${TARGET_ARCH}" = "aarch64" ]
then
FROM_EFI_FILE="grubaa64.efi"
TO_EFI_FILE="BOOTA64.efi"
fi
mv "/boot/efi/EFI/BOOT/${FROM_EFI_FILE}" "/boot/efi/EFI/BOOT/${TO_EFI_FILE}"
ROOT_UUID="$(cat /root-uuid)"