chore: remove can't install #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Ubuntu 24 ARM Image | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build-image: | |
runs-on: ubuntu-24.04 | |
env: | |
ROOT_PASSWORD: root # Change this to your desired root password | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Build Docker Image | |
run: | | |
docker build -t ubuntu-arm-builder . | |
- name: Create Output Directory | |
run: | | |
mkdir -p ${{ github.workspace }}/output | |
chmod 777 ${{ github.workspace }}/output | |
- name: Clone and Configure Kernel | |
run: | | |
docker run --rm -v ${{ github.workspace }}/output:/output ubuntu-arm-builder /bin/bash -c " | |
cd /output | |
git clone --depth 1 --branch v6.13 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git | |
cd linux | |
cp /build/kernel-config .config | |
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- olddefconfig | |
" | |
- name: Build Kernel | |
run: | | |
docker run --rm -v ${{ github.workspace }}/output:/output ubuntu-arm-builder /bin/bash -c " | |
cd /output/linux | |
make -j$(nproc) ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- | |
" | |
- name: Create Initial Root Filesystem | |
run: | | |
docker run --rm -v ${{ github.workspace }}/output:/output ubuntu-arm-builder /bin/bash -c " | |
mkdir -p /output/rootfs | |
cd /output | |
wget https://cdimage.ubuntu.com/ubuntu-base/releases/24.10/release/ubuntu-base-24.10-base-arm64.tar.gz | |
mkdir -p temp_rootfs | |
tar --no-overwrite-dir -xpf ubuntu-base-24.10-base-arm64.tar.gz -C temp_rootfs | |
cp -a temp_rootfs/. /output/rootfs/ | |
rm -rf temp_rootfs ubuntu-base-24.10-base-arm64.tar.gz | |
" | |
- name: Install Kernel and Modules | |
run: | | |
docker run --rm -v ${{ github.workspace }}/output:/output ubuntu-arm-builder /bin/bash -c " | |
cd /output/linux | |
make -j$(nproc) ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- modules_install INSTALL_MOD_PATH=/output/rootfs | |
make -j$(nproc) ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_PATH=/output/rootfs/boot install | |
" | |
- name: Create and Partition Image | |
run: | | |
docker run --privileged --rm -v ${{ github.workspace }}/output:/output ubuntu-arm-builder /bin/bash -c " | |
cd /output | |
qemu-img create -f raw ubuntu-24-arm.img 8G | |
parted ubuntu-24-arm.img --script \ | |
mklabel gpt \ | |
mkpart EFI fat32 1MiB 261MiB \ | |
set 1 esp on \ | |
mkpart primary ext4 261MiB 100% | |
LOOP_DEV=\$(losetup -f --show ubuntu-24-arm.img) | |
mkfs.fat -F 32 \${LOOP_DEV}p1 | |
mkfs.ext4 \${LOOP_DEV}p2 | |
mkdir -p /mnt/efi /mnt/rootfs | |
mount \${LOOP_DEV}p2 /mnt/rootfs | |
mkdir -p /mnt/rootfs/boot/efi | |
mount \${LOOP_DEV}p1 /mnt/rootfs/boot/efi | |
echo 'Copying root filesystem...' | |
cp -a /output/rootfs/* /mnt/rootfs/ | |
sync | |
" | |
- name: Configure System | |
run: | | |
docker run --privileged --rm -v ${{ github.workspace }}/output:/output ubuntu-arm-builder /bin/bash -c " | |
# Generate /etc/fstab | |
echo '/dev/sda2 / ext4 defaults 0 1' > /mnt/rootfs/etc/fstab | |
echo '/dev/sda1 /boot/efi vfat defaults 0 2' >> /mnt/rootfs/etc/fstab | |
# Configure hostname | |
echo 'ubuntu-arm' > /mnt/rootfs/etc/hostname | |
# Configure hosts file | |
echo '127.0.0.1 localhost' > /mnt/rootfs/etc/hosts | |
echo '127.0.1.1 ubuntu-arm' >> /mnt/rootfs/etc/hosts | |
# Configure network | |
mkdir -p /mnt/rootfs/etc/netplan | |
cat > /mnt/rootfs/etc/netplan/01-netcfg.yaml << EOF | |
network: | |
version: 2 | |
renderer: NetworkManager | |
ethernets: | |
eth0: | |
dhcp4: true | |
EOF | |
# Configure root password | |
echo "root:${ROOT_PASSWORD}" | chroot /mnt/rootfs chpasswd | |
# Install additional packages | |
mount -t proc none /mnt/rootfs/proc | |
mount -t sysfs none /mnt/rootfs/sys | |
mount -o bind /dev /mnt/rootfs/dev | |
chroot /mnt/rootfs apt-get update | |
chroot /mnt/rootfs apt-get install -y \ | |
sudo \ | |
networkmanager \ | |
openssh-server \ | |
linux-firmware \ | |
ubuntu-standard \ | |
ubuntu-minimal \ | |
grub-efi-arm64 \ | |
initramfs-tools | |
# Update initramfs | |
chroot /mnt/rootfs update-initramfs -u | |
# Install and configure GRUB | |
chroot /mnt/rootfs grub-install --target=arm64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu --no-nvram --removable | |
chroot /mnt/rootfs update-grub | |
# Cleanup | |
umount /mnt/rootfs/dev | |
umount /mnt/rootfs/proc | |
umount /mnt/rootfs/sys | |
umount /mnt/rootfs/boot/efi | |
umount /mnt/rootfs | |
losetup -D | |
" | |
- name: Compress Image | |
run: | | |
docker run --rm -v ${{ github.workspace }}/output:/output ubuntu-arm-builder /bin/bash -c " | |
cd /output | |
xz -9 ubuntu-24-arm.img | |
" | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ubuntu-24-arm-image | |
path: ${{ github.workspace }}/output/ubuntu-24-arm.img.xz | |
if-no-files-found: error |