Build armbian with GPT support

I tried:
make_multiboot_dev.sh --device /dev/mmcblk1 --uboot-file Armbian_20.02.7_Rockpi-4b_buster_current_5.4.28_desktop.img
I got:
Warning: the resulting partition is not properly aligned for best performance: 64s % 2048s != 0s
Ignore/Cancel? Ig


-= All OK =-

When I try:
make_multiboot_dev.sh --device /dev/mmcblk1 --boot-size 256 --image-file Armbian_20.02.7_Rockpi-4b_buster_current_5.4.28_desktop.img
I got:
[Error] This filename from unknown OS !

hm … uname -a ?

p.s. while you can rename file to Armbian.img

I am on Manjaro Arm host system but with kpartx installed, I assume that should fulfill the script pre-conditions?
Changing the img to Armbian.img doesn’t fly as well.

I understand that Manjaro-ARM-kde-rockpi4-19.06 is used? … I will try to test on it when there is time

There is Manjaro 20.04 released actually, while I am currently with 20.02, but will switch to 20.04 soon.
Hope your script will be as general as possible (even consider to support MacOS).

Use a different version of u-boot for SPI and you will get a normal launch of any version of Armbian from any media, including USB and NVMe.

Do you have a link reference to a proven working SPI u-boot version other than the one provided by radxa wiki page?

Armbian

https://forum.armbian.com/topic/12162-single-armbian-image-for-rk-aml-aw/?do=findComment&comment=96341

I flashed the spi image from the provided link (replace the spi image and md5 file in default location, comment out debsum check section in /usr/local/sbin/rockpi4b_write_spi_flash.sh), it seems I still cannot start armbian from usb (I have eMMC installed with manjaro, tf card install with ubuntu 18.04 official image, then flashed armbian 4.4 desktop into a tf card and put it into a usb adaptor plugged into lower USB3 port), when I boot the rockpi4b, it still start from internally installed tf card with ubuntu 18.04 system…

I tried the script under ubuntu, but it still cannot boot armbian, what I did:

sudo su
#---- Make GPT and flash uboot
make_multiboot_dev.sh --device /dev/sdb  --uboot-file Armbian_20.02.11_Rockpi-4b_bionic_legacy_4.4.213_desktop.img
#---- Flash 1 OS
make_multiboot_dev.sh --device /dev/sdb  -i Armbian_20.02.11_Rockpi-4b_bionic_legacy_4.4.213_desktop.img

All finished with -=All OK=-, then I put the microSD card into rockpi, it just doesn’t boot. Any ideas?

There may be problems with the name of the fdt file. Here now new version Test image file

make_multiboot_dev.sh -t  -i Armbian_20.02.11_Rockpi-4b_bionic_legacy_4.4.213_desktop.img

if there is no rk3399-rockpi4b.dtb file among those found, then you need to edit the extlinux.conf file
… you can simply rewrite it again with the new version of the script, it already takes into account this change of file names.

make_multiboot_dev.sh -d /dev/sdb  -n 4  -m 5  -i Armbian_20.02.11_Rockpi-4b_bionic_legacy_4.4.213_desktop.img

-n -m part numbers of the boot and root, compare with yours!

I got below output with the new linked script, still cannot boot from the microSD card, script output:

root@rockpi4:/home/rock# ./make_multiboot_dev.sh --device /dev/sda -u Armbian_20.02.11_Rockpi-4b_bionic_legacy_4.4.213_desktop.img
[Warning] —=== All data on device /dev/sda will be deleted !!! ===—
Type Y/y to continue or Ctrl-C to abort.
y
16+0 records in
16+0 records out
16777216 bytes (17 MB, 16 MiB) copied, 0.0558389 s, 300 MB/s
Warning: The resulting partition is not properly aligned for best performance.
32704+0 records in
32704+0 records out
16744448 bytes (17 MB, 16 MiB) copied, 1.93561 s, 8.7 MB/s
-= All OK =-
-= End Of Script =-
root@rockpi4:/home/rock# ./make_multiboot_dev.sh --device /dev/sda -i Armbian_20.02.11_Rockpi-4b_bionic_legacy_4.4.213_desktop.img

Size of image ROOT partition is 3188 MiB
it flash into partition with size 4096 MiB

Type Y/y to continue or Ctrl-C to abort.
y
Work with partitions …
++++++++++++++++++++++++++++++++++++++++++++++++++++
Attention! If the program does not end with the phrase ‘End Of Script’ then manually do ‘umount /tmp/{1…4}’, ‘rmdir /tmp/{1…4}’
and remove partions: /dev/sda4 /dev/sda5
++++++++++++++++++++++++++++++++++++++++++++++++++++
Files are copied, wait …
---------/boot/*Env.txt :
verbosity=1
overlay_prefix=rockchip
rootdev=UUID=b949b043-f2d0-46ad-9616-0820b739a0f4
rootfstype=ext4
---------found RockPi4 fdt files :
/dtb-4.4.213-rockchip64/rockchip/rk3399-rockpi4b.dtb
/dtb-4.4.213-rockchip64/rockchip/rk3399-rock-pi-4.dtb
--------- extlinux.conf :
LABEL Armbian
LINUX /Image
INITRD /uInitrd
FDT /dtb/rockchip/rk3399-rockpi4b.dtb
APPEND root=UUID=25d39b65-af2d-4baa-8958-b628107dc414 rootflags=data=writeback rw console=uart8250,mmio32,0xff1a0000 console=tty0 no_console_suspend consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0
---------- /etc/fstab :
UUID=25d39b65-af2d-4baa-8958-b628107dc414 / ext4 defaults,noatime,nodiratime,commit=600,errors=remount-ro 0 1
tmpfs /tmp tmpfs defaults,nosuid 0 0
UUID=ca700fc3-5901-47bf-af21-26982b68caa4 /boot ext2 defaults 0 0

loop deleted : /dev/loop0
-= All OK =-
-= End Of Script =-

It seems to be Armbian image uboot issue, below command will result in a not bootable microSD:

./make_multiboot_dev.sh --device /dev/sda -u Armbian_20.02.11_Rockpi-4b_bionic_legacy_4.4.213_desktop.img
./make_multiboot_dev.sh --device /dev/sda -i Armbian_20.02.11_Rockpi-4b_bionic_legacy_4.4.213_desktop.img

While radxa stock ubuntu image uboot using below command will result in a bootable armbian microSD:

./make_multiboot_dev.sh --device /dev/sda -u rockpi4b-ubuntu-bionic-minimal-20191127_1942-gpt.img
./make_multiboot_dev.sh --device /dev/sda -i Armbian_20.02.11_Rockpi-4b_bionic_legacy_4.4.213_desktop.img

So it looks I cannot get a uboot to make booting from USB possible (neither modified SPI from @balbes-150, nor writing Armbian image uboot (providing boot from USB support) into microSD using script from @rua1 ), but so far with radxa SPI (with NVME support) uboot + script from @rua1, at least I can boot Armbian from microSD, and the script goes well to get multi boot setup (I tried Armbian + Manjaro) work, and toggling system by using gparted setting boot flag on right boot partition is quite convenient.

I only tested a short time spi uboot and thought that when it is used, the uboot recorded on the microsd does not matter. I was wrong.
To replace uboot no need replale all . To work only with uboot area there are options --backup-uboot, --write-uboot and --zeroing-uboot

 ./make_multiboot_dev.sh --device /dev/sda  -u rockpi4b-ubuntu-bionic-minimal-20191127_1942-gpt.img --write-uboot

and only uboot replaced

Is below command actually creating still MBR partition table by using Armbian image as uboot input?

./make_multiboot_dev.sh --device /dev/sda -u Armbian_20.02.11_Rockpi-4b_bionic_legacy_4.4.213_desktop.img

Or we can say Armbian uboot is not working together with SPI uboot from radxa, we have to use radxa ubuntu uboot to boot Armbian if SPI uboot from radxa is present?

new gpt create … warning is displayed “[Warning] —=== All data on device /dev/sda will be deleted !!! ===—”

You can still test --zeroing-uboot

./make_multiboot_dev.sh --device /dev/sda   --zeroing-uboot

then only will work spi uboot

–zeroing-uboot works with spi uboot for armbian on microSD.
But it is strange radxa Android TV image cannot boot from microSD with spi uboot, even after --zeroing-uboot, it still doesn’t boot.
And so far I cannot find anyway to boot from USB properly.

Android is booted using a version uboot designed for android.

For me it worked only in USB2.0 connectors as far as I remember …I tested armbian and libreelec

If only about USB2 booting then it really just about testing purpose consider the low USB2 speed to run a functioning OS.

@viumden I had same issue with u-boot from Radxa Debian image (rockpi4-debian-stretch-desktop-arm64-20190730_2022-gpt.img.gz).

However newer u-boot provided here worked and was able to boot:
https://dl.radxa.com/rockpi4/images/loader/spi/

Reference: