Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
RockPro64 installation - grub problems
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 721
Location: Oslo, Norway

PostPosted: Sun Nov 26, 2023 8:49 am    Post subject: RockPro64 installation - grub problems Reply with quote

I tried to boot using install-arm64-minimal-20231112T233159Z.iso on a sdcard. I have U-Boot 2017.09-rockchip-ayufan-1065-g95f6152134 loaded in the SPI flash and it was able to detect the MMC and boot from it. But it appears that grub is failing. Here from the output from serial console:

Code:

Scanning disk sdhci@fe330000.blk...
MMC: block number 0x1 exceeds max(0x0)
MMC: block number 0x1 exceeds max(0x0)
MMC: block number 0x44 exceeds max(0x0)
Scanning disk dwmmc@fe320000.blk...
Found 2 disks
Welcome to GRUB!

GNU GRUB  version 2.06


Then the grub rectangle. Hitting return to boot which resulted in:

Code:

                      EFI stub: Booting Linux Kernel...
EFI stub: EFI_RNG_PROTOCOL unavailable
EFI stub: ERROR: FIRMWARE BUG: efi_loaded_image_t::image_base has bogus value
EFI stub: ERROR: FIRMWARE BUG: kernel image not aligned on 64k boundary
EFI stub: ERROR: Failed to install memreserve config table!
EFI stub: ERROR: Could not determine UEFI Secure Boot status.
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services...
EFI stub: ERROR: Unable to construct new device tree.
EFI stub: ERROR: Failed to update FDT and exit boot services
GNU GRUB  version 2.06



Then back to grub again.

I then booted using Armbian bookworm on a USB stick and I'm now in the process of installing Gentoo on a sdcard.

I would think it would be possible to skip the grub installation and use u-boot only to boot Gentoo. Did anybody try this? Are there any caveats related to booting Gentoo using u-boot on the RockPro64?
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 926
Location: Richmond Hill, Canada

PostPosted: Sun Nov 26, 2023 11:35 am    Post subject: Reply with quote

pgu,

Is boot into grub from original setup? (as in from vendor)

Is kernel from original setup? or it is something of your own build?

Is EFI boot required?

This entire boot sequence is complicated, so it would be best to reduce it to a little bit simpler for trouble shooting. BTW, u-boot is also possible boot EFI stub kernel.

Finally suggest move this thread to ARM forum, there could be more people familiar with this kind of boot sequence.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4160
Location: Bavaria

PostPosted: Sun Nov 26, 2023 11:43 am    Post subject: Reply with quote

@pingtoo, your are right.

Moved from Installing Gentoo to Gentoo on ARM.
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 721
Location: Oslo, Norway

PostPosted: Sun Nov 26, 2023 12:19 pm    Post subject: Reply with quote

pingtoo wrote:
pgu,

Is boot into grub from original setup? (as in from vendor)

Is kernel from original setup? or it is something of your own build?

Is EFI boot required?

This entire boot sequence is complicated, so it would be best to reduce it to a little bit simpler for trouble shooting. BTW, u-boot is also possible boot EFI stub kernel.

Finally suggest move this thread to ARM forum, there could be more people familiar with this kind of boot sequence.


There is no original setup from the vendor that I'm aware of. I flashed a working u-boot to the on-board spi flash. This u-boot will let me boot other distros from either the sdcard or usb without problems.

I don't know much about the gentoo iso image for arm64 as this is the first time I use it. If there's a kernel involved at the point of failure it must be related to the one in the gentoo iso file.

But again, I'm currently building gentoo on the board after booting from Armbian. It takes a while to compile the kernel and most of the SW, but I'll see how that goes and if I'm able to boot it from u-boot when I'm done.

Thanks for the suggestion of moving it to the Gentoo on Arm forum.
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 370

PostPosted: Sun Nov 26, 2023 1:03 pm    Post subject: Reply with quote

Why do you think it is a problem with Grub? The messages look like they are coming from the kernel.
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 721
Location: Oslo, Norway

PostPosted: Sun Nov 26, 2023 1:57 pm    Post subject: Reply with quote

