From 69f18685326a2a977422d7b7ba8251658d33344e Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Fri, 5 May 2023 19:58:15 +0000 Subject: Add support for generating boot.iso on aarch64 --- images/make_boot_img | 48 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) (limited to 'images/make_boot_img') diff --git a/images/make_boot_img b/images/make_boot_img index c7823b324..d573ad620 100755 --- a/images/make_boot_img +++ b/images/make_boot_img @@ -38,6 +38,7 @@ my @kernels = chomp_(cat_('all.kernels/.list')); my @all_images = ( if_($arch =~ /i.86|x86_64/, 'isolinux', 'boot.iso', 'all.img', 'hd_grub.img'), + if_($arch =~ /aarch64/, 'boot.iso'), ); my @images = @ARGV ? @ARGV : map { "images/$_" } @all_images; @@ -193,6 +194,7 @@ sub entries_append { sub syslinux_cfg_all { my ($type, $b_gfxboot) = @_; + my $arch = arch(); syslinux_cfg([ (map { { kernel => "$arch/vmlinuz", initrd => "$arch/all.rdz", %$_ }; @@ -201,7 +203,7 @@ sub syslinux_cfg_all { { label => $arch, kernel => "$arch/vmlinuz", initrd => "$arch/all.rdz", append => join(' ', grep { $_ } $default_append, $default_acpi, $default_vga, $default_iswmd) }; } @kernels), - { label => 'memtest', kernel => 'memtest' }, + if_($arch =~ /i.86|x86_64/, { label => 'memtest', kernel => 'memtest' }), ], $b_gfxboot); } sub remove_ending_zero { @@ -242,6 +244,7 @@ sub boot_img_i386 { # alias to x86 variant, slightly bigger with images though sub boot_img_x86_64 { &boot_img_i386 } +sub boot_img_aarch64 { } sub VERSION { my ($kernels) = @_; @@ -266,7 +269,10 @@ sub syslinux_all_files { rename("images/all.rdz-$_", "$dir/$arch/all.rdz"); } @$kernels; - _ "install -m 644 -D /boot/memtest* $dir/memtest"; + my $arch = arch(); + if ($arch =~ /i.x6|x86_64/) { + _ "install -m 644 -D /boot/memtest* $dir/memtest"; + } output("$dir/help.msg", syslinux_msg('help.msg.xml')); output("$dir/advanced.msg", syslinux_msg('advanced.msg.xml', @@ -318,6 +324,9 @@ sub boot_iso { output('.boot_iso/VERSION', VERSION($kernels)); + my $arch = arch(); + if ($arch =~ /i.x6|x86_64/) { + # for the boot iso, use standard isolinux _ "cp $isolinux_bin .boot_iso/isolinux/isolinux.bin"; _ "cp /usr/lib/syslinux/ifcpu.c32 .boot_iso/isolinux/ifcpu.c32"; @@ -336,29 +345,44 @@ sub boot_iso { output('.boot_iso/isolinux/isolinux.cfg', syslinux_cfg_all('', $with_gfxboot)); - if ($ENV{BOOT_AUTOMATIC_METHOD}) { + if ($ENV{BOOT_AUTOMATIC_METHOD} && $arch eq 'x86_64') { _ "sed -i 's#\\(append .*\\)\\(splash quiet\\|rescue\\)\$#\\1\\2 automatic=$ENV{BOOT_AUTOMATIC_METHOD}#' .boot_iso/isolinux/isolinux.cfg"; } - my $arch = arch(); - my $options = "-J -joliet-long -r -v -T -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table"; + } + my $options = $arch != "aarch64" ? "-J -joliet-long -r -v -T -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table" : ""; my $cmd = "xorriso -as mkisofs -U -A 'Mageia-$ENV{DISTRIB_VERSION}-$arch-netinstall' -V 'Mageia-$ENV{DISTRIB_VERSION}-$arch-netinstall' -volset 'Mageia-$ENV{DISTRIB_VERSION}-$arch' $options"; + # create efi stuff on the fly - if ($arch =~ /x86_64/) { + if ($arch =~ /x86_64|aarch64/) { _ "mkdir -p .boot_iso/EFI/BOOT/"; # create efi loader - my $efi_core = "configfile normal boot linux linux32 loadenv ls reboot search search_label"; + my $efi_core = "configfile normal boot linux loadenv ls reboot search search_label"; my $efi_part_fs = "part_msdos part_gpt part_apple fat iso9660 udf"; - my $efi_gfx = "gfxmenu gfxterm efi_gop efi_uga video video_bochs video_cirrus video_fb font png"; - _ "/usr/bin/grub2-mkimage --prefix='/EFI/BOOT' -O x86_64-efi -o .boot_iso/EFI/BOOT/bootx64.efi $efi_core $efi_part_fs $efi_gfx"; + my $efi_gfx = "gfxmenu gfxterm efi_gop video video_fb font png"; + if ($arch eq 'x86_64') { + $efi_core .= " linux32"; + $efi_gfx .= " efi_uga video_bochs video_cirrus"; + } + if ($arch eq 'aarch64') { + $efi_core .= " gzio"; + } + my $grub_fmt = $arch == 'aarch64' ? 'arm64-efi' : 'x86_64-efi'; + my $grub_img = $arch == 'aarch64' ? 'bootaa64.efi' : 'bootx64.efi'; + _ "/usr/bin/grub2-mkimage --prefix='/EFI/BOOT' -O $grub_fmt -o .boot_iso/EFI/BOOT/$grub_img $efi_core $efi_part_fs $efi_gfx"; _ "cp -f grub2.config .boot_iso/EFI/BOOT/grub.cfg"; if ($ENV{BOOT_AUTOMATIC_METHOD}) { _ "sed -i 's#\\(linux .*\\)#\\1 automatic=$ENV{BOOT_AUTOMATIC_METHOD}#' .boot_iso/EFI/BOOT/grub.cfg"; _ "sed -i 's#timeout=[0-9]*#timeout=1#' .boot_iso/EFI/BOOT/grub.cfg"; } + if ($arch ne 'x86_64') { + _ "sed -i 's#x86_64#$arch#g' .boot_iso/EFI/BOOT/grub.cfg"; + } # add theme _ "cp -r -L /boot/grub2/themes .boot_iso/EFI/BOOT/"; - _ "cp -f grub2.theme .boot_iso/EFI/BOOT/themes/maggy/theme.txt"; + if ($arch eq 'x86_64') { + _ "cp -f grub2.theme .boot_iso/EFI/BOOT/themes/maggy/theme.txt"; + } _ "mkdir -p .boot_iso/EFI/BOOT/fonts"; _ "cp -f /usr/share/grub/unicode.pf2 .boot_iso/EFI/BOOT/fonts/"; # create efiboot.img, mtools wants the image to be a power of 32. @@ -368,7 +392,9 @@ sub boot_iso { _ "mcopy -s -i $efi_img .boot_iso/EFI ::"; # create iso _ "$cmd -eltorito-alt-boot -e isolinux/efiboot.img -no-emul-boot -o $iso .boot_iso"; - _ "isohybrid -u $iso"; + if ($arch =~ /x86_64/) { + _ "isohybrid -u $iso"; + } } else { _ "$cmd -o $iso .boot_iso"; _ "isohybrid -o 1 $iso"; -- cgit v1.2.1