Build and write uboot

Started by Vioteo, August 30, 2023, 05:18:08 PM

Previous topic - Next topic

Vioteo

Hello, im trying to change logo during and after a few attempts with kernel i concluded that its part of uboot. My board is A20SOM with Debian-minimal version on SDcard. I found some guides how to build u-boot and make a bootable sd card.
https://www.olimex.com/wiki/Build_Bootable_SD_Card_with_Debian
But there is no config for A20-SOM, so im using LIME2 config, im not sure if this is ok, also looks like im building old u-boot version.
Main problem is to write correctly my build to SD card.
I tried this commands
# sudo dd if=/dev/zero of=/dev/sdc bs=1k count=1023 seek=1
# dd if=spl/sunxi-spl.bin of=/dev/sdX bs=1024 seek=8
# dd if=u-boot.bin of=/dev/sdX bs=1024 seek=32
Im not making a partition before this. Result is that board doesnt boot at all
Second attempt is
sudo dd if=/dev/zero of=/dev/sdc bs=1k count=1023 seek=1
sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdc bs=1024 seek=8 conv=notrunc
As a result im reaching bootloader with correct date, but it says that there is no script.bin and other following files.
So im asking for any help with this problems.
 

LubOlimex

Which image exactly are you using as base? Copy paste the full name of the archive here. The guide you linked was made for older sunxi images, and even they use mainline u-boot now so it probably won't work at all on newer images.
Technical support and documentation manager at Olimex

Vioteo

Latest recommended image from a20som page.
http://images.olimex.com/release/a20/
A20-OLinuXino-bullseye-minimal-20230515-130040.img.7z
All guides i found looks outdated.

LubOlimex

Just use the Olimage document here, there are links and build instructions at the bottom:

https://github.com/OLIMEX/OLINUXINO/blob/master/DOCUMENTS/OLIMAGE/Olimage-guide.pdf
Technical support and documentation manager at Olimex

Vioteo

#4
So there are 2 guides.
And there is link in the middle (https://github.com/OLIMEX/u-boot-olinuxino) to u-boot.
Both this guides are downloading kernel sources (https://github.com/OLIMEX/linux-olimex).
Is building kernel(11.2) or dts(11.1) the same to build u-boot?

LubOlimex

Each embedded Linux system consists of u-boot, kernel, and file system.

Building kernel is different from building u-boot.
Technical support and documentation manager at Olimex

Vioteo

#6
Sorry, but then i cant understand which chapter of this document would help me to build and write u-boot. I saw this document before and used it to build kernel, but all i get from this document about uboot is the link to github sources and unable to see how to use it.

Vioteo

Can you please write here an actual step by step guide or at least tell me where exactly to look?

JohnS

At the risk of annoying you, try a web search on
build u-boot a20

The first item https://linux-sunxi.org/U-boot looks suitable.

John

Vioteo

I found this post https://www.olimex.com/forum/index.php?topic=8735.0.
If it would help someone for me worked those commands

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install bison flex swig gcc-arm-linux-gnueabihf
sudo apt-get install python3-dev
sudo apt-get install python3-distutils
git clone https://github.com/OLIMEX/u-boot-olinuxino.git
cd u-boot-olinuxino
make A20-OLinuXino_defconfig
make CROSS_COMPILE=arm-linux-gnueabihf-
dd if=u-boot-sunxi-with-spl.bin of=A20-OLinuXino-bullseye-minimal-20220518-101434.img bs=1024 seek=8 conv=notrunc

Note: A20-OLinuXino-bullseye-minimal-20220518-101434.img is img you must download and put into this folder.
After this i write this image to SD card. And it works. Looks like my problem was using wrong uboot sources

mavstuff

hi!
I am looking for working repo and config for u-boot for A20-SOM-EVB. I want to rebuild from source and make it work with my parallel LCD.

LubOlimex

@mavstuff Start from the info in this document, it has links to sources and also at the end there is explanation on how to rebuild the image:

https://github.com/OLIMEX/OLINUXINO/blob/master/DOCUMENTS/OLIMAGE/Olimage-guide.pdf
Technical support and documentation manager at Olimex

mavstuff

@LubOlimex Thanks for pointing but olimage build script seems to use pre-built u-boot binary and I see no guide to build u-boot from source

LubOlimex

#13
You download the source from here:

https://github.com/OLIMEX/u-boot-olinuxino

Building requires GNU toolchain.

Then type:

export CROSS_COMPILE=arm-linux-gnueabihf-
export ARCH=arm

make clean
make A20-OLinuXino_defconfig
make

A20-OLinuXino_defconfig is the proper defconfig for all Olimex-made A20 boards.
Technical support and documentation manager at Olimex

mavstuff

#14
hi @LubOlimex! Thank you for the information. I was able to successfully build and install u-boot following your recommendations.

From my side, I propose a small patch and config (below) to make generic 5 inch 800x480 parallel interface LCD work:
#CONFIG_VIDEO_LCD_PANEL_OLINUXINO is not set
CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:18,pclk_khz:33000,le:16,ri:209,up:22,lo:22,hs:30,vs:1,sync:3,vmode:0"
CONFIG_VIDEO_LCD_DCLK_PHASE=0
CONFIG_VIDEO_LCD_POWER="PH8"
CONFIG_VIDEO_LCD_BL_EN="PH7"
CONFIG_VIDEO_LCD_BL_PWM="PB2"

LCD mode taken from here.