Create custom image for new board with EFI?

we design a board of rk3568,I want use manjaro uefi img. how can I modify the kernel and dtb,initrd.gz?

1 Like

If you use EFI, then modifying DTB does nothing. EFI gets the DTB information from the board firmware (u-boot and such).

For kernels and initramfs changes, you can change the build options/config in our PKGBUILD (linux60) and rebuild the kernel with your changes.

I use GitHub - jaredmcneill/quartz64_uefi: A port of Tianocore EDK II to Rockchip RK356x based SBCs. uefi. but I can not know how use dtb for my board?

GitHub - jaredmcneill/quartz64_uefi: A port of Tianocore EDK II to Rockchip RK356x based SBCs. and [Manjaro-ARM-gnome-generic-efi-20221121.img.xz] I want run on my board , how can I modify.

You can run your board image for Manjaro with uefi because I think manjaro kernels have EFI STUB. I mean any image not just the uefi one. To make this you can boot with an ESP partition and startup.nsh. See EFISTUB - ArchWiki

Copy all files in boot partition to an 512 Mb ESP fat32 partition that you have created. Make an startup.nsh in ESP with this text:

image rw root=/dev/sdX initrd=\initramfs-linux.img

A first backspace in this line maybe required. X is the device where the rootfs is stored. Boot the firmware and choose boot and shell. Uefi will find startup.nsh an boot manjaro. Check that the file is found. To make the system update-able edit etc/fstab to mount ESP as boot. This should work with the jaredmcneill firmware (tested) .

When you have a working Manjaro you can edit startup.nsh again an inject yor dtb file.

image rw root=/dev/sdX initrd=\initramfs-linux.img dtb=\myfile.dtb

if I use grub , like this

Surface RT

The Surface RT can use GRUB 2 or UEFI shell as a bootloader. Pre-built ‘.efi’ binaries are available by following the links. These are usually stored in an efi folder on the boot partition of a drive. On a USB drive they are normally given the name /EFI/Boot/bootarm.efi as this is the fallback file loaded by UEFI.

Unfortunately a bug with the Surface RT’s UEFI implementation stops the display from working with most efi applications unless specifically patched (or the EfiFileChainloader is used). Touch and Type Covers also do not work on the Surface RT in these applications. Consequently, configuration files are used to automate booting and pass kernel command line parameters:

  • grub.cfg (GRUB 2)
  • startup.nsh (UEFI shell)

Sadly Ubuntu’s version of GRUB 2 has an additional problem (fails to boot Linux) and should be avoided [bug report needed].

Putting the custom kernel and bootloader files together, the following files need to be added to installation media to boot on the Surface RT:

. ├── EFI │ └── Boot │ └── bootarm.efi ├── grub.cfg or startup.nsh ├── tegra30-microsoft-surface-rt-efi.dtb └── zImage

For booting Ubuntu Server from a USB drive a simple grub.cfg may look like this:

linux /zImage root=/dev/sda2 cpuidle.off=1 net.ifnames=0 rootwait initrd /initrd.img devicetree /tegra30-microsoft-surface-rt-efi.dtb boot

A startup.nsh may look like this:

fs0: zImage dtb=tegra30-microsoft-surface-rt-efi.dtb root=/dev/sda2 cpuidle.off=1 net.ifnames=0 rootwait initrd=initrd.img # shutdown if something went wrong reset -s

First you need to add the dt in this uefi to add support, then sadly you can only fully boot bsd from it as linux still doesn’t fully support uefi acpi for arm. That means you still need dtb to fully boot into linux.

Did you find any luck with booting manjaro on your device?