sMueggli wrote:
Why do you think it is a problem with Grub? The messages look like they are coming from the kernel.


Because I got into the grub "gui" (i.e. it did draw the rectangle) and I was able to select the boot option in grub and I never got any messages like "Linux version 6.1.57-gentoo" from the kernel. But if you know that the EFI stub output is from the kernel then it might be the kernel which is the problem, or more likely that some boot parameters which are different from the defaults might be required from grub.

The RockPro64 wiki does not mention any such parameters though and I don't observe any messages like the ones in the wiki.

https://wiki.gentoo.org/wiki/PINE64_ROCKPro64/Installing_Gentoo
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 926
Location: Richmond Hill, Canada

PostPosted: Sun Nov 26, 2023 2:58 pm    Post subject: Reply with quote

pgu wrote:
pingtoo wrote:
pgu,

Is boot into grub from original setup? (as in from vendor)

Is kernel from original setup? or it is something of your own build?

Is EFI boot required?

This entire boot sequence is complicated, so it would be best to reduce it to a little bit simpler for trouble shooting. BTW, u-boot is also possible boot EFI stub kernel.

Finally suggest move this thread to ARM forum, there could be more people familiar with this kind of boot sequence.


There is no original setup from the vendor that I'm aware of. I flashed a working u-boot to the on-board spi flash. This u-boot will let me boot other distros from either the sdcard or usb without problems.

I don't know much about the gentoo iso image for arm64 as this is the first time I use it. If there's a kernel involved at the point of failure it must be related to the one in the gentoo iso file.

But again, I'm currently building gentoo on the board after booting from Armbian. It takes a while to compile the kernel and most of the SW, but I'll see how that goes and if I'm able to boot it from u-boot when I'm done.

Thanks for the suggestion of moving it to the Gentoo on Arm forum.


I am assuming the the ROCKPro64 have its own system image (or a recommend one if there are more than one).

Gentoo stage3 does not include kernel binary, so you have to got it from somewhere, Do you compiled one you self?

Grub does not necessary setup a EFI required environment, the message seems indicate the kernel was build with efi stub on top. this mean it is expecting certain EFI setting already in memory before kernel start and your boot messages seems indicate it is not there.

I suggest you try to find a kernel that is NOT efi stub based to try.

Does the Armbian boot also show efi stub message on top?
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 721
Location: Oslo, Norway

PostPosted: Sun Nov 26, 2023 3:22 pm    Post subject: Reply with quote

pingtoo wrote:


I am assuming the the ROCKPro64 have its own system image (or a recommend one if there are more than one).

Gentoo stage3 does not include kernel binary, so you have to got it from somewhere, Do you compiled one you self?

Grub does not necessary setup a EFI required environment, the message seems indicate the kernel was build with efi stub on top. this mean it is expecting certain EFI setting already in memory before kernel start and your boot messages seems indicate it is not there.

I suggest you try to find a kernel that is NOT efi stub based to try.

Does the Armbian boot also show efi stub message on top?


As far as I know there is only one . The RockPro64 wiki only mentions the arm64 minimal installation CD image.

