Can I use EFI Stub booting with M1?

Post Reply
leopold
Posts: 8
Joined: Sun May 07, 2023 12:55 pm
languages_spoken: english
ODROIDs: odroid-m1
Has thanked: 0
Been thanked: 0
Contact:

Can I use EFI Stub booting with M1?

Post by leopold »

I tried some bootloader configs, but petitboot never recognizes it.
Does M1 can be boot with EFI Stub?

User avatar
tobetter
Posts: 11949
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 834 times
Been thanked: 2017 times
Contact:

Re: Can I use EFI Stub booting with M1?

Post by tobetter »

Basically it's not, you would need to remove Petitboot and boot from the bootloader which comes with the OS you are trying to boot up.
What's the OS you are trying to boot? Would you please share the link of the OS image?

leopold
Posts: 8
Joined: Sun May 07, 2023 12:55 pm
languages_spoken: english
ODROIDs: odroid-m1
Has thanked: 0
Been thanked: 0
Contact:

Re: Can I use EFI Stub booting with M1?

Post by leopold »

tobetter wrote:
Fri May 19, 2023 12:11 am
Basically it's not, you would need to remove Petitboot and boot from the bootloader which comes with the OS you are trying to boot up.
What's the OS you are trying to boot? Would you please share the link of the OS image?
I used Arch Linux ARM and I copied some drivers (/lib/kernel, /lib/linux-image-4.19.219-odroid-arm64, /lib/modules/4.19.219-odroid-arm64, /lib/modprobe.d) from HardKernel 1st party Ubuntu Server 20.04.

It works well with booti command in u-boot.
This is script used for generate boot.scr:

Code: Select all

setenv bootlabel ALARM

setenv bootargs root=UUID=(my UUID) rw rootwait audit=0 splash plymouth.ignore-serial-consoles console=ttyS2,1500000 earlycon=uart8250,mmio32,0xfe660000

load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${prefix}/dtbs/rockchip/rk3568-odroid-m1.dtb
load ${devtype} ${devnum}:${partition} ${kernel_addr_r} ${prefix}/Image
load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${prefix}/initramfs-linux.img
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
I referenced this forum article.

User avatar
tobetter
Posts: 11949
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 834 times
Been thanked: 2017 times
Contact:

Re: Can I use EFI Stub booting with M1?

Post by tobetter »

leopold wrote:
Fri May 19, 2023 12:27 am
tobetter wrote:
Fri May 19, 2023 12:11 am
Basically it's not, you would need to remove Petitboot and boot from the bootloader which comes with the OS you are trying to boot up.
What's the OS you are trying to boot? Would you please share the link of the OS image?
I used Arch Linux ARM and I copied some drivers (/lib/kernel, /lib/linux-image-4.19.219-odroid-arm64, /lib/modules/4.19.219-odroid-arm64, /lib/modprobe.d) from HardKernel 1st party Ubuntu Server 20.04.

It works well with booti command in u-boot.
This is script used for generate boot.scr:

Code: Select all

setenv bootlabel ALARM

setenv bootargs root=UUID=(my UUID) rw rootwait audit=0 splash plymouth.ignore-serial-consoles console=ttyS2,1500000 earlycon=uart8250,mmio32,0xfe660000

load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${prefix}/dtbs/rockchip/rk3568-odroid-m1.dtb
load ${devtype} ${devnum}:${partition} ${kernel_addr_r} ${prefix}/Image
load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${prefix}/initramfs-linux.img
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
I referenced this forum article.
Thank you for sharing, then I am wondering why you need EFI boot if it boots?

leopold
Posts: 8
Joined: Sun May 07, 2023 12:55 pm
languages_spoken: english
ODROIDs: odroid-m1
Has thanked: 0
Been thanked: 0
Contact:

Re: Can I use EFI Stub booting with M1?

Post by leopold »

I'm using systemd-boot in all my devices... so i also tried to use systemd-boot in M1.

User avatar
tobetter
Posts: 11949
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 834 times
Been thanked: 2017 times
Contact:

Re: Can I use EFI Stub booting with M1?

Post by tobetter »

leopold wrote:
Fri May 19, 2023 12:32 am
I'm using systemd-boot in all my devices... so i also tried to use systemd-boot in M1.
Ah...I see...then you would check the upstream U-Boot and compile it for ODROID-M1. I understand that ODROID-M1 is already supported, but I haven't tried, it would support EFI boot.

leopold
Posts: 8
Joined: Sun May 07, 2023 12:55 pm
languages_spoken: english
ODROIDs: odroid-m1
Has thanked: 0
Been thanked: 0
Contact:

Re: Can I use EFI Stub booting with M1?

Post by leopold »

tobetter wrote:
Fri May 19, 2023 12:36 am
Ah...I see...then you would check the upstream U-Boot and compile it for ODROID-M1. I understand that ODROID-M1 is already supported, but I haven't tried, it would support EFI boot.
Does upstream U-Boot means U-boot from Hardkernel's Github or official u-boot?

User avatar
tobetter
Posts: 11949
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 834 times
Been thanked: 2017 times
Contact:

Re: Can I use EFI Stub booting with M1?

Post by tobetter »

leopold wrote:
Fri May 19, 2023 12:41 am
tobetter wrote:
Fri May 19, 2023 12:36 am
Ah...I see...then you would check the upstream U-Boot and compile it for ODROID-M1. I understand that ODROID-M1 is already supported, but I haven't tried, it would support EFI boot.
Does upstream U-Boot means U-boot from Hardkernel's Github or official u-boot?
Official U-Boot.

leopold
Posts: 8
Joined: Sun May 07, 2023 12:55 pm
languages_spoken: english
ODROIDs: odroid-m1
Has thanked: 0
Been thanked: 0
Contact:

Re: Can I use EFI Stub booting with M1?

Post by leopold »

tobetter wrote:
Fri May 19, 2023 12:44 am
Official U-Boot.
Thank you very much! I'm almost frustrated by the lack of information... Thank you for providing guidance on the next steps.

usual user
Posts: 62
Joined: Sat Sep 10, 2022 10:47 pm
languages_spoken: english
Has thanked: 1 time
Been thanked: 18 times
Contact:

Re: Can I use EFI Stub booting with M1?

Post by usual user »

Out of curiosity, I just booted native Fedora-Minimal-38-1.6.aarch64.raw.xz.

Code: Select all

U-Boot 2023.07-rc1 (May 08 2023 - 00:00:00 +0000)

Model: Hardkernel ODROID-M1
DRAM:  8 GiB (effective 7.7 GiB)
PMIC:  RK8090 (on=0x80, off=0x08)
Core:  314 devices, 27 uclasses, devicetree: separate
MMC:   mmc@fe2b0000: 1, mmc@fe310000: 0
Loading Environment from nowhere... OK
In:    serial
Out:   serial
Err:   serial
Model: Hardkernel ODROID-M1
Net:   No ethernet found.
starting USB...
Bus usb@fcc00000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@fd000000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@fd800000: USB EHCI 1.00
Bus usb@fd840000: USB OHCI 1.0
Bus usb@fd880000: USB EHCI 1.00
Bus usb@fd8c0000: USB OHCI 1.0
scanning bus usb@fcc00000 for devices... 1 USB Device(s) found
scanning bus usb@fd000000 for devices... 2 USB Device(s) found
scanning bus usb@fd800000 for devices... 2 USB Device(s) found
scanning bus usb@fd840000 for devices... 1 USB Device(s) found
scanning bus usb@fd880000 for devices... 5 USB Device(s) found
scanning bus usb@fd8c0000 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 2 Storage Device(s) found
Hit any key to stop autoboot:  2
=> bootflow scan -l
Scanning for bootflows in all bootdevs
Seq  Method       State   Uclass    Part  Name                      Filename
---  -----------  ------  --------  ----  ------------------------  ----------------
Scanning global bootmeth 'efi_mgr':
Scanning bootdev 'mmc@fe2b0000.bootdev':
  0  distro       ready   mmc          2  mmc@fe2b0000.bootdev.part /extlinux/extlinux.conf
Scanning bootdev 'mmc@fe310000.bootdev':
Card did not respond to voltage select! : -110
Scanning bootdev 'nvme#0.blk#1.bootdev':
  1  distro       ready   nvme         1  nvme#0.blk#1.bootdev.part /extlinux/extlinux.conf
Unknown uclass 'scsi' in label
Scanning bootdev 'usb_mass_storage.lun0.bootdev':
  2  efi          ready   usb_mass_    1  usb_mass_storage.lun0.boo efi/boot/bootaa64.efi
No ethernet found.
No ethernet found.
No more bootdevs
---  -----------  ------  --------  ----  ------------------------  ----------------
(3 bootflows, 3 valid)
=> bootflow list
Showing all bootflows
Seq  Method       State   Uclass    Part  Name                      Filename
---  -----------  ------  --------  ----  ------------------------  ----------------
  0  distro       ready   mmc          2  mmc@fe2b0000.bootdev.part /extlinux/extlinux.conf
  1  distro       ready   nvme         1  nvme#0.blk#1.bootdev.part /extlinux/extlinux.conf
  2  efi          ready   usb_mass_    1  usb_mass_storage.lun0.boo efi/boot/bootaa64.efi
---  -----------  ------  --------  ----  ------------------------  ----------------
(3 bootflows, 3 valid)
=> bootflow select 2
=> bootflow info
Name:      usb_mass_storage.lun0.bootdev.part_1
Device:    usb_mass_storage.lun0.bootdev
Block dev: usb_mass_storage.lun0
Method:    efi
State:     ready
Partition: 1
Subdir:    (none)
Filename:  efi/boot/bootaa64.efi
Buffer:    edf760f0
Size:      ec037 (966711 bytes)
OS:        (none)
Logo:      (none)
FDT:       /dtb/current/rockchip/rk3568-odroid-m1.dtb
FDT size:  0 (0 bytes)
FDT addr:  0
Error:     0
=> bootflow boot
** Booting bootflow 'usb_mass_storage.lun0.bootdev.part_1' with efi
Card did not respond to voltage select! : -110
No EFI system partition
No EFI system partition
Failed to persist EFI variables
Booting /efi\boot\bootaa64.efi
No EFI system partition
Failed to persist EFI variables
No EFI system partition
Failed to persist EFI variables
No EFI system partition
Failed to persist EFI variables
GRUB version 2.06
┌─────────────────────────────────────────────────────────────────────────────────────────┐
│ *Fedora Linux (6.2.9-300.fc38.aarch64) 38 (KDE Plasma)                                  │
│  UEFI Firmware Settings                                                                 │
└─────────────────────────────────────────────────────────────────────────────────────────┘
 Use the ▲ and ▼ keys to select which entry is highlighted.
 Press enter to boot the selected OS, `e' to edit the commands before booting or `c' for a
 command-line. ESC to return previous menu.

 The highlighted entry will be executed automatically in 0s.

 Booting `Fedora Linux (6.2.9-300.fc38.aarch64) 38 (KDE Plasma)

User avatar
tobetter
Posts: 11949
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 834 times
Been thanked: 2017 times
Contact:

Re: Can I use EFI Stub booting with M1?

Post by tobetter »

usual user wrote:
Fri May 19, 2023 2:16 am
Out of curiosity, I just booted native Fedora-Minimal-38-1.6.aarch64.raw.xz.

Code: Select all

U-Boot 2023.07-rc1 (May 08 2023 - 00:00:00 +0000)

Model: Hardkernel ODROID-M1
DRAM:  8 GiB (effective 7.7 GiB)
PMIC:  RK8090 (on=0x80, off=0x08)
Core:  314 devices, 27 uclasses, devicetree: separate
MMC:   mmc@fe2b0000: 1, mmc@fe310000: 0
Loading Environment from nowhere... OK
In:    serial
Out:   serial
Err:   serial
Model: Hardkernel ODROID-M1
Net:   No ethernet found.
starting USB...
Bus usb@fcc00000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@fd000000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@fd800000: USB EHCI 1.00
Bus usb@fd840000: USB OHCI 1.0
Bus usb@fd880000: USB EHCI 1.00
Bus usb@fd8c0000: USB OHCI 1.0
scanning bus usb@fcc00000 for devices... 1 USB Device(s) found
scanning bus usb@fd000000 for devices... 2 USB Device(s) found
scanning bus usb@fd800000 for devices... 2 USB Device(s) found
scanning bus usb@fd840000 for devices... 1 USB Device(s) found
scanning bus usb@fd880000 for devices... 5 USB Device(s) found
scanning bus usb@fd8c0000 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 2 Storage Device(s) found
Hit any key to stop autoboot:  2
=> bootflow scan -l
Scanning for bootflows in all bootdevs
Seq  Method       State   Uclass    Part  Name                      Filename
---  -----------  ------  --------  ----  ------------------------  ----------------
Scanning global bootmeth 'efi_mgr':
Scanning bootdev 'mmc@fe2b0000.bootdev':
  0  distro       ready   mmc          2  mmc@fe2b0000.bootdev.part /extlinux/extlinux.conf
Scanning bootdev 'mmc@fe310000.bootdev':
Card did not respond to voltage select! : -110
Scanning bootdev 'nvme#0.blk#1.bootdev':
  1  distro       ready   nvme         1  nvme#0.blk#1.bootdev.part /extlinux/extlinux.conf
Unknown uclass 'scsi' in label
Scanning bootdev 'usb_mass_storage.lun0.bootdev':
  2  efi          ready   usb_mass_    1  usb_mass_storage.lun0.boo efi/boot/bootaa64.efi
No ethernet found.
No ethernet found.
No more bootdevs
---  -----------  ------  --------  ----  ------------------------  ----------------
(3 bootflows, 3 valid)
=> bootflow list
Showing all bootflows
Seq  Method       State   Uclass    Part  Name                      Filename
---  -----------  ------  --------  ----  ------------------------  ----------------
  0  distro       ready   mmc          2  mmc@fe2b0000.bootdev.part /extlinux/extlinux.conf
  1  distro       ready   nvme         1  nvme#0.blk#1.bootdev.part /extlinux/extlinux.conf
  2  efi          ready   usb_mass_    1  usb_mass_storage.lun0.boo efi/boot/bootaa64.efi
---  -----------  ------  --------  ----  ------------------------  ----------------
(3 bootflows, 3 valid)
=> bootflow select 2
=> bootflow info
Name:      usb_mass_storage.lun0.bootdev.part_1
Device:    usb_mass_storage.lun0.bootdev
Block dev: usb_mass_storage.lun0
Method:    efi
State:     ready
Partition: 1
Subdir:    (none)
Filename:  efi/boot/bootaa64.efi
Buffer:    edf760f0
Size:      ec037 (966711 bytes)
OS:        (none)
Logo:      (none)
FDT:       /dtb/current/rockchip/rk3568-odroid-m1.dtb
FDT size:  0 (0 bytes)
FDT addr:  0
Error:     0
=> bootflow boot
** Booting bootflow 'usb_mass_storage.lun0.bootdev.part_1' with efi
Card did not respond to voltage select! : -110
No EFI system partition
No EFI system partition
Failed to persist EFI variables
Booting /efi\boot\bootaa64.efi
No EFI system partition
Failed to persist EFI variables
No EFI system partition
Failed to persist EFI variables
No EFI system partition
Failed to persist EFI variables
GRUB version 2.06
┌─────────────────────────────────────────────────────────────────────────────────────────┐
│ *Fedora Linux (6.2.9-300.fc38.aarch64) 38 (KDE Plasma)                                  │
│  UEFI Firmware Settings                                                                 │
└─────────────────────────────────────────────────────────────────────────────────────────┘
 Use the ▲ and ▼ keys to select which entry is highlighted.
 Press enter to boot the selected OS, `e' to edit the commands before booting or `c' for a
 command-line. ESC to return previous menu.

 The highlighted entry will be executed automatically in 0s.

 Booting `Fedora Linux (6.2.9-300.fc38.aarch64) 38 (KDE Plasma)
Where did you get the minimal image? I am only able to find the download page here, https://ftp.riken.jp/Linux/fedora/releases/38/

leopold
Posts: 8
Joined: Sun May 07, 2023 12:55 pm
languages_spoken: english
ODROIDs: odroid-m1
Has thanked: 0
Been thanked: 0
Contact:

Re: Can I use EFI Stub booting with M1?

Post by leopold »

tobetter wrote:
Fri May 19, 2023 12:36 am
Ah...I see...then you would check the upstream U-Boot and compile it for ODROID-M1. I understand that ODROID-M1 is already supported, but I haven't tried, it would support EFI boot.
I tried to use upstream u-boot but it does not boot at all...
Am I doing something wrong?

here's my build&flash process:

Code: Select all

export BL31=../rkbin/bin/rk35/rk3568_bl31_v1.34.elf
export ROCKCHIP_TPL=../rkbin/bin/rk35/rk3568_ddr_1560MHz_v1.13.bin
make evb-rk3568_defconfig
make CROSS_COMPILE=aarch64-linux-gnu-
# successfully builds

# Created uboot partition

## odroid-m1 wiki
sudo dd if=uboot.img of=/dev/disk/by-partlabel/uboot conv=fsync
#does not boot

## Package the image with U-Boot TPL/SPL
sudo dd if=u-boot-rockchip.bin of=/dev/sda seek=64
sync
# does not boot

## Package the image with Rockchip miniloader
cd u-boot
./tools/mkimage  -n rk3568 -T rksd -d ../rkbin/bin/rk35/rk3568_ddr_1560MHz_v1.13.bin idbloader.img
cat ../rkbin/bin/rk35/rk3568_miniloader_spinand_v1.13.bin >> idbloader.img
sudo dd if=idbloader.img of=/dev/sda seek=64

cd ../rkbin
 ./tools/trust_merger RKTRUST/RK3568TRUST.ini
 sudo dd if=trust.img of=/dev/sda seek=24576
 
 cd ../u-boot
 ../rkbin/tools/loaderimage --pack --uboot u-boot-dtb.bin uboot.img 0x200000
sudo dd if=uboot.img of=/dev/sda seek=16384
sync
# does not boot

usual user
Posts: 62
Joined: Sat Sep 10, 2022 10:47 pm
languages_spoken: english
Has thanked: 1 time
Been thanked: 18 times
Contact:

Re: Can I use EFI Stub booting with M1?

Post by usual user »

tobetter wrote:
Fri May 19, 2023 2:15 pm
Where did you get the minimal image?
As you can see from the given log, I didn't really use the minimal image, but the Fedora-KDE-38-1.6.aarch64.raw.xz. But in the end, it doesn't matter what raw image you choose from here, they should all use the EFI bootflow equally. It's just a matter of personal taste, which one you prefer.
leopold wrote:
Fri May 19, 2023 5:41 pm
Am I doing something wrong?
You are building the wrong target. Mainline does not yet contain all the necessary code, too much is still in flight. Another pull request has just been posted, but it's not the last one needed. With a lot of luck, everything will end up in the 2023.07 release, but it may well be that full out-of-the-box support will not be available until 2023.10. If you want, I can share my firmware build as a development preview if you want to play around with it now.

leopold
Posts: 8
Joined: Sun May 07, 2023 12:55 pm
languages_spoken: english
ODROIDs: odroid-m1
Has thanked: 0
Been thanked: 0
Contact:

Re: Can I use EFI Stub booting with M1?

Post by leopold »

usual user wrote:
Sat May 20, 2023 12:56 am
leopold wrote:
Fri May 19, 2023 5:41 pm
Am I doing something wrong?
You are building the wrong target. Mainline does not yet contain all the necessary code, too much is still in flight. Another pull request has just been posted, but it's not the last one needed. With a lot of luck, everything will end up in the 2023.07 release, but it may well be that full out-of-the-box support will not be available until 2023.10. If you want, I can share my firmware build as a development preview if you want to play around with it now.
If you could do that for me, I would be very grateful.

usual user
Posts: 62
Joined: Sat Sep 10, 2022 10:47 pm
languages_spoken: english
Has thanked: 1 time
Been thanked: 18 times
Contact:

Re: Can I use EFI Stub booting with M1?

Post by usual user »

leopold wrote:
Sun May 21, 2023 8:37 pm
If you could do that for me,
The firmware is uploaded here. Put it in place by:

Code: Select all

dd bs=512 seek=64 conv=notrunc,fsync if=u-boot-rockchip.bin of=/dev/${entire-device-to-be-used}
into the firmware area of an eMMC or an SD card. Unfortunately, native fedora images do not have enough space to integrate it into the image due to their partition structure, so you have to place it in an otherwise empty boot storage device and the image in any other storage. With Petiboot still in SPI flash, you have to hold the SPI recovery button (RCY) while powering up to get it started. It will scan all connected storage media for a usable bootflow. Supported boot methodes are: extlinux (extlinux.conf), efiboot and legacy-boot (boot.scr). It supports loading compressed kernels and can also use a USB keyboard for u-boot input. As soon as HDMI video support is available, "U-Boot Standard Boot" will be fully usable, but VOP2 support is still open.
These users thanked the author usual user for the post:
odroid (Mon May 22, 2023 10:44 am)

leopold
Posts: 8
Joined: Sun May 07, 2023 12:55 pm
languages_spoken: english
ODROIDs: odroid-m1
Has thanked: 0
Been thanked: 0
Contact:

Re: Can I use EFI Stub booting with M1?

Post by leopold »

usual user wrote:
Sun May 21, 2023 9:52 pm
The firmware is uploaded here. Put it in place by:

Code: Select all

dd bs=512 seek=64 conv=notrunc,fsync if=u-boot-rockchip.bin of=/dev/${entire-device-to-be-used}
into the firmware area of an eMMC or an SD card. Unfortunately, native fedora images do not have enough space to integrate it into the image due to their partition structure, so you have to place it in an otherwise empty boot storage device and the image in any other storage. With Petiboot still in SPI flash, you have to hold the SPI recovery button (RCY) while powering up to get it started. It will scan all connected storage media for a usable bootflow. Supported boot methodes are: extlinux (extlinux.conf), efiboot and legacy-boot (boot.scr). It supports loading compressed kernels and can also use a USB keyboard for u-boot input. As soon as HDMI video support is available, "U-Boot Standard Boot" will be fully usable, but VOP2 support is still open.
Wow... works like magic. Thank you very much for your help.

Post Reply

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 1 guest