uboot has watchdog timeout, but it is ~20 sec of inactivity and shows message before do the reset…
have not tried using grub because one bootloader is enough for me what do you want to archive with it?
uboot has watchdog timeout, but it is ~20 sec of inactivity and shows message before do the reset…
have not tried using grub because one bootloader is enough for me what do you want to archive with it?
More familiar environment for me, no u-boot image ‘magic’,no uboot env - easy to update kernel, easy to use initramfs(useful for mdadm, zfs, dmraid, etc), new experience
Where can I disable it or edit timeout? Not very convinient when r2 reboots during reading manuals .
I didn’t catched the message.
maybe by disabling the watchdog-driver…imho timeout cannot be increased
if not maybe you can start timer again if it is timed-out
It is hardware timer. You should put grup to update watchdog timer regular interval. I don’t know how but I guess that broblem is solved in grub somehow.
Fixed!
The problem was in wrong grub loading address.
Works great with:
load mmc 0:1 0x88000000 /grub/arm-uboot/core.img; bootm 0x88000000
Kernel loads, and works great:
Loading Devicetree ...
Loading Linux 5.5.0-rc1-arm+ ...
Loading initial ramdisk ...
Done, starting ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.5.0-rc1-arm+ (root@bpi-r2-gentoo) (gcc version 9.2.0 (Gentoo 9.2.0-r2 p3)) #1 SMP Wed Jan 29 23:02:39 PST 2020
[ 0.000000] CPU: ARMv7 Processor [410fc073] revision 3 (ARMv7), cr=10c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: Bananapi BPI-R2
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] [WMT-CONSYS-HW][W]reserve_memory_consys_fn: name: consys-reserve-memory, base: 0xffe00000, size: 0x100000
[ 0.000000] OF: reserved mem: initialized node consys-reserve-memory, compatible id mediatek,consys-reserve-memory
[ 0.000000] cma: Reserved 64 MiB at 0xfb800000
Menuenty for my boot:
menuentry 'Gentoo GNU/Linux, with Linux 5.5.0-rc1-arm+' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.5.0-rc1-arm+-advanced-4d920cff-b900-40c2-90c8-ffc716a6656f' {
load_video
insmod gzio
insmod part_msdos
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 4449-36D1
else
search --no-floppy --fs-uuid --set=root 4449-36D1
fi
echo 'Loading Devicetree ...'
devicetree /bpi-r2.dtb
echo 'Loading Linux 5.5.0-rc1-arm+ ...'
linux /vmlinuz-5.5.0-rc1-arm+ root=UUID=4d920cff-b900-40c2-90c8-ffc716a6656f ro root=/dev/sdb1 rootfstype=ext4 rootwait console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200
echo 'Loading initial ramdisk ...'
initrd /initramfs-5.5.0-rc1-arm+.img
echo 'Done, starting ...'
}
P.S. grub is installed to /boot using:
bpi-r2-gentoo ~ # grub-install /boot
Installing for arm-uboot platform.
grub-install: warning: no hints available for your platform. Expect reduced performance.
grub-install: warning: WARNING: no platform-specific install was performed.
Installation finished. No error reported.
P.P.S. My personal benefits using GRUB is to update, install and/or use multiple kernels without modifying u-boot env.
Small HOWTO:
Grub requires u-boot with enabled U-Boot API (enabled from menuconfig)
and
diff --git a/include/configs/mt7623.h b/include/configs/mt7623.h
index e5182aeea8..50c3fc66b0 100644
--- a/include/configs/mt7623.h
+++ b/include/configs/mt7623.h
@@ -15,6 +15,10 @@
#define CONFIG_SETUP_MEMORY_TAGS
#define CONFIG_INITRD_TAG
#define CONFIG_CMDLINE_TAG
+#define CONFIG_SYS_MMC_MAX_DEVICE 2
+#define CONFIG_SYS_SCSI_MAX_DEVICE 2
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_ECHO
#define CONFIG_SYS_MAXARGS 8
#define CONFIG_SYS_BOOTM_LEN SZ_64M
(define CONFIG_SYS_MMC_MAX_DEVICE 2 is likely not needed)
First install grub-uboot package (in gentoo: emerge -av grub
with GRUB_PLATFORMS="uboot"
defined )
2nd - install grub to /boot: grub-install /boot
/etc/default/grub:
GRUB_TERMINAL="console serial"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
...
GRUB_CMDLINE_LINUX="root=/dev/sdb1 rootfstype=ext4 rootwait console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200"
create:
grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.5.0-rc1-arm+
Found initrd image: /boot/initramfs-5.5.0-rc1-arm+.img
Found linux image: /boot/kernel-5.5.0-bananapi
Found linux image: /boot/kernel-5.4.0-bananapi
done
in my case it detects kernels and initramfs files placed in /boot
modify /boot/grub/grub.cfg: in my case i had to add devicetree /bpi-r2.dtb
to each menuentry, and some verbose messages, but as i know there is a way to automate it by editing grub templates.
And the last…
I’ve changed 1 of boot entry envs to:
boot19=load mmc 0:1 0x88000000 /grub/arm-uboot/core.img; bootm 0x88000000
...
bootmenu_4=5. Run GRUB.=run boot19
Sorry for necroing the post, but I am playing with new BPi-R2 just now.
Have you found a way to boot uImage with Initrd packaged in the image itself? GRUB apparently doesn’t recognize it as a kernel…so I can’t use grub-mkconfig to populate grub.cfg
GRUB itself loads fine.
root@ap-unimatrix:/boot# ls
bananapi grub uImage-5.15.173-bpi-r2-main
root@ap-unimatrix:/boot# ll
total 48993
drwxr-xr-x 4 root root 16384 Jan 1 1970 ./
drwxr-xr-x 18 root root 21 Dec 12 20:44 ../
drwxr-xr-x 3 root root 4096 Jun 29 16:39 bananapi/
drwxr-xr-x 5 root root 4096 Dec 12 20:45 grub/
-rwxr-xr-x 1 root root 50131833 Dec 12 16:11 uImage-5.15.173-bpi-r2-main*
root@ap-unimatrix:/boot# grub-mkconfig -o /boot/grub/grub.cfg
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Warning: didn't find any valid initrd or kernel.
Warning: didn't find any valid initrd or kernel.
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
done
root@ap-unimatrix:/boot#
uImage is uboot image…grup afaik only supports image.gz (should be same as vmlinuz). Note that you need to configure dtb additionally
Regarding initrd this should be also in Image.gz when configured via kernel config option
OK, back to building then. Should be relatively easy to change the format. so far, GRUB works fine. But I will have to produce new image+ramdisk.
Having GRUB is important, because then I’ll be able to use ZFS snapshot feature to its maximum.
Thanks.
uImage is built by concatenating image.gz +dtb and adding uboot header in build.sh. you do not need to rebuild it,just use other file (in arch/arm afaik)
Makes sense. Thank you. I already have initramfs image too…
Found it. zImage should be the file I want. technically it is vmlinuz.
But apparently I still do have wrong zImage:
error: invalid zImage.
Will deal with it over night. As for menu configuration (grub.cfg), I do have this:
menuentry 'Ubuntu 24.04.1 LTS' --class ubuntu --class gnu-linux --class gnu --class os ${menuentry_id_option} 'gnulinux-rpool/ROOT/ubuntu_h1wz1w-5.15.173-bpi-r2-main' {
recordfail
load_video
gfxmode ${linux_gfx_mode}
insmod gzio
if [ "${grub_platform}" = xen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod fat
search --no-floppy --fs-uuid --set=root 49DC-AF1E
devicetree /bananapi/bpi-r2/linux/dtb/bpi-r2.dtb
linux "/vmlinuz-5.15.173-bpi-r2-main" root=ZFS="rpool/ROOT/ubuntu_h1wz1w" ro rootwait console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200 vmalloc=768M debug=0 initcall_debug=0 drm.debug=0 ipv6.disable=1 video=HDMI-A-1:1280x1024D fsck.mode=force fsck.repair=yes init_on_alloc=0 panic=30
initrd "/initrd.img-5.15.173-bpi-r2-main"
}
submenu 'Advanced options for Ubuntu 24.04.1 LTS' ${menuentry_id_option} 'gnulinux-advanced-rpool/ROOT/ubuntu_h1wz1w' {
menuentry 'Ubuntu 24.04.1 LTS, with Linux 5.15.173-bpi-r2-main' --class ubuntu --class gnu-linux --class gnu --class os ${menuentry_id_option} 'gnulinux-rpool/ROOT/ubuntu_h1wz1w-5.15.173-bpi-r2-main' {
recordfail
load_video
gfxmode ${linux_gfx_mode}
insmod gzio
if [ "${grub_platform}" = xen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod fat
search --no-floppy --fs-uuid --set=root 49DC-AF1E
devicetree /bananapi/bpi-r2/linux/dtb/bpi-r2.dtb
echo Loading Linux 5.15.173-bpi-r2-main ...
linux "/vmlinuz-5.15.173-bpi-r2-main" root=ZFS="rpool/ROOT/ubuntu_h1wz1w" ro rootwait console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200 vmalloc=768M debug=0 initcall_debug=0 drm.debug=0 ipv6.disable=1 video=HDMI-A-1:1280x1024D fsck.mode=force fsck.repair=yes init_on_alloc=0 panic=30
echo 'Loading initial ramdisk ...'
initrd "/initrd.img-5.15.173-bpi-r2-main"
}
}
GRUB loads, but every second load, it crashes and system reboots. So you reboot the machine, load GRUB, it crashes, reboots, loads GRUB, and then it works (apart from having incorrect image format for now).
Update: it looks like GRUB refuses to work with zImage format. It requires bzImage. Removing the initramfs from kernel slimmed it back to ~9MB. Hence:
make bzImage
Also, I noticed that I can’t stay in GRUB for too long, otherwise the system will reset. Probably some kind of watchdog (found this mailing list, will test).
As for GRUB refusing to boot my kernel, the error is the same:
error: invalid zImage
I am not certain on why, I made certain that zImage file found in arch/arm/boot/zImage is what I want, and I’ve put it to /boot/vmlinuz-5.15.173-bpi-r2-main
grub-mkconfig -o /boot/grub/grub.cfg
Finds the kernel as well as initrd, and adds them to GRUB menu. but for some reason, the image is not considered the right one.
Update: anyway, uBoot calls me a boss now too. Resolved. At least when it comes to the annoying timeout from watchdog. GRUB now loads and the board isn’t self-rebooting after ~15s. I updated my uEnv.txt (I am preferring the one built-in to uBoot, but be my guest):
scriptaddr=0x83000000
bpi=bananapi
board=bpi-r2
service=linux
device=mmc
partition=1:1
partition-sd=1:1
partition-mmc=0:1
bootenv=uEnv.txt
kernel=uImage-5.15.173-bpi-r2-main
loadaddr=0x80200000
#default bootargs will be overidden by buildargs
bootargs=console=ttyS0,115200 root=/dev/mmcblk1p2 rw rootwait ip=dhcp
console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200
root=/dev/mmcblk1p2 rootfstype=ext4 rootwait
root-mmc=/dev/mmcblk1p2 rootfstype=ext4 rootwait
root-sd=/dev/mmcblk0p2 rootfstype=ext4 rootwait
root-zfs=ZFS=rpool/ROOT/ubuntu_h1wz1w
root-grub=/dev/mmcblk1p1
root-nfs=/dev/nfs
bootfile=/boot/uImage-5.15.173-bpi-r2-main
ubootfile=/boot/u-boot.bin
#Netboot
ipaddr=10.43.17.85
netmask=255.255.255.248
serverip=10.43.16.139
#NFS
nfsip=10.43.16.139
nfsrfs=/opt/nfs/bpi-r2/ap-unimatrix
setnfsargs=setenv netbootargs "board=${board} ${console} ip=${ipaddr}:${serverip}:${serverip}:${netmask}::wan::${serverip}:10.43.16.1 root=${root-nfs} rw nfsroot=${serverip}:${nfsrfs} ${bootopts} ${graphic}";
bootnfs=run setnfsargs newboot-nfs
netbootargs=board=${board} ${console} ip=${ipaddr}:${serverip}:${serverip}:${netmask}::wan::${serverip}:10.43.16.1 root=${root-nfs} rw nfsroot=${serverip}:${nfsrfs},nfsvers=3,tcp nfsrootdebug ${bootopts} ${graphic}
bootopts=vmalloc=768M debug=0 initcall_debug=0 ipv6.disable=1 fsck.mode=force fsck.repair=yes init_on_alloc=0
graphic=video=HDMI-A-1:1280x1024D console=tty1 fbcon=map:0 drm.debug=0
buildargs=setenv bootargs "board=${board} ${console} root=${root} ${bootopts} ${graphic}"
buildargs-mmc=setenv bootargs "board=${board} ${console} root=${root-mmc} ${bootopts} ${graphic}"
buildargs-sd=setenv bootargs "board=${board} ${console} root=${root-sd} ${bootopts} ${graphic}"
buildargs-zfs=setenv bootargs "board=${board} ${console} root=${root-zfs} ${bootopts} ${graphic}"
buildargs-grub=setenv bootargs "board=${board} ${console} root=${root-grub} ${bootopts} ${graphic}"
buildargs-nfs=setenv bootargs "board=${board} ${console} ip=${ipaddr}:${serverip}:${serverip}:${netmask}::wan::${serverip}:10.43.16.1 root=${root-nfs} rw nfsroot=${serverip}:${nfsrfs},nfsvers=3,tcp nfsrootdebug ${bootopts} ${graphic}"
checkenv=test -e ${device} ${partition} ${bpi}/${board}/${service}/${bootenv}
importenv=env import -t ${scriptaddr} ${filesize}
loadbootenv=if fatload ${device} ${partition} ${scriptaddr} ${bpi}/${board}/${service}/${bootenv};then run importenv;else echo "fatload (${bootenv}) failed";fi
resetenv=env default -a;printenv;
checksd=fatinfo ${device} 1:1
selectmmc=if run checksd; then echo Boot from SD ; setenv partition 1:1;else echo Boot from eMMC; setenv partition 0:1 ; fi;
newboot=run buildargs;printenv bootargs;fatload ${device} ${partition} ${loadaddr} ${bpi}/${board}/${service}/${kernel}; bootm
newboot-mmc=run buildargs-mmc;printenv bootargs;fatload ${device} ${partition-mmc} ${loadaddr} ${bpi}/${board}/${service}/${kernel}; bootm
newboot-sd=run buildargs-sd;printenv bootargs;fatload ${device} ${partition-sd} ${loadaddr} ${bpi}/${board}/${service}/${kernel}; bootm
newboot-zfs=run buildargs-zfs;printenv bootargs;fatload ${device} ${partition-mmc} ${loadaddr} ${bpi}/${board}/${service}/${kernel}; bootm
newboot-grub=run buildargs-grub;printenv bootargs;wdt dev watchdog@10007000; wdt stop;fatload ${device} ${partition-mmc} ${loadaddr} /grub/arm-uboot/core.img; bootm
newboot-nfs=run buildargs-nfs;printenv bootargs;fatload ${device} ${partition-mmc} ${loadaddr} ${bpi}/${board}/${service}/${kernel}; bootm
reloadmenu=run selectmmc;if run checkenv; then run loadbootenv; else echo file not found; fi;bootmenu;
lskernel=ls ${device} ${partition} ${bpi}/${board}/${service};
lsdtb=ls ${device} ${partition} ${bpi}/${board}/${service}/dtb
askkernel=askenv kernelinput "enter uImage-name:";
askdtb=askenv dtbinput "enter dtb-name:";
askuboot=askenv ubootinput "enter uboot-name:";
#bootmenu
boot0=run loadbootenv; run importenv; run newboot-grub;
boot1=run loadbootenv; run importenv; run newboot-zfs;
boot2=run loadbootenv; run importenv; run newboot-mmc;
boot3=run loadbootenv; run importenv; run newboot-sd;
boot4=run selectmmc; run loadbootenv; run importenv; run newboot;
boot5=run loadbootenv; run importenv; run newboot-nfs;
bootmenu_default=1
bootmenu_0=1. Boot to GRUB.=run boot0
bootmenu_1=2. Boot from ZFS (SSD).=run boot1
bootmenu_2=3. Boot from EMMC (ext4).=run boot2
bootmenu_3=4. Boot from SD (ext4).=run boot3
bootmenu_4=5. Boot from SD/EMMC (env. Auto-Select).=run boot4
bootmenu_5=6. Boot from NFS.=run boot5
#automatic reload from sd/emmc
bootdelay=0
bootcmd=setenv bootdelay 5; run reloadmenu;
png=ping ${serverip}
#ip=dhcp sets ip on eth0 instead of wan
lstftp=if tftp ${loadaddr} ${serverip}:files.lst;then setexpr listend ${loadaddr} + ${filesize};mw.b ${listend} 00 2;strings ${loadaddr};else echo "tftp download failed";fi
lstftpu=if tftp ${loadaddr} ${serverip}:bootfiles.lst;then setexpr listend ${loadaddr} + ${filesize};mw.b ${listend} 00 2;strings ${loadaddr};else echo "tftp download failed";fi
#md.b ${loadaddr} 60;
ubootaddr=0x81E00000
bootnet=run lstftp;run askkernel;if printenv kernelinput ;then setenv bootfile "${kernelinput}"; fi;printenv; setenv bootargs "${netbootargs} ${console} ${graphic}";if tftp ${loadaddr} ${bootfile};then bootm;fi
ubootnet=run lstftpu;run askuboot;if printenv ubootinput ;then setenv ubootfile "${ubootinput}"; fi; if tftp ${ubootaddr} ${ubootfile};then icache off;dcache off;go ${ubootaddr};fi
#separate fdt+dto
dtaddr=0x83f00000
fdt_high=0xffffffff
loadfdt=fatload ${device} ${partition} ${dtaddr} ${bpi}/${board}/${service}/dtb/${fdt}
loadkernel=echo "loading kernel ${kernel}...";fatload ${device} ${partition} ${loadaddr} ${bpi}/${board}/${service}/${kernel}
loaddto=echo "loaddto:${dto}";fdt addr ${dtaddr};fdt resize 8192; setexpr fdtovaddr ${dtaddr} + F000;fatload ${device} ${partition} ${fdtovaddr} ${bpi}/${board}/${service}/dtb/${dto} && fdt apply ${fdtovaddr}
loaddtolist=for dto in ${dtolist} ; do run loaddto ; done
bootall=if printenv fdt; then run loadfdt; if printenv dtolist;then run loaddtolist;fi; bootm ${loadaddr} - ${dtaddr} ;else bootm; fi
newboot2=run buildargs; printenv bootargs; run loadkernel; run bootall;
#sata/ahci
initsata=pci enum;scsi scan;
partsata=0:1
dirsata=EFI/ubuntu
filesata=test.txt
kernelsata=uImage-5.15.173-bpi-r2-main
loadfilesata=fatload scsi ${partsata} ${scriptaddr} ${dirsata}/${filesata};setexpr listend ${scriptaddr} + ${filesize};mw.b ${listend} 00 2;strings ${scriptaddr};
loadkernelsata=fatload scsi ${partsata} ${loadaddr} ${dirsata}/${kernelsata};bootm
lssata=ls scsi ${partsata} ${$dirsata}
askaddr=askenv addrinput "enter address:";
lsmem=run askaddr;if printenv addrinput;then setenv baseaddr ${addrinput};run listmem; fi
listmem=if printenv baseaddr;then setenv i 0;while test ${i} -lt 10;do setenv j 0;while test ${j} -lt 10;do setenv offset "${i}${j}00";setexpr addr $baseaddr + ${offset};md $addr;setexpr j ${j} + 1; done;setexpr i ${i} + 1;done;fi
I had to rebuild u-boot with CONFIG_CMD_WDT
All Boot options now works. I will focus on GRUB itself, as I still do face the issue with wrong zImage.
GRUB still can’t load properly any kernel. Dunno if as a result of disabling WDT timer, but now it spews u-boot’s error message:
Could not initialize timer (err -11)
This user also uses zImage and got further,but also had the reboot issue
https://dev1galaxy.org/viewtopic.php?id=4449
Maybe your grub misses some compression algorithm?
Btw. See here for the reboot issue: Grub on BPI-R2: kernel starting problem - #6 by DeadMeat
Maybe @deadmeat can tell which kernel binary he used…
Yes, I started with @Deadmeat 's thread to learn from it. For the timer which auto-reboots the host - that is resolved. My problem is that now when I try to load any image from GRUB (which itself works fine now, even its built-in shell), I get that reset timer error…which is basically endless, and I have to reset the board. Looks like it is a consequence of disabling WMT timer.
OP of first link uses EFI, thus grub-efi-arm, but I do use grub-uboot, which is needed to chain to u-Boot through u-Boot API (which is enabled in my u-boot.bin)
According to this post, I may be missing the timer setup. But so far, I haven’t yet checked on how to modify the device tree.
Have you tried with wdt enabled and different load address for grub? deadmeat had same issue with the reboots
Yes. I tried with the same address @Deadmeat used, but that crashes that minikernel GRUB has. So I used the same address I load Linux kernel to, usually. To my understanding, that is the execution address u-Boot execute system kernel from. Putting GRUB there makes sense in order to load it. Maybe that could be the issue? That both GRUB and Kernel may share the same address? That wouldn’t make sense to cause an issue - by execution of the kernel, GRUB memory is being overwritten, as it is no longer needed. So that shouldn’t have an impact. GRUB itself works fine. I am able to enter it’s shell, run commands, etc. It no longer reboots the host. Just trying to boot my vmlinuz ended up in this weird timer error reset loop. As for WDT, I do disable it during GRUB execution, so it doesn’t intervene. That is why I can leave GRUB loaded for an hour without board resetting itself. I only had to build u-Boot with wdtcmd enabled.
For now, I am rebuilding zImage with initrd disabled (I had it enabled, but without initramfs.cpio), to test. As far as I know, zImage comes without initramfs, which is always served separately (ad-hoc built on the host usually). I in the end used the same process to create my initramfs, which I have confirmed to work. So my understanding is, that maybe having that flag enabled in kernel could confuse both GRUB and the kernel itself during boot. I already was able to start the boot, but it was being reset by watchdog (which is now disabled). So I have to backtrack what changes I did since, which may have this weird impact (that timer reset is caused by the fact that GRUB can’t load ‘serial’ driver - it is not present for arm). I have since disabled this declaration, as console could be configured for serial TTY, which also works. I will do another test once my current kernel build is ready (which, being done on the HW itself, takes up to 20 minutes - on my desktop box it is 1 minute, but then I do not rebuild whole tree and have much more horsepower). Sometimes being lazy has it price.
Update: also unsuccessful. That error plagues me…
data abort
pc : [<80201bb4>] lr : [<80201bad>]
sp : 802523a0 ip : 00000000 fp : 00002000
r10: 00000000 r9 : 00076cc0 r8 : ffb85180
r7 : 802523a0 r6 : 00076cc0 r5 : 00000000 r4 : 0000000f
r3 : 88cb089d r2 : 000003fd r1 : 00005ad8 r0 : 88cb6375
Flags: Nzcv IRQs off FIQs off Mode SVC_32 (T)
Code: c302 23e0 b9a3 2e0b (bde3) b887
Resetting CPU ...
resetting ...
Could not initialize timer (err -11)
resetting ...
Could not initialize timer (err -11)
resetting ...
Could not initialize timer (err -11)
resetting ...
Could not initialize timer (err -11)
resetting ...
Could not initialize timer (err -11)
UPDATE2: Changed GRUB load address. Now it tries to load zImage, complain about its wrong format, and then skip back to that reset timer loop. That timer reset loop is just a consequence - basically the kernel execution process dies, and with WMT disabled, it complains about freeze (as far as I can deduce from what I found over the net).
The problem is still zImage format and the reason why it is being wrong.
UPDATE3: I’ve noticed few problems with my setup since last posting here. All resolved, up till the GRUB boot. GRUB boots fine, it also is able to load initramfs, but I still do face bellow error while trying booting:
error: invalid zImage
u-Boot built-in configuration:
scriptaddr=0x83000000
bpi=bananapi
board=bpi-r2
service=linux
device=mmc
partition=1:1
partition-sd=1:1
partition-mmc=0:1
bootenv=uEnv.txt
kernel=uImage-5.15.173-bpi-r2-main
loadaddr=0x80200000
loadaddrgrub=0x89000000
kaddr=0x84000000
rdaddr=0x86000000
#default bootargs will be overidden by buildargs
bootargs=console=ttyS0,115200 root=/dev/mmcblk1p2 rw rootwait ip=dhcp
zfs-param=zfs.zfs_scrub_delay=8 zfs.zfs_scan_strict_mem_lim=1 zfs.zfs_scan_mem_lim_fact=80 zfs.zfs_scan_mem_lim_soft_fact=80 zfs.zfs_vdev_scrub_max_active=1 zfs.zfs_vdev_sync_read_max_active=2 zfs.zfs_top_maxinflight=3 zfs.zvol_threads=3 zfs.zfs_scan_issue_strategy=2 zfs.zfs_arc_max=83886080 zfs.zfs_scan_legacy=1 zfs.zfs_txg_timeout=8 zfs.zfs_prefetch_disable=1
console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200
root=/dev/mmcblk1p2 rootfstype=ext4 rootwait
root-mmc=/dev/mmcblk1p2 rootfstype=ext4 rootwait
root-sd=/dev/mmcblk0p2 rootfstype=ext4 rootwait
root-zfs=ZFS=rpool/ROOT/ubuntu_h1wz1w
root-grub=/dev/mmcblk1p1
root-nfs=/dev/nfs
bootfile=/boot/uImage-5.15.173-bpi-r2-main
ubootfile=/boot/u-boot.bin
#Netboot
ipaddr=10.43.17.85
netmask=255.255.255.248
serverip=10.43.16.139
#NFS
nfsip=10.43.16.139
nfsrfs=/opt/nfs/bpi-r2/ap-unimatrix
setnfsargs=setenv netbootargs "board=${board} ${console} ip=${ipaddr}:${serverip}:${serverip}:${netmask}::wan::${serverip}:10.43.16.1 root=${root-nfs} rw nfsroot=${serverip}:${nfsrfs} ${bootopts} ${graphic}";
bootnfs=run setnfsargs newboot-nfs
bootfile=uImage-5.15.173-bpi-r2-main
ubootfile=u-boot.bin
netbootargs=board=${board} ${console} ip=${ipaddr}:${serverip}:${serverip}:${netmask}::wan::${serverip}:10.43.16.1 root=${root-nfs} rw nfsroot=${serverip}:${nfsrfs},nfsvers=3,tcp nfsrootdebug ${bootopts} ${graphic}
bootopts=vmalloc=512M debug=0 initcall_debug=0 ipv6.disable=1 fsck.mode=force fsck.repair=yes init_on_alloc=0 panic=30 delayacct
graphic=video=HDMI-A-1:1280x1024D console=tty1 fbcon=map:0 drm.debug=0
buildargs=setenv bootargs "board=${board} ${console} root=${root} ${bootopts} ${graphic}"
buildargs-mmc=setenv bootargs "board=${board} ${console} root=${root-mmc} ${bootopts} ${graphic}"
buildargs-sd=setenv bootargs "board=${board} ${console} root=${root-sd} ${bootopts} ${graphic}"
buildargs-zfs=setenv bootargs "board=${board} ${console} root=${root-zfs} ${bootopts} ${graphic} ${zfs-param}"
#buildargs-grub=setenv bootargs "board=${board} ${console} root=${root-grub} ${bootopts} ${graphic}"
buildargs-nfs=setenv bootargs "board=${board} ${console} ip=${ipaddr}:${serverip}:${serverip}:${netmask}::wan::${serverip}:10.43.16.1 root=${root-nfs} rw nfsroot=${serverip}:${nfsrfs},nfsvers=3,tcp nfsrootdebug ${bootopts} ${graphic}"
checkenv=test -e ${device} ${partition} ${bpi}/${board}/${service}/${bootenv}
importenv=env import -t ${scriptaddr} ${filesize}
loadbootenv=if fatload ${device} ${partition} ${scriptaddr} ${bpi}/${board}/${service}/${bootenv};then run importenv;else echo "fatload (${bootenv}) failed";fi
resetenv=env default -a;printenv;
checksd=fatinfo ${device} 1:1
selectmmc=if run checksd; then echo Boot from SD ; setenv partition 1:1;else echo Boot from eMMC; setenv partition 0:1 ; fi;
newboot=run buildargs;printenv bootargs;fatload ${device} ${partition} ${loadaddr} ${bpi}/${board}/${service}/${kernel}; bootm
newboot-mmc=run buildargs-mmc;printenv bootargs;fatload ${device} ${partition-mmc} ${loadaddr} ${bpi}/${board}/${service}/${kernel}; bootm
newboot-sd=run buildargs-sd;printenv bootargs;fatload ${device} ${partition-sd} ${loadaddr} ${bpi}/${board}/${service}/${kernel}; bootm
newboot-zfs=run buildargs-zfs;printenv bootargs;fatload ${device} ${partition-mmc} ${loadaddr} ${bpi}/${board}/${service}/${kernel}; bootm
newboot-grub=wdt dev watchdog@10007000; wdt stop;fatload ${device} ${partition-mmc} ${loadaddrgrub} /grub/arm-uboot/core.img; bootm ${loadaddrgrub}
newboot-nfs=run buildargs-nfs;printenv bootargs;fatload ${device} ${partition-mmc} ${loadaddr} ${bpi}/${board}/${service}/${kernel}; bootm
reloadmenu=run selectmmc;if run checkenv; then run loadbootenv; else echo file not found; fi;bootmenu;
lskernel=ls ${device} ${partition} ${bpi}/${board}/${service};
lsdtb=ls ${device} ${partition} ${bpi}/${board}/${service}/dtb
askkernel=askenv kernelinput "enter uImage-name:";
askdtb=askenv dtbinput "enter dtb-name:";
askuboot=askenv ubootinput "enter uboot-name:";
#bootmenu
boot0=run loadbootenv; run importenv; run newboot-grub;
boot1=run loadbootenv; run importenv; run newboot-zfs;
boot2=run loadbootenv; run importenv; run newboot-mmc;
boot3=run loadbootenv; run importenv; run newboot-sd;
boot4=run selectmmc; run loadbootenv; run importenv; run newboot;
boot5=run loadbootenv; run importenv; run newboot-nfs;
bootmenu_default=1
bootmenu_0=1. Boot to GRUB.=run boot0
bootmenu_1=2. Boot from ZFS (SSD).=run boot1
bootmenu_2=3. Boot from EMMC (ext4).=run boot2
bootmenu_3=4. Boot from SD (ext4).=run boot3
bootmenu_4=5. Boot from SD/EMMC (env. Auto-Select).=run boot4
bootmenu_5=6. Boot from NFS.=run boot5
#automatic reload from sd/emmc
bootdelay=0
bootcmd=setenv bootdelay 5; run reloadmenu;
png=ping ${serverip}
#ip=dhcp sets ip on eth0 instead of wan
lstftp=if tftp ${loadaddr} ${serverip}:files.lst;then setexpr listend ${loadaddr} + ${filesize};mw.b ${listend} 00 2;strings ${loadaddr};else echo "tftp download failed";fi
lstftpu=if tftp ${loadaddr} ${serverip}:bootfiles.lst;then setexpr listend ${loadaddr} + ${filesize};mw.b ${listend} 00 2;strings ${loadaddr};else echo "tftp download failed";fi
#md.b ${loadaddr} 60;
ubootaddr=0x81E00000
bootnet=run lstftp;run askkernel;if printenv kernelinput ;then setenv bootfile "${kernelinput}"; fi;printenv; setenv bootargs "${netbootargs} ${console} ${graphic}";if tftp ${loadaddr} ${bootfile};then bootm;fi
ubootnet=run lstftpu;run askuboot;if printenv ubootinput ;then setenv ubootfile "${ubootinput}"; fi; if tftp ${ubootaddr} ${ubootfile};then icache off;dcache off;go ${ubootaddr};fi
#separate fdt+dto
dtaddr=0x83f00000
fdt_high=0xffffffff
loadfdt=fatload ${device} ${partition} ${dtaddr} ${bpi}/${board}/${service}/dtb/${fdt}
loadkernel=echo "loading kernel ${kernel}...";fatload ${device} ${partition} ${loadaddr} ${bpi}/${board}/${service}/${kernel}
loaddto=echo "loaddto:${dto}";fdt addr ${dtaddr};fdt resize 8192; setexpr fdtovaddr ${dtaddr} + F000;fatload ${device} ${partition} ${fdtovaddr} ${bpi}/${board}/${service}/dtb/${dto} && fdt apply ${fdtovaddr}
loaddtolist=for dto in ${dtolist} ; do run loaddto ; done
bootall=if printenv fdt; then run loadfdt; if printenv dtolist;then run loaddtolist;fi; bootm ${loadaddr} - ${dtaddr} ;else bootm; fi
newboot2=run buildargs; printenv bootargs; run loadkernel; run bootall;
#sata/ahci
initsata=pci enum;scsi scan;
partsata=0:1
dirsata=EFI/ubuntu
filesata=test.txt
kernelsata=uImage-5.15.173-bpi-r2-main
loadfilesata=fatload scsi ${partsata} ${scriptaddr} ${dirsata}/${filesata};setexpr listend ${scriptaddr} + ${filesize};mw.b ${listend} 00 2;strings ${scriptaddr};
loadkernelsata=fatload scsi ${partsata} ${loadaddr} ${dirsata}/${kernelsata};bootm
lssata=ls scsi ${partsata} ${$dirsata}
askaddr=askenv addrinput "enter address:";
lsmem=run askaddr;if printenv addrinput;then setenv baseaddr ${addrinput};run listmem; fi
listmem=if printenv baseaddr;then setenv i 0;while test ${i} -lt 10;do setenv j 0;while test ${j} -lt 10;do setenv offset "${i}${j}00";setexpr addr $baseaddr + ${offset};md $addr;setexpr j ${j} + 1; done;setexpr i ${i} + 1;done;fi
uEnv.txt at /boot/bananapi/bpi-r2/linux:
#
## uEnv.txt
#
bpi=bananapi
board=bpi-r2
chip=mt7623n
service=linux
#
kernel=uImage-5.15.173-bpi-r2-main
root=ZFS=rpool/ROOT/ubuntu_h1wz1w
#
kaddr=0x84000000
rdaddr=0x86000000
#
initsata=pci enum;scsi scan
console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200
bootargs=board=${board} console=${console} root=ZFS=rpool/ROOT/ubuntu_h1wz1w service=${service} ${bootopts}
bootopts=vmalloc=512M debug=0 initcall_debug=0 drm.debug=0 ipv6.disable=1 video=HDMI-A-1:1280x1024D fsck.mode=force fsck.repair=yes init_on_alloc=0 panic=30 delayacct zfs.zfs_scrub_delay=8 zfs.zfs_scan_strict_mem_lim=1 zfs.zfs_scan_mem_lim_fact=80 zfs.zfs_scan_mem_lim_soft_fact=80 zfs.zfs_vdev_scrub_max_active=1 zfs.zfs_vdev_sync_read_max_active=2 zfs.zfs_top_maxinflight=3 zfs.zvol_threads=3 zfs.zfs_scan_issue_strategy=2 zfs.zfs_arc_max=83886080 zfs.zfs_scan_legacy=1 zfs.zfs_txg_timeout=8 zfs.zfs_prefetch_disable=1
ahello=echo Banana Pi ${board} chip: $chip Service: $service
aboot=if fatload $device $partition $rdaddr ${bpi}/berryboot.img; then bootm $kaddr $rdaddr ; else bootm $kaddr; fi
aload_kernel=fatload $device $partition $kaddr ${bpi}/${board}/${service}/${kernel}
uenvcmd=run ahello abootargs aload_kernel aboot
## END
Boot through u-boot works fine. Both u-Boot and GRUB rebuilt from recent git. GRUB itself boots fine too. But upon trying to use it to boot the kernel, I do see the error I mentioned above.
root@ap-unimatrix:~# ls /boot/
bananapi config-5.15.173-bpi-r2-main grub initrd.img-5.15.173-bpi-r2-main vmlinuz-5.15.173-bpi-r2-main
root@ap-unimatrix:~# cat /boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
if [ "${initrdfail}" = 2 ]; then
set initrdfail=
elif [ "${initrdfail}" = 1 ]; then
set next_entry="${prev_entry}"
set prev_entry=
save_env prev_entry
if [ "${next_entry}" ]; then
set initrdfail=2
fi
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="0"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function initrdfail {
if [ -n "${have_grubenv}" ]; then if [ -n "${partuuid}" ]; then
if [ -z "${initrdfail}" ]; then
set initrdfail=1
if [ -n "${boot_once}" ]; then
set prev_entry="${default}"
save_env prev_entry
fi
fi
save_env initrdfail
fi; fi
}
function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
terminal_input console serial
terminal_output console serial
if [ "${recordfail}" = 1 ] ; then
set timeout=30
else
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=10
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=10
fi
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/10_linux ###
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/10_linux_zfs ###
function gfxmode {
set gfxpayload="${1}"
if [ "${1}" = "keep" ]; then
set vt_handoff=vt.handoff=1
else
set vt_handoff=
fi
}
if [ "${recordfail}" != 1 ]; then
if [ -e ${prefix}/gfxblacklist.txt ]; then
if hwmatch ${prefix}/gfxblacklist.txt 3; then
if [ ${match} = 0 ]; then
set linux_gfx_mode=keep
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=keep
fi
else
set linux_gfx_mode=text
fi
export linux_gfx_mode
function zsyshistorymenu {
# $1: root dataset (eg rpool/ROOT/ubuntu_2zhm07@autozsys_k56fr6)
# $2: boot device id (eg 411f29ce1557bfed)
# $3: initrd (eg /BOOT/ubuntu_2zhm07@autozsys_k56fr6/initrd.img-5.4.0-21-generic)
# $4: kernel (eg /BOOT/ubuntu_2zhm07@autozsys_k56fr6/vmlinuz-5.4.0-21-generic)
# $5: kernel_version (eg 5.4.0-21-generic)
set root_dataset="${1}"
set boot_device="${2}"
set initrd="${3}"
set kernel="${4}"
set kversion="${5}"
menuentry 'Revert system only' --class ubuntu --class gnu-linux --class gnu --class os ${menuentry_id_option} 'gnulinux-${root_dataset}-${kversion}' {
recordfail
load_video
gfxmode ${linux_gfx_mode}
insmod gzio
devicetree /bananapi/bpi-r2/linux/dtb/bpi-r2.dtb
if [ "${grub_platform}" = xen ]; then insmod xzio; insmod lzopio; fi
if [ ${boot_device} = /dev/mmcblk1p1 ]; then
insmod part_msdos
insmod fat
search --no-floppy --fs-uuid --set=root 49DC-AF1E
fi
linux "${kernel}" root=ZFS="${root_dataset}" ro rootwait console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200 vmalloc=512M debug=0 initcall_debug=0 drm.debug=0 ipv6.disable=1 video=HDMI-A-1:1280x1024D fsck.mode=force fsck.repair=yes init_on_alloc=0 panic=30 zfs.zfs_scrub_delay=8 zfs.zfs_scan_strict_mem_lim=1 zfs.zfs_scan_mem_lim_fact=80 zfs.zfs_scan_mem_lim_soft_fact=80 zfs.zfs_vdev_scrub_max_active=1 zfs.zfs_vdev_sync_read_max_active=2 zfs.zfs_top_maxinflight=3 zfs.zvol_threads=3 zfs.zfs_scan_issue_strategy=2 zfs.zfs_arc_max=83886080 zfs.zfs_scan_legacy=1 zfs.zfs_txg_timeout=8 zfs.zfs_prefetch_disable=1
initrd "${initrd}"
}
menuentry 'Revert system and user data' --class ubuntu --class gnu-linux --class gnu --class os ${menuentry_id_option} 'gnulinux-${root_dataset}-${kversion}' {
recordfail
load_video
gfxmode ${linux_gfx_mode}
insmod gzio
devicetree /bananapi/bpi-r2/linux/dtb/bpi-r2.dtb
if [ "${grub_platform}" = xen ]; then insmod xzio; insmod lzopio; fi
if [ ${boot_device} = /dev/mmcblk1p1 ]; then
insmod part_msdos
insmod fat
search --no-floppy --fs-uuid --set=root 49DC-AF1E
fi
linux "${kernel}" root=ZFS="${root_dataset}" ro rootwait console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200 vmalloc=512M debug=0 initcall_debug=0 drm.debug=0 ipv6.disable=1 video=HDMI-A-1:1280x1024D fsck.mode=force fsck.repair=yes init_on_alloc=0 panic=30 zfs.zfs_scrub_delay=8 zfs.zfs_scan_strict_mem_lim=1 zfs.zfs_scan_mem_lim_fact=80 zfs.zfs_scan_mem_lim_soft_fact=80 zfs.zfs_vdev_scrub_max_active=1 zfs.zfs_vdev_sync_read_max_active=2 zfs.zfs_top_maxinflight=3 zfs.zvol_threads=3 zfs.zfs_scan_issue_strategy=2 zfs.zfs_arc_max=83886080 zfs.zfs_scan_legacy=1 zfs.zfs_txg_timeout=8 zfs.zfs_prefetch_disable=1 zsys-revert=userdata
initrd "${initrd}"
}
menuentry 'Revert system only (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os ${menuentry_id_option} 'gnulinux-${root_dataset}-${kversion}' {
recordfail
load_video
insmod gzio
devicetree /bananapi/bpi-r2/linux/dtb/bpi-r2.dtb
if [ "${grub_platform}" = xen ]; then insmod xzio; insmod lzopio; fi
if [ ${boot_device} = /dev/mmcblk1p1 ]; then
insmod part_msdos
insmod fat
search --no-floppy --fs-uuid --set=root 49DC-AF1E
fi
echo Loading Linux ${kversion} ...
linux "${kernel}" root=ZFS="${root_dataset}" ro single nomodeset rootwait console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200 vmalloc=512M debug=0 initcall_debug=0 drm.debug=0 ipv6.disable=1 video=HDMI-A-1:1280x1024D fsck.mode=force fsck.repair=yes init_on_alloc=0 panic=30 zfs.zfs_scrub_delay=8 zfs.zfs_scan_strict_mem_lim=1 zfs.zfs_scan_mem_lim_fact=80 zfs.zfs_scan_mem_lim_soft_fact=80 zfs.zfs_vdev_scrub_max_active=1 zfs.zfs_vdev_sync_read_max_active=2 zfs.zfs_top_maxinflight=3 zfs.zvol_threads=3 zfs.zfs_scan_issue_strategy=2 zfs.zfs_arc_max=83886080 zfs.zfs_scan_legacy=1 zfs.zfs_txg_timeout=8 zfs.zfs_prefetch_disable=1
echo 'Loading initial ramdisk ...'
initrd "${initrd}"
}
menuentry 'Revert system and user data (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os ${menuentry_id_option} 'gnulinux-${root_dataset}-${kversion}' {
recordfail
load_video
insmod gzio
devicetree /bananapi/bpi-r2/linux/dtb/bpi-r2.dtb
if [ "${grub_platform}" = xen ]; then insmod xzio; insmod lzopio; fi
if [ ${boot_device} = /dev/mmcblk1p1 ]; then
insmod part_msdos
insmod fat
search --no-floppy --fs-uuid --set=root 49DC-AF1E
fi
echo Loading Linux ${kversion} ...
linux "${kernel}" root=ZFS="${root_dataset}" ro single nomodeset rootwait console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200 vmalloc=512M debug=0 initcall_debug=0 drm.debug=0 ipv6.disable=1 video=HDMI-A-1:1280x1024D fsck.mode=force fsck.repair=yes init_on_alloc=0 panic=30 zfs.zfs_scrub_delay=8 zfs.zfs_scan_strict_mem_lim=1 zfs.zfs_scan_mem_lim_fact=80 zfs.zfs_scan_mem_lim_soft_fact=80 zfs.zfs_vdev_scrub_max_active=1 zfs.zfs_vdev_sync_read_max_active=2 zfs.zfs_top_maxinflight=3 zfs.zvol_threads=3 zfs.zfs_scan_issue_strategy=2 zfs.zfs_arc_max=83886080 zfs.zfs_scan_legacy=1 zfs.zfs_txg_timeout=8 zfs.zfs_prefetch_disable=1 zsys-revert=userdata
echo 'Loading initial ramdisk ...'
initrd "${initrd}"
}
}
menuentry 'Ubuntu 24.04.1 LTS' --class ubuntu --class gnu-linux --class gnu --class os ${menuentry_id_option} 'gnulinux-rpool/ROOT/ubuntu_h1wz1w-5.15.173-bpi-r2-main' {
recordfail
load_video
gfxmode ${linux_gfx_mode}
insmod gzio
devicetree /bananapi/bpi-r2/linux/dtb/bpi-r2.dtb
if [ "${grub_platform}" = xen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod fat
search --no-floppy --fs-uuid --set=root 49DC-AF1E
linux "/vmlinuz-5.15.173-bpi-r2-main" root=ZFS="rpool/ROOT/ubuntu_h1wz1w" ro rootwait console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200 vmalloc=512M debug=0 initcall_debug=0 drm.debug=0 ipv6.disable=1 video=HDMI-A-1:1280x1024D fsck.mode=force fsck.repair=yes init_on_alloc=0 panic=30 zfs.zfs_scrub_delay=8 zfs.zfs_scan_strict_mem_lim=1 zfs.zfs_scan_mem_lim_fact=80 zfs.zfs_scan_mem_lim_soft_fact=80 zfs.zfs_vdev_scrub_max_active=1 zfs.zfs_vdev_sync_read_max_active=2 zfs.zfs_top_maxinflight=3 zfs.zvol_threads=3 zfs.zfs_scan_issue_strategy=2 zfs.zfs_arc_max=83886080 zfs.zfs_scan_legacy=1 zfs.zfs_txg_timeout=8 zfs.zfs_prefetch_disable=1
initrd "/initrd.img-5.15.173-bpi-r2-main"
}
submenu 'Advanced options for Ubuntu 24.04.1 LTS' ${menuentry_id_option} 'gnulinux-advanced-rpool/ROOT/ubuntu_h1wz1w' {
menuentry 'Ubuntu 24.04.1 LTS, with Linux 5.15.173-bpi-r2-main' --class ubuntu --class gnu-linux --class gnu --class os ${menuentry_id_option} 'gnulinux-rpool/ROOT/ubuntu_h1wz1w-5.15.173-bpi-r2-main' {
recordfail
load_video
gfxmode ${linux_gfx_mode}
insmod gzio
devicetree /bananapi/bpi-r2/linux/dtb/bpi-r2.dtb
if [ "${grub_platform}" = xen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod fat
search --no-floppy --fs-uuid --set=root 49DC-AF1E
echo Loading Linux 5.15.173-bpi-r2-main ...
linux "/vmlinuz-5.15.173-bpi-r2-main" root=ZFS="rpool/ROOT/ubuntu_h1wz1w" ro rootwait console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200 vmalloc=512M debug=0 initcall_debug=0 drm.debug=0 ipv6.disable=1 video=HDMI-A-1:1280x1024D fsck.mode=force fsck.repair=yes init_on_alloc=0 panic=30 zfs.zfs_scrub_delay=8 zfs.zfs_scan_strict_mem_lim=1 zfs.zfs_scan_mem_lim_fact=80 zfs.zfs_scan_mem_lim_soft_fact=80 zfs.zfs_vdev_scrub_max_active=1 zfs.zfs_vdev_sync_read_max_active=2 zfs.zfs_top_maxinflight=3 zfs.zvol_threads=3 zfs.zfs_scan_issue_strategy=2 zfs.zfs_arc_max=83886080 zfs.zfs_scan_legacy=1 zfs.zfs_txg_timeout=8 zfs.zfs_prefetch_disable=1
echo 'Loading initial ramdisk ...'
initrd "/initrd.img-5.15.173-bpi-r2-main"
}
menuentry 'Ubuntu 24.04.1 LTS, with Linux 5.15.173-bpi-r2-main (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os ${menuentry_id_option} 'gnulinux-rpool/ROOT/ubuntu_h1wz1w-5.15.173-bpi-r2-main' {
recordfail
load_video
insmod gzio
devicetree /bananapi/bpi-r2/linux/dtb/bpi-r2.dtb
if [ "${grub_platform}" = xen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod fat
search --no-floppy --fs-uuid --set=root 49DC-AF1E
echo Loading Linux 5.15.173-bpi-r2-main ...
linux "/vmlinuz-5.15.173-bpi-r2-main" root=ZFS="rpool/ROOT/ubuntu_h1wz1w" ro single nomodeset rootwait console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200 vmalloc=512M debug=0 initcall_debug=0 drm.debug=0 ipv6.disable=1 video=HDMI-A-1:1280x1024D fsck.mode=force fsck.repair=yes init_on_alloc=0 panic=30 zfs.zfs_scrub_delay=8 zfs.zfs_scan_strict_mem_lim=1 zfs.zfs_scan_mem_lim_fact=80 zfs.zfs_scan_mem_lim_soft_fact=80 zfs.zfs_vdev_scrub_max_active=1 zfs.zfs_vdev_sync_read_max_active=2 zfs.zfs_top_maxinflight=3 zfs.zvol_threads=3 zfs.zfs_scan_issue_strategy=2 zfs.zfs_arc_max=83886080 zfs.zfs_scan_legacy=1 zfs.zfs_txg_timeout=8 zfs.zfs_prefetch_disable=1
echo 'Loading initial ramdisk ...'
initrd "/initrd.img-5.15.173-bpi-r2-main"
}
}
### END /etc/grub.d/10_linux_zfs ###
### BEGIN /etc/grub.d/25_bli ###
if [ "$grub_platform" = "efi" ]; then
insmod bli
fi
### END /etc/grub.d/25_bli ###
### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Ubuntu 24.04.1 LTS (24.04) (on /dev/mmcblk1p2)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-d079016c-d948-4fd0-bde3-37002cfb56c9' {
insmod part_msdos
insmod fat
search --no-floppy --fs-uuid --set=root 49DC-AF1E
linux /vmlinuz-5.15.173-bpi-r2-main root=/dev/mmcblk1p2
initrd /initrd.img-5.15.173-bpi-r2-main
}
submenu 'Advanced options for Ubuntu 24.04.1 LTS (24.04) (on /dev/mmcblk1p2)' $menuentry_id_option 'osprober-gnulinux-advanced-d079016c-d948-4fd0-bde3-37002cfb56c9' {
menuentry 'Ubuntu 24.04.1 LTS (24.04) (on /dev/mmcblk1p2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-5.15.173-bpi-r2-main--d079016c-d948-4fd0-bde3-37002cfb56c9' {
insmod part_msdos
insmod fat
search --no-floppy --fs-uuid --set=root 49DC-AF1E
linux /vmlinuz-5.15.173-bpi-r2-main root=/dev/mmcblk1p2
initrd /initrd.img-5.15.173-bpi-r2-main
}
}
set timeout_style=menu
if [ "${timeout}" = 0 ]; then
set timeout=10
fi
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg
fi
### END /etc/grub.d/41_custom ###
root@ap-unimatrix:~#
root@ap-unimatrix:~# file /boot/vmlinuz-5.15.173-bpi-r2-main
/boot/vmlinuz-5.15.173-bpi-r2-main: Linux kernel ARM boot executable zImage (little-endian)
root@ap-unimatrix:~#
root@ap-unimatrix:~# binwalk /boot/vmlinuz-5.15.173-bpi-r2-main
DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
0 0x0 Linux kernel ARM boot executable zImage (little-endian)
30792 0x7848 gzip compressed data, maximum compression, from Unix, last modified: 1970-01-01 00:00:00 (null date)
root@ap-unimatrix:~#
I suspect the problem is in loading addresses of either GRUB, kernel, or both.
Any ideas?
I want to use GRUB, because it allows me to use ZFS snapshot feature before booting the OS. u-Boot doesn’t have such capability.
UPDATE4: So, it looks like it is tight to memory addresses. In GRUB source, I’ve found this: grub-core/loader/arm/linux.c
if ((grub_size_t) size > sizeof (*lh) &&
lh->magic == GRUB_LINUX_ARM_MAGIC_SIGNATURE)
;
else if (size > 0x8000 && *(grub_uint32_t *) (linux_addr) == 0xea000006
&& machine_type == GRUB_ARM_MACHINE_TYPE_RASPBERRY_PI)
grub_memmove ((void *) linux_addr, (void *) (linux_addr + 0x8000),
size - 0x8000);
else
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("invalid zImage"));
linux_size = size;
return GRUB_ERR_NONE;
}
It looks like examples where GRUB works are all from RPi machines. Since the kernel load address is different on BPi-R2, I may as well patch the GRUB source, to properly recognize BPi-R2 kernel.
Hey Frank, hey @Virnik,
A blast from the past topic
I’ve struggled with GRUB on an R2 some time ago going to read the new posts, may be would be able to recall anything useful
I’ve been using a gentoo linux all the time since i figurte out how to boot it. So i my case i’ve created a ebuild (sort of source dpkg i suppose) to pickup the source from Frank’s or mine git repo, and always built the kernel from the target OS (x64 cross compile also worked) so i always had a native to my distro kernel+initramf+modules set and always used standard OS tools to install a new kernel.
Hope it answered the question.
Also i always used a standard dtb with an additional grub config line:
@Virnik feel free to ask a questions, i’ll try to answer best i can