User Tools

Site Tools



en:bpi-r2pro:barebox

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
en:bpi-r2pro:barebox [2022/04/12 21:44] – [testing barebox] franken:bpi-r2pro:barebox [2023/06/08 17:06] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Barebox ======
 +
 +alternative to uboot as bootloader, supports ethernet/tftp-boot (wan-port only due to missing switch driver)
 +
 +Doc: https://www.barebox.org/doc/latest/
 +
 +Git: https://git.pengutronix.de/cgit/barebox/
 +
 +Bootlin: https://elixir.bootlin.com/barebox/latest/source
 +
 +Mailinglist archive: https://lore.barebox.org/barebox/
 +===== build =====
 +
 +  sudo apt install lzop
 +    
 +  cp rk3568_bl31_v1.24.elf firmware/rk3568-bl31.bin
 +  cp rk3568_ddr_1560MHz_v1.11.bin arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin
 +  cp rk3568_ddr_1560MHz_v1.11.bin arch/arm/boards/pine64-quartz64/sdram-init.bin
 +    
 +  ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make rockchip_v8_defconfig
 +  ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make menuconfig
 +  ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make
 +
 +  #flash to sdcard
 +  dd if=barebox-rk3568-bpi-r2pro.img of=/dev/sdx bs=1024 seek=32
 +
 +  #flash to emmc from running system:
 +  dd if=barebox-rk3568-bpi-r2pro.img of=/dev/mmcblk1 bs=1024 seek=32
 +
 +https://github.com/frank-w/barebox-r2pro
 +
 +===== testing barebox =====
 +
 +if barebox is already flashed it can chainload another one to avoid flashing it for testing
 +
 +  bootm /mnt/tftp/barebox-rk3568-bpi-r2pro.img
 +
 +booting the barebox.bin in root failed on my board, but flashimage (images/barebox-rk3568-evb.img) works
 +
 +  ERROR: Unknown OS filetype (try -f)
 +  handler failed with: Invalid argument
 +
 +[[https://www.barebox.org/doc/latest/user/barebox.html#starting-barebox|documentation]] says uboot can load it too (documentation needs to be changed, but patches posted). So i tested it with vendors uboot (2017.09)...
 +
 +barebox can be chainloaded in uboot this way:
 +
 +<code>
 +=> fatload mmc 1:2 ${kernel_addr_r} barebox-dt-2nd.img
 +=> fatload mmc 1:2 ${fdt_addr_r} rk3568-bpi-r2-pro.dtb
 +=> booti ${kernel_addr_r} - ${fdt_addr_r}
 +</code>
 +
 +using  images/barebox-dt-2nd.img and arch/arm/dts/rk3568-bpi-r2-pro.dtb
 +
 +I've noticed that network does not work if barebox is chainloaded. Network works if barebox is flashed.
 +===== booting kernel =====
 +
 +==== bootloader (blspec) ====
 +
 +  boot -m sd.1
 +
 +list all conf files in folder loader/entries on mmcblk0p2. Barebox starts counting partitions from 0, linux from 1
 +
 +example of a conf for this menu
 +
 +<code>
 +# cat /mnt/loader/entries/linux-gz.conf 
 +title           Linux GZip
 +version 5.16
 +options earlycon=uart8250,mmio32,0xfe660000 console=ttyS2,1500000n8
 +linux           /extlinux/Image_5.16.gz
 +devicetree      /extlinux/dtb_5.16
 +initrd          /rootfs.cpio.lz4
 +</code>
 +
 +==== manual ====
 +
 +<code>
 +mount -a
 +ls /mnt/sd.1/extlinux/
 +
 +bootm -o /mnt/sd.1/extlinux/dtb_5.16 /mnt/sd.1/extlinux/Image_5.16.gz
 +
 +global.bootm.oftree=/mnt/sd.1/extlinux/dtb_5.16
 +global.bootm.image=/mnt/sd.1/extlinux/Image_5.16.gz
 +global.bootm.initrd=/mnt/sd.1/rootfs.cpio.lz4
 +global linux.bootargs.rootfs="root=/dev/mmcblk0p3"
 +bootm
 +</code>
 +
 +==== tftp ====
 +
 +Tftp not yet working in v1.0, i have added network changes which are working in linux,but get no traffic on eth1.
 +
 +by default it uses these filenames (defaultenv/defaultenv-2-base/boot/net):
 +
 +  * kernel (${global.user}-linux-${global.hostname}):
 +    * my barebox: none-linux-bpi-r2pro
 +    * upstream: none-linux-rk3568-evb
 +  * fdt (${global.user}-oftree-${global.hostname}):
 +    * my barebox: none-oftree-bpi-r2pro
 +    * upstream: none-oftree-rk3568-evb
 +  * initrd (${global.user}-initramfs-${global.hostname}):
 +    * my barebox: none-initramfs-bpi-r2pro
 +    * upstream: none-initramfs-rk3568-evb
 +
 +booted by default (issue dhcp and uses gateway as tftp-server) or run (here with additional bootargs like earlycon,fbcon).
 +<code>
 +global linux.bootargs.debug="earlycon=uart8250,mmio32,0xfe660000 earlyprintk"
 +#global linux.bootargs.video="video=1920x1080-32"
 +#global linux.bootargs.console="console=tty1 fbcon=map:0 drm.debug=0x7 console=ttyS2,1500000n8"
 +boot net
 +</code>
 +
 +another filenames can be used if defining the bootm-variables with tftp-filesystem (here with different fdt)
 +
 +  imgdir=/mnt/tftp
 +  global.bootm.image=$imgdir/none-linux-bpi-r2pro
 +  global.bootm.oftree=$imgdir/none-oftree-bpi-r2pro-dsa
 +  #global.bootm.initrd=$imgdir/none-initramfs-bpi-r2pro
 +  global linux.bootargs.rootfs="root=/dev/mmcblk0p3"
 +  #echo $global.linux.bootargs.debug
 +  #global.linux.bootargs.debug="earlycon=uart8250,mmio32,0xfe660000 earlyprintk"
 +  #echo $global.linux.bootargs.video
 +  bootm
  
en/bpi-r2pro/barebox.txt · Last modified: 2023/06/08 17:06 by 127.0.0.1