I did not even get to the stage3 download. I tried to boot the arm64 minimal installation CD image (dd'ed to a sdcard) and I only got into the grub boot menu and tried to boot and got the messages shown in my initial message.
Armbian has a u-boot script which is executed and does not use grub.



Code:

       scanning usb for storage devices... 1 Storage Device(s) found

Device 0: Vendor:  USB Rev: 1.00 Prod:  SanDisk 3.2Gen1
            Type: Removable Hard Disk
            Capacity: 14664.0 MB = 14.3 GB (30031872 x 512)
... is now current device
Scanning usb 0:1...
Found U-Boot script /boot/boot.scr
3252 bytes read in 437 ms (6.8 KiB/s)
## Executing script at 00500000
Boot script loaded from usb 0
117 bytes read in 411 ms (0 Bytes/s)
21611599 bytes read in 1517 ms (13.6 MiB/s)
29792768 bytes read in 1790 ms (15.9 MiB/s)
83229 bytes read in 1276 ms (63.5 KiB/s)
2698 bytes read in 616 ms (3.9 KiB/s)
Applying kernel provided DT fixup script (rockchip-fixup.scr)
## Executing script at 09000000
Unknown command 'kaslrseed' - try 'help'
## Loading init Ramdisk from Legacy Image at 04000000 ...
   Image Name:   uInitrd
   Image Type:   AArch64 Linux RAMDisk Image (gzip compressed)
   Data Size:    21611535 Bytes = 20.6 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 01f00000
   Booting using the fdt blob at 0x1f00000
   Loading Ramdisk to f4a64000, end f5f0040f ... OK
   reserving fdt memory region: addr=1f00000 size=7a000
   Loading Device Tree to 00000000f49e7000, end 00000000f4a63fff ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 6.1.50-current-rockchip64 (armbian@next) (aarch64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #3 SMP PREEMPT Wed Aug 30 14:11:13 UTC 2023
[    0.000000] Machine model: Pine64 RockPro64 v2.1
[    0.000000] earlycon: uart8250 at MMIO32 0x00000000ff1a0000 (options '')
[    0.000000] printk: bootconsole [uart8250] enabled
done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... Scanning for Btrfs filesystems
done.
Begin: Will now check root file system ... fsck from util-linux 2.38.1
[/sbin/fsck.ext4 (1) -- /dev/sda1] fsck.ext4 -a -C0 /dev/sda1
armbi_root: clean, 46924/120480 files, 423937/481280 blocks
done.
done.
Begin: Running /scripts/local-bottom ... done.
Begin: Running /scripts/init-bottom ... done.

Welcome to Armbian 23.8.1 bookworm!
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 926
Location: Richmond Hill, Canada

PostPosted: Sun Nov 26, 2023 4:20 pm    Post subject: Reply with quote

pgu,

I am surprised that u-boot can actually boot from iso 9660 file system. But anyway you got it load the grub.

Not having a Rockpro64 at hand t is hard to know exact thing you need to do to get it boot, but I can give you a general idea,

Your SD card should be partitioned either in DOS label or GPT label. Not sure how your u-boot configuration, it may support both.

your armbian image on USB could give you good idea on what you need to do for the SD card.

My guess is the armbian image should have a "boot" partition, most likely a vfat file system. Once you formatted your SD card you can copy the entire boot filesystem content to your SD card's boot partition's file system. This way you will get a working kernel and/or ramdisk (initrd/initramfs) plus all the dtb and may be other firmware files.

You can have second partition on the SD card load with Gentoo stage3 for aarch64.

Once you have the boot partition's file system load with right content you can modify the kernel command line argument to use the second partition as rootfs. that way you will be boot into Gentoo without grub.

If you need to more detail information on howto, I will need information on how the armbian USB partitioned and the boot partition content in order to provide more specific instructions.
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 721
Location: Oslo, Norway

PostPosted: Sun Nov 26, 2023 8:39 pm    Post subject: Reply with quote

Yes, this is the first time I use the install-arm64-minimal image which looks like this from fdisk:

Code:

Disk /tmp/install-arm64-minimal-20231112T233159Z.iso: 689.61 MiB, 723103744 bytes, 1412312 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 4E98C17C-3D43-48AE-A7CF-B6A60D725063

Device                                           Start     End Sectors   Size Type
/tmp/install-arm64-minimal-20231112T233159Z.iso1    64     271     208   104K Microsoft basic data
/tmp/install-arm64-minimal-20231112T233159Z.iso2   272    6031    5760   2.8M EFI System
/tmp/install-arm64-minimal-20231112T233159Z.iso3  6032 1412247 1406216 686.6M Microsoft basic data

Command (m for help): quit


Thank you for the feedback. I've done it like it says in the wiki mentioned earlier, which is basically like the amd64 variant. But I'll just leave out the grub part.
If the kernel and rootfs build works out like expected I should be able to boot it using the u-boot I have in the spi flash.
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 721
Location: Oslo, Norway

PostPosted: Tue Nov 28, 2023 8:10 am    Post subject: Reply with quote

It seems like my own gentoo build behaves pretty much the same as the install image:

Code:


grub>insmod part_gpt

grub>ls (hd0,gpt3)/boot
vmlinuz-6.1.57-gentoo System.map-6.1.57-gentoo config-6.1.57-gentoo efi/
grub/

grub>linux (hd0,gpt3)/boot/vmlinuz-6.1.57-gentoo root=/dev/mmcblk0p3 console=ttyS2,1500000

grub>boot



Unfortunately grub fills the screen with control characters so it's a bit hard to read and dump to file, but I get the same EFI stub errors:


Code:


grub> boot

EFI stub: Booting Linux Kernel...
EFI stub: ERROR: FIRMWARE BUG: efi_loaded_image_t::image_base has bogus value
EFI stub: ERROR: FIRMWARE BUG: kernel image not aligned on 64k boundary
EFI stub: ERROR: Failed to install memreserve config table!
EFI stub: ERROR: Could not determine UEFI Secure Boot status.
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services...
EFI stub: ERROR: Unable to construct new device tree.
"Synchronous Abort" handler, esr 0x96000010
ELR:     f7f6dbb4
LR:      f7f6c4bc
x0 : 00000000000000d5 x1 : 00000000f7fec000
x2 : 000000000000000d x3 : 00000000000000d5
x4 : 0000000000000000 x5 : 0000000000000000
x6 : 0000000000000015 x7 : 00000000f5f01ef8
x8 : 00000000f5f36400 x9 : 00000000000097dc
x10: 00000000f5f01e4c x11: 0000000000009754
x12: 00000000f5f01f78 x13: 00000000b18e0000
x14: 00000000f5f01f1c x15: 00000000f34e55c5
x16: 00000000f346fc08 x17: 000000000d1c8458
x18: 00000000f5f0fe08 x19: 8000000000000001
x20: 0000000000009754 x21: 00000000b1c00000
x22: 00000000f5f197e0 x23: 00000000b50ba000
x24: ffffffffffffffff x25: 00000000f5f02028
x26: 00000000b50ba000 x27: 0000000000000000
x28: 00000000f5f1b2e0 x29: 00000000f5f01fa0

Resetting CPU ...


I will give u-boot a shot with the Armbian kernel and dtb using my genereted gentoo rootfs.

BTW is there a way to turn off all the fancy graphics mode from grub as it makes the serial output unreadable both on the screen and in the logged file (from gnu screen)?

I tried "terminfoa -a vt100 dumb" but it seems like whatever I pass for the TERM argument it is not accepted. Also just typing "terminfo" outputs "Current terminfo types:" and nothing.
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 721
Location: Oslo, Norway

PostPosted: Tue Nov 28, 2023 3:56 pm    Post subject: Reply with quote

pgu wrote:
I will give u-boot a shot with the Armbian kernel and dtb using my genereted gentoo rootfs..


It works if I boot using u-boot and booting my gentoo built kernel and root file system. I'm only using the dtb and uinitrd from armbian:


Code:

setenv bootargs 'console=ttyS2,1500000 root=UUID=16487e09-1f86-4e14-9f5e-adcaa418f624'
load mmc 1:1 ${ramdisk_addr_r} armbian/uinitrd-6.1.50-current-rockchip64
load mmc 1:3 $kernel_addr_r boot/vmlinuz-6.1.57-gentoo
load mmc 1:1 $fdt_addr_r armbian/dtb-6.1.50-current-rockchip64/rockchip/rk3399-rockpro64.dtb
booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}


Which yields:

Code:

rockpro64 ~ # uname -a
Linux rockpro64 6.1.57-gentoo #1 SMP PREEMPT Sun Nov 26 18:23:04 CET 2023 aarch64 GNU/Linux



The serial console is dropping characters when I log into gentoo, but other than that it appears to work fine. I'm able to use ssh to emerge new stuff etc.
I can do fine without grub and use u-boot instead.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum