Jump to content

Amlogic Mainline U-boot Compilation


AndrewDB

Recommended Posts

Hello Le Potato hackers, I have a small favor to ask of you: I just wrote a Howto cross-compile mainline u-boot for your "Le Potato"

(actually it's supposed to be for the La Frite when this starts shipping, but right now it's for the Le Potato)

 

Here: http://wiki.loverpi.com/faq:sbc:libre-aml-s805x-howto-compile-u-boot

 

Since I don't have a Le Potato I cannot verify that my HOWTO really produces a working u-boot, so I would be very grateful if any one of you could spend around 20 minutes of their (very valuable, without any doubt) time to follow the step-by-step instructions and check it out? 

 

What you need:

  1. An x86_64 PC/Laptop/Workstation running Linux, preferably Ubuntu 18.04 but anything else should be OK, as long as it's recent.
  2. A Le Potato.
  3. An SD-card
  4. A USB-to-serial converter to check that your you-just-compiled-it-yourself u-boot WORKS! :thumbup:

Missing instructions on how to copy u-boot.bin.sd.bin to your SD card, assuming your PC/laptop sees it as mmcblk0:

dd if=u-boot.bin.sd.bin of=/dev/mmcblk0 conv=fsync bs=1 count=442

dd if=u-boot.bin.sd.bin of=/dev/mmcblk0 conv=fsync bs=512 skip=1 seek=1

 

Thanks a bunch on any feedback! :beer:

Link to comment
Share on other sites

8 hours ago, AndrewDB said:

Hello Le Potato hackers, I have a small favor to ask of you: I just wrote a Howto cross-compile mainline u-boot for your "Le Potato"

(actually it's supposed to be for the La Frite when this starts shipping, but right now it's for the Le Potato)

 

Here: http://wiki.loverpi.com/faq:sbc:libre-aml-s805x-howto-compile-u-boot

 

Since I don't have a Le Potato I cannot verify that my HOWTO really produces a working u-boot, so I would be very grateful if any one of you could spend around 20 minutes of their (very valuable, without any doubt) time to follow the step-by-step instructions and check it out? 

 

What you need:

  1. An x86_64 PC/Laptop/Workstation running Linux, preferably Ubuntu 18.04 but anything else should be OK, as long as it's recent.
  2. A Le Potato.
  3. An SD-card
  4. A USB-to-serial converter to check that your you-just-compiled-it-yourself u-boot WORKS! :thumbup:

Missing instructions on how to copy u-boot.bin.sd.bin to your SD card, assuming your PC/laptop sees it as mmcblk0:

dd if=u-boot.bin.sd.bin of=/dev/mmcblk0 conv=fsync bs=1 count=442

dd if=u-boot.bin.sd.bin of=/dev/mmcblk0 conv=fsync bs=512 skip=1 seek=1

 

Thanks a bunch on any feedback! :beer:

 

hey is that just for building u-boot or u-boot with the UEFI magic used on the new libre computer images?

Link to comment
Share on other sites

some more quick feedback.

can you just clean up the code snippets that were added from the readme?  right now you can't just cut and paste them and run because they have > on each line :)

 

i will test the code out tho i promise

Link to comment
Share on other sites

8 hours ago, AndrewDB said:

Thanks a bunch on any feedback! :beer:

 

Firstly, thanks for the link/well-formatted write-up.  I mainlined the NanoPi K2 based (heavily) on the C2.  Only one point after a quick look:

Quote

To compile u-boot for the S905, read u-boot/board/amlogic/odroid-c2/README.odroid-c2

 

For S905, you should point people to "README.nanopi-k2"  The C2 has special blobs due to some... issues with advertising with Odroid.  The C2 blobs are only for use with the C2, the K2 uses the standard public blobs.

Link to comment
Share on other sites

4 hours ago, TonyMac32 said:

 

Firstly, thanks for the link/well-formatted write-up.  I mainlined the NanoPi K2 based (heavily) on the C2.  Only one point after a quick look:

 

For S905, you should point people to "README.nanopi-k2"  The C2 has special blobs due to some... issues with advertising with Odroid.  The C2 blobs are only for use with the C2, the K2 uses the standard public blobs.

Thanks a bunch for the tip, TonyMac32. I suspected the C2 had some special blobs and yes I am aware of the controversy over clock frequencies reported/real. So for the S905 I will point people to the "README.nanopi-k2" - which I am actually in the process of verifying too (I exchanged an email with Neil A. about it).

Link to comment
Share on other sites

4 hours ago, lanefu said:

 

hey is that just for building u-boot or u-boot with the UEFI magic used on the new libre computer images?

I have no idea what the "UEFI magic" refers to but if it's a feature of u-boot mainline and can be enabled with make menuconfig and an option somewhere then yes, "UEFI magic" should be available.

If you try it and it works, please send me a note and I will add it to the HOWTO. :beer:

Link to comment
Share on other sites

4 hours ago, lanefu said:


can you just clean up the code snippets that were added from the readme?  right now you can't just cut and paste them and run because they have > on each line :)

Yes, that is a good idea. I'll do a general cleanup and pay some attention to cleaning up the code from the README, erasing those pesky >!  :thumbup:

4 hours ago, lanefu said:

 

 

Link to comment
Share on other sites

Just a quick note: I have added a "cheat sheet" to my mainline u-boot build howto, from which the commands can be directly (but not blindly) copy-pasted into a terminal.

So the u-boot build process that before took 20 minutes, now takes 15 minutes or so. :lol:

 

Again, I would be really, really grateful if anybody could test the instructions in the howto and verify that they produce a fully functional mainline u-boot with all the latest and greatest features for your Le Potato. 

 

http://wiki.loverpi.com/faq:sbc:libre-aml-s805x-howto-compile-u-boot

 

Edit: 

1) Fixed some typos in the HOWTO and cheat sheet that would prevent the blob signing commands from executing.

 

2) Most importantly, I have added an experimental cheat sheet that describes the blob build process using a 64-bit (x86-64) aarch64 gcc from January 2017 instead of the presently used 32-bit (i386) compiler from November 2013...

 

Please test first the standard build, then the experimental build processes. They both should result in a fully functional mainline u-boot, but the experimental build process opens a path to avoid using obsolete tools to build u-boot for Amlogic 64-bit SoC's, something I believe will benefit the entire community.

 

:beer:

Edited by AndrewDB
New information added
Link to comment
Share on other sites

@AndrewDB

I have an error during the integration of compiled blobs into the mainline u-boot code.

 

root@ubuntu-uboot-compilation:~/u-boot_dev/u-boot# $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
/root/u-boot_dev/blobs/amlogic-u-boot/fip/acs_tool.pyc: line 1: $'\003\363\r': command not found
/root/u-boot_dev/blobs/amlogic-u-boot/fip/acs_tool.pyc: line 2: $'\373]\372Uc\a@s*\002dd\001lZdd\001l\001Z\001dd\001l\002Z\001dd\001l\003Z\003dd\002l\004Tdd\001l\005Z\005dd\001l\006Z\006dd\001l\aZ\add\001l\bZ\bd\003Z': command not found
: No such file or directorygic-u-boot/fip/acs_tool.pyc: line 3: de
/root/u-boot_dev/blobs/amlogic-u-boot/fip/acs_tool.pyc: line 4: d
d                                                                e
 : No such file or directory
/root/u-boot_dev/blobs/amlogic-u-boot/fip/acs_tool.pyc: line 11: unexpected EOF while looking for matching ``'
/root/u-boot_dev/blobs/amlogic-u-boot/fip/acs_tool.pyc: line 41: syntax error: unexpected end of file

 

 

Link to comment
Share on other sites

Hi rino,

