aboutsummaryrefslogtreecommitdiffstats
path: root/tools/create-buildroot-image.sh
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2022-03-18 14:28:04 +0000
committerAleksandr Nogikh <wp32pw@gmail.com>2022-04-06 17:14:45 +0200
commitade05eecd03ec2f0116f83f3b5fb33c902059932 (patch)
treea1741df19a27a665df4160d2403a71fcf3146b87 /tools/create-buildroot-image.sh
parent4a7cb474c2f19630d8b1c2609f69ea25f249d535 (diff)
tools: generate bootable arm64 images with buildroot
Diffstat (limited to 'tools/create-buildroot-image.sh')
-rwxr-xr-xtools/create-buildroot-image.sh37
1 files changed, 31 insertions, 6 deletions
diff --git a/tools/create-buildroot-image.sh b/tools/create-buildroot-image.sh
index 7f704770d..07c763da6 100755
--- a/tools/create-buildroot-image.sh
+++ b/tools/create-buildroot-image.sh
@@ -7,7 +7,7 @@
# TARGETARCH={amd64,arm64,arm,riscv64,s390x,mips64le,ppc64le} [NOMAKE=yes] create-buildroot-image.sh
# If no NOMAKE=yes is specified, then it will just prepare the buildroot config,
# but will not run the final make.
-# For amd64 it creates a bootable image with root partition
+# For amd64 and arm64 it creates a bootable image with root partition
# on /dev/sda1 in output/images/disk.img file.
# For other architectures it creates a non-bootable disk
# suitable qemu injected boot with root partition on /dev/sda
@@ -23,7 +23,7 @@ case "$TARGETARCH" in
amd64)
DEFCONFIG="pc_x86_64_bios_defconfig";;
arm64)
- DEFCONFIG="qemu_aarch64_virt_defconfig";;
+ DEFCONFIG="aarch64_efi_defconfig";;
arm)
DEFCONFIG="qemu_arm_vexpress_defconfig";;
riscv64)
@@ -40,7 +40,7 @@ case "$TARGETARCH" in
esac
git fetch origin
-git checkout 2021.11.x
+git checkout 2022.02
make "${DEFCONFIG}"
@@ -117,8 +117,11 @@ EOF
arm64)
cat >>.config <<EOF
BR2_cortex_a57=y
-# Kernel is not needed for non-bootable images.
-# BR2_LINUX_KERNEL is not set
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_LINUX_KERNEL_IMAGEGZ=y
+BR2_LINUX_KERNEL_GZIP=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/aarch64-efi/post-image.sh ./post_image_script.sh support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c ./custom-genimage-efi.cfg"
EOF
;;
arm)
@@ -204,9 +207,31 @@ menuentry "syzkaller" {
EOF
EOFEOF
;;
+ arm64)
+cat >post_image_script.sh <<'EOFEOF'
+cat >${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg <<EOF
+set default="0"
+set timeout="0"
+menuentry "syzkaller" {
+ linux /Image.gz root=PARTLABEL=root enforcing=0 console=ttyS0
+}
+EOF
+EOFEOF
+;;
+esac
+
+# Adjust consts in buildroot source files.
+case "$TARGETARCH" in
+ arm64)
+ cp board/aarch64-efi/genimage-efi.cfg custom-genimage-efi.cfg
+ # 64 MB is too small for our large images.
+ sed -i 's/size = 64M/size = 256M/g' custom-genimage-efi.cfg
+ # Also, use compressed images.
+ sed -i 's/Image/Image.gz/g' custom-genimage-efi.cfg
+ ;;
esac
-chmod u+x rootfs_script.sh
+chmod u+x rootfs_script.sh post_image_script.sh
make olddefconfig