I am trying to create a custom Debian based AMI with my own custom kernel for AWS EC2 instances, specifically I'm trying to run it on t4g.micro/medium instances.
I debootstrap an ARM64 Debian and copy the required /boot/efi/EFI/* contents from an AWS EC2 machine, I create an ESP/vfat partition to hold the EFI data and copy the contents of /boot from an original EC2 instance, however, when I try to boot the instance I encouter an EFI shell, (after 10 minutes of waiting).
- The image does not use secure boot, so booting it should work.
- I am using the same kernel provided by AWS as a dry run to remove the concern that my kernel is valid.
- I created a raw disk using qemu-nbd and mkfs.vfat.
Does anyone know what is the issue here? I am a bit lost.
I'm attaching my script:
sudo qemu-debootstrap --arch=arm64 --include=openssh-server,curl,tar,gcc,libc6-dev,time,strace,sudo,less,psmisc,selinux-utils,policycoreutils,checkpolicy,selinux-policy-default,firmware-atheros --components=main,contrib,non-free stable debian
fallocate -l4G disk.raw
DISKDEV=/dev/nbd0
sudo qemu-nbd -c /dev/nbd0 --format=raw disk.raw
echo -en "g\nn\n\n\n+110M\nt\n1\nn\n2\n\n\n\nw\n" | sudo fdisk
PARTDEV=$DISKDEV"p2"
sudo -E mkfs.ext4 -O ^resize_inode,^has_journal,ext_attr,extents,huge_file,flex_bg,dir_nlink,sparse_super $PARTDEV
mkdir -p disk.mnt
sudo mount $PARTDEV disk.mnt
sudo mkfs.vfat -F 32 $DISKDEV"p1"
mkdir efi.mnt
sudo mount -t vfat $DISKDEV"p1" efi.mnt
sudo cp -r ./debian/boot/efi/ ./efi.mnt/
sudo cp -a debian/. disk.mnt/.
.. unmounting flow goes here ..