I just went through the standard "cheat sheet" line by line, it took all of 12 minutes to produce the attached u-boot.bin.sd.bin without any errors.

If you want to try it again, I believe you probably missed copy-pasting a line along the way.

Or if you want to try the attached u-boot image file, just write it to any SD card using the instructions I listed above and test on your Le Potato with a USB serial adapter attached. You should be greeted with a 2019 u-boot! :thumbup:

u-boot.bin.sd.bin

 

Edit: I am also attaching the standard "cheat sheet", in case anybody wants to try. As mentioned above, it takes 12 minutes from start to finish to produce a mainline 2019 u-boot for the Le Potato.

u-boot_build_cheat_sheet.txt

Edited by AndrewDB
Attached the cheat sheet
Link to comment
Share on other sites

Hi @AndrewDB,

 

in the attached file you can find what I get on the Le Potato UART console using your u-boot.bin.sd.bin.

 

Other than that I re-execute the procedure and I got the same errors at the same point. However, ignoring the errors, and continuing I made  an "u-boot.bin.sd.bin" file. But it doesn't work (flashing it no boot) and  "diff" comand says it is different than yours. 

 

 

console.txt

Link to comment
Share on other sites

1 hour ago, rino said:

Hi @AndrewDB,

 

in the attached file you can find what I get on the Le Potato UART console using your u-boot.bin.sd.bin.

 

Other than that I re-execute the procedure and I got the same errors at the same point. However, ignoring the errors, and continuing I made  an "u-boot.bin.sd.bin" file. But it doesn't work (flashing it no boot) and  "diff" comand says it is different than yours. 

 

 

console.txt

OK, we have progress: checking the console.txt file which you attached, one can see that you get the u-boot prompt:

U-Boot 2019.04-rc2-gcfba74d (Mar 03 2019 - 12:56:05 +0000) libretech-cc

DRAM:  2 GiB
MMC:   mmc@72000: 0, mmc@74000: 1
In:    serial
Out:   serial
Err:   serial
[BL31]: tee size: 0
[BL31]: tee size: 0
Net:   
Warning: ethernet@c9410000 (eth0) using random MAC address - 22:eb:c8:5c:ae:f9
eth0: ethernet@c9410000
Hit any key to stop autoboot:  0 
=>

If you have a Linux kernel on the same SD card as u-boot you can try booting it. First you load the kernel into RAM, optionally load a ramdisk (uInitrd file), load the Le Potato dtb and then finally boot the kernel. It should work fine.

 

To determine what is going wrong when you try to compile u-boot following my cheat sheet, I need you to post the following file:

 

When you are finished compiling u-boot but before you exit the container,

history > compile_history.txt

 

You can then exit the container and use the "lxc file pull ubuntu-uboot-compilation/root/u-boot_dev/u-boot/compile_history.txt" command to retrieve this compile_history.txt file, and then post this compile_history.txt file here.

We'll compare it to the cheat sheet and easily find the error.

 

Thank you very much for all your hard work, rino! :thumbup:

Link to comment
Share on other sites

1 hour ago, AndrewDB said:

Looks good. Did you have any errors this time around?

Yes I have, always the same at the python compiled (.pyc) launch step:

 

$FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0

 

the error says:

/root/u-boot_dev/blobs/amlogic-u-boot/fip/acs_tool.pyc: line 1: $'\003\363\r': command not found

if the python source was available we can have a look into ...

 

Link to comment
Share on other sites

I believe that's part of the proprietary tools from Amlogic, so we probably don't have the source.

But more importantly, I have no problems running this tool but you do, in exactly the same environment (the container)?

Do you have any errors at any point before that?

Can you do a "uname -a" inside the container and send me the result?

Link to comment
Share on other sites

Hmmm, exactly the same as me. So it's unlikely that that is causing the problems we are seeing.

The only possible explanation is that somehow your git clone operation when you are cloning the libretech github repository is failing (or the baylibre repository). What we can do to check this is that you restart the entire procedure but pause just before running the acs python program, and we compare your version to mine, as well as the entire contents of the fip directory.

 

By any chance are there any errors before you get to that point?

 

Also did you manage to check that the u-boot binary that I sent you can load the kernel ?

Link to comment
Share on other sites

@AndrewDB

> By any chance are there any errors before you get to that point?

 

At the first "make" I get 2 warnings:

 

  DTC     arch/arm/dts/meson-gxbb-nanopi-k2.dtb
  DTC     arch/arm/dts/meson-gxbb-odroidc2.dtb
  DTC     arch/arm/dts/meson-gxl-s905x-p212.dtb
  DTC     arch/arm/dts/meson-gxl-s905x-libretech-cc.dtb
  DTC     arch/arm/dts/meson-gxl-s905x-khadas-vim.dtb
arch/arm/dts/meson-gxl-s905x-khadas-vim.dtb: Warning (avoid_unnecessary_addr_size): /gpio-keys-polled: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property
  DTC     arch/arm/dts/meson-gxm-khadas-vim2.dtb
arch/arm/dts/meson-gxm-khadas-vim2.dtb: Warning (avoid_unnecessary_addr_size): /gpio-keys-polled: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property

Link to comment
Share on other sites

@AndrewDB

Here the content of the fip dir:

 

root@ubuntu-uboot-compilation:~/u-boot_dev/u-boot# $FIPDIR/blx_fix.sh fip/bl30.bin fip/zero_tmp fip/bl30_zero.bin fip/bl301.bin fip/bl301_zero.bin fip/bl30_new.bin bl30
2172+0 records in
2172+0 records out
2172 bytes (2.2 kB, 2.1 KiB) copied, 0.00474344 s, 458 kB/s
3228+0 records in
3228+0 records out
3228 bytes (3.2 kB, 3.2 KiB) copied, 0.00798341 s, 404 kB/s
root@ubuntu-uboot-compilation:~/u-boot_dev/u-boot# ls -l fip
total 876
-rwxr-xr-x 1 root root    944 Mar 10 17:54 acs.bin
-rwxr-xr-x 1 root root  38336 Mar 10 17:54 bl2.bin
-rwxr-xr-x 1 root root   1112 Mar 10 17:54 bl21.bin
-rw-r--r-- 1 root root  38788 Mar 10 17:55 bl30.bin
-rwxr-xr-x 1 root root  10084 Mar 10 17:55 bl301.bin
-rw-r--r-- 1 root root  13312 Mar 10 18:00 bl301_zero.bin
-rw-r--r-- 1 root root  54272 Mar 10 18:00 bl30_new.bin
-rw-r--r-- 1 root root  40960 Mar 10 18:00 bl30_zero.bin
-rw-r--r-- 1 root root  99120 Mar 10 17:55 bl31.img
-rw-r--r-- 1 root root 577516 Mar 10 17:55 bl33.bin

Link to comment
Share on other sites

On 3/9/2019 at 8:28 PM, rino said:

Yes I have, always the same at the python compiled (.pyc) launch step:

 

$FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0

 

the error says:

/root/u-boot_dev/blobs/amlogic-u-boot/fip/acs_tool.pyc: line 1: $'\003\363\r': command not found

if the python source was available we can have a look into ...

 

see: https://github.com/armbian/build/pull/1310

Link to comment
Share on other sites

@ning

It worked. Thanks.

 

@AndrewDB

So in the procedure for LePotato is enough to change:

"$FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0"

in:

"python $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0"

and so the produced "u-boot.bin.sd.bin" boots.

Link to comment
Share on other sites

1 hour ago, rino said:

@ning

It worked. Thanks.

 

@AndrewDB

So in the procedure for LePotato is enough to change:

"$FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0"

in:

"python $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0"

and so the produced "u-boot.bin.sd.bin" boots.

@ning Thank you very much, I'll add your tip to the HOWTO.

 

@rino Nice work there rino!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines