...
The goal of the document is to illustrate how to install GRUB 2 (grub-uboot) on an SD card with Plus 1 ( SP7021 ) Linux kernel. Refer toHow to build SP7021 Linux image for booting from SD card or How to build and install Plus 1 ( SP7021 ) Linux image to run Raspbian on SD card for creating an SD card with Linux kernel. After creating your SD card, your SD card should contain two partitions. One is called boot partition and the other is called rootfs partition. boot partition is formatted with FAT32 file system. Boot-loader, kernel and other related files are put here. After power-on, SP7021 loads boot-loader and starts its booting processes. Refer to screenshot of list of boot partition:
...
We need to create folder /boot and /boot/grub in rootfs partition and copy files to in step 2. Please follow the following steps to install GRUB to your SD card.
1. Copy GRUB efi files
Copy efi files, bootarm.efi and bootaa64.efi, to folder /efi/boot of boot partition (FAT32). Refer to screenshot of list of folder /efi/boot of boot partition:
...
bootarm.efi is for ARM armhf architecture and bootaa64.efi is for ARM arm64 architecture. The second file is optional. The folder also contains grub configuration file, grub.cfg, which instructs grub what to do. It is a text file. You can use a text editor to read or edit it. File, efi-boot.7z, contains all files in folder efi/boot:
View file | ||
---|---|---|
|
2. Copy Linux kernel and GRUB files
Copy file zImage (compressed Linux kernel) to folder /boot of rootfs partition (ext3 or ext4). Copy whole grub folder to folder /boot/grub of rootfs partition. Refer to screenshot of list of folder /boot and /boot/grub:
...
View file | ||
---|---|---|
|
3. Modify config file of GRUB
Modify uuid of /efi/boot/grub.cfg to uuid of rootfs partition. Refer to content of file, /efi/boot/grub.cfg, below:
...
search command will search rootfs partition with uuid equaling to 190b3b5a-f187-4128-ab49-bd8f3eb077ff and set variable, root, to it. Please modify uuid to uuid of your rootfs partition. Variable, prefix, is set to folder of grub in rootfs. The last command is normal which means to boot in normal mode.
4. Write config file of GRUB
Write GRUB configure file in rootfs partition, /boot/grub/grub.cfg. Refer to grub.cfg in attached file, boot-grub.7z.
This configuration file defines three menu entries, “Sunplus SP7021 GNU/Linux 4.19.37”, “Sunplus SP7021 GNU/Linux 4.19.37 (recovery mode)”, and “Sunplus SP7021 GNU/Linux 4.19.37 (debug mode)”.
5. Modify u-boot environment file
Modify u-boot environment file “uEnv.txt” as shown below:
...
bootefi command jumps to run grub efi file, /efi/boot/bootarm.efi loaded in memory. Address of dtb of u-boot, $fdtcontroladdr, is put as the second argument of bootefi command.
6. Boot Linux system
Boot the system. You will see GRUB menu. Use Up- or Down-key to select the entry and press Enter to boot the selected OS.
...
7. Appendix:
To support grub-uboot, the following feature of u-boot should be enabled.
...