Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A20 => Topic started by: Vioteo on August 30, 2023, 05:18:08 PM

Title: Build and write uboot
Post by: Vioteo on August 30, 2023, 05:18:08 PM
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.
 
Title: Re: Build and write uboot
Post by: LubOlimex on August 31, 2023, 09:00:33 AM
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.
Title: Re: Build and write uboot
Post by: Vioteo on August 31, 2023, 11:52:39 AM
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.
Title: Re: Build and write uboot
Post by: LubOlimex on August 31, 2023, 01:19:52 PM
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
Title: Re: Build and write uboot
Post by: Vioteo on August 31, 2023, 02:51:11 PM
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?
Title: Re: Build and write uboot
Post by: LubOlimex on September 01, 2023, 10:25:53 AM
Each embedded Linux system consists of u-boot, kernel, and file system.

Building kernel is different from building u-boot.
Title: Re: Build and write uboot
Post by: Vioteo on September 01, 2023, 11:27:18 AM
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.
Title: Re: Build and write uboot
Post by: Vioteo on September 01, 2023, 05:23:10 PM
Can you please write here an actual step by step guide or at least tell me where exactly to look?
Title: Re: Build and write uboot
Post by: JohnS on September 01, 2023, 09:36:36 PM
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
Title: Re: Build and write uboot
Post by: Vioteo on September 05, 2023, 04:56:01 PM
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
Title: Re: Build and write uboot
Post by: mavstuff on December 15, 2023, 07:56:24 PM
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.
Title: Re: Build and write uboot
Post by: LubOlimex on December 18, 2023, 08:21:35 AM
@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
Title: Re: Build and write uboot
Post by: mavstuff on December 18, 2023, 11:35:19 AM
@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
Title: Re: Build and write uboot
Post by: LubOlimex on December 18, 2023, 01:36:57 PM
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.
Title: Re: Build and write uboot
Post by: mavstuff on December 19, 2023, 03:23:07 PM
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 (https://github.com/mavstuff/u-boot-olx-a20-mod/commit/57aee84dc5c34cc6e60877afba20ce5b3fcf15a6) 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 (https://linux-sunxi.org/LCD).