Giter Site home page Giter Site logo

u-boot-tfa-build's Introduction

U-Boot w/ Trusted Firmware Image Builder

This is a simple tool for build Arm firmware images from U-Boot, Trusted Firmware A, and the Linux devicetree repo. It uses the git 'repo' tool to clone a copy of each project and a Makefile to build for various Arm targets.

Using this tool

It is best to use this tool with the u-boot-manifest repo to fetch all the required source repositories. Use the git repo tool to fetch all the projects listed in the manifest and create the required symlinks. Install repo first. Most linux distros have repo packaged.

To initialize the build environment, create a new working directory and run the repo init command:

$ mkdir firmware-working
$ cd firmware-working
$ repo init -u https://github.com/glikely/u-boot-manifest
$ repo sync

This will clone all of the required git trees and link the Makefile into the root directory. To build the firmware, simply type:

$ make <target_name>_defconfig
$ make

Where <target_name> is a U-Boot defconfig that can be found in the u-boot/configs directory.

The QEMU config also provides a qemu target to run the image:

$ make qemu

Patches to target projects

There are a few changes to the main projects in the ./patches directory. You'll may need to apply those to get a working firmware image.

Supported Platforms

The following platforms should work out of the box. More to come as this tool matures.

  1. Macchiato-bin mvebu_mcbin-88f8040_defconfig
  2. RockPro64 rockpro64-rk3399_defconfig
  3. QEMU aarch64 qemu_arm64_defconfig
  4. Solidrun LX2k lx2160a-cex7 lx2160acex7_tfa_defconfig Need to use git repos listed in lx2160a.xml. (see https://github.com/glikely/u-boot-manifest)

u-boot-tfa-build's People

Contributors

apalos avatar glikely avatar jmarinho avatar

Watchers

 avatar  avatar

u-boot-tfa-build's Issues

Macchiato-bin does not build with default manifest even after patch applied

I don't understand how this is working for you.
I may be doing something stupid but if so I am in good company, Jan Kiska had the same problem in 2020.
https://lists.trustedfirmware.org/pipermail/tf-a/2020-September/000744.html

I have done a repo sync with the default manifest as described in the README.
I am currently using ARM 10.3 toolchains but was having the same issue with ubuntu 20.04 gcc 9.2 toolchains

x/trusted-firmware-a$ git describe
v2.5-725-ge33ca7b44

(I also tried v2.5)

x/mv-ddr$ git describe --all
remotes/m/master
x/mv-ddr$ git branch -a

  • (HEAD detached at a881467)
    remotes/m/master -> marvell/mv_ddr-armada-atf-mainline
    remotes/marvell/master
    remotes/marvell/mv-ddr-devel
    remotes/marvell/mv_ddr-armada-17.02
    remotes/marvell/mv_ddr-armada-17.04
    remotes/marvell/mv_ddr-armada-17.06
    remotes/marvell/mv_ddr-armada-17.08
    remotes/marvell/mv_ddr-armada-17.10
    remotes/marvell/mv_ddr-armada-18.06
    remotes/marvell/mv_ddr-armada-18.09
    remotes/marvell/mv_ddr-armada-18.12
    remotes/marvell/mv_ddr-armada-atf-mainline
    x/mv-ddr$ git apply ../scripts/patches/mv-ddr/fix-uninitialized.patch

x$ mkdir -p build/mcbin
x$ BUILD_OUTPUT=build/mcbin make mvebu_mcbin-88f8040_defconfig
x$ BUILD_OUTPUT=build/mcbin make
... lots of good stuff ...
CC drivers/marvell/ap807_clocks_init.c
CC drivers/marvell/thermal.c
CC plat/marvell/armada/a8k/common/plat_thermal.c
CC plat/marvell/armada/a8k/a80x0_mcbin/board/dram_port.c
plat/marvell/armada/a8k/a80x0_mcbin/board/dram_port.c:51:2: error: ‘NOT_COMBINED’ undeclared here (not in a function)
51 | NOT_COMBINED, /* ddr twin-die combined*/
| ^~~~~~~~~~~~
plat/marvell/armada/a8k/a80x0_mcbin/board/dram_port.c:52:2: error: braces around scalar initializer [-Werror]
52 | { {0} }, /* raw spd data */
| ^
... lots of bad stuff ...

x/mv-ddr$ git reset --hard #throw away patch
x/mv-ddr$ git checkout marvell/mv-ddr-devel
x$ BUILD_OUTPUT=build/mcbin make clean
x$ BUILD_OUTPUT=build/mcbin make
[works even w/o patch]

whats is happening?

tf-a plat/marvell/armada/a8k/a80x0_mcbin/board/dram_port.c is defining a DDR topology data structure that uses the enum constant NOT_COMBINED. This constant does not exist in the tf-a or mv-ddr files (in these versions).
In the marvell/mv-ddr-devel branch this symbol is part of an enum in mv-ddr/ddr_topology_def.h
(The values of COMBINED and NOT_COMBINED were swapped on Nov 21 2020 so not great ABI stability)

I am not running this, just building so there could be other problems

EFI_LOADER implies FAT_WRITE

With U-Boot v2020.10 EFI_LOADER implies FAT_WRITE. So this can be removed from 0001-Add-some-defaults-for-EFI-testing.patch.

README should document compiler assumptions

The README should show what compilers you are using to have a known good starting point.
The makefiles support CROSS_COMPILE with or without the full path.
rockpro64 also needs an M0 compiler, the default can be overridden with M0_CROSS_COMPILE with or without the full path.

So for ARM 10.3 toolchains installed as I do, the instructions would look like:

$ export CROSS_COMPILE=$HOME/opt/arm/toolchain_a/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-

$ # for rockpro64 you also need
$ export M0_CROSS_COMPILE=$HOME/opt/arm/toolchain_m/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-

I am inferring based on make file defaults that you are using gcc packages from distribution.
Such as:
$ sudo apt install gcc-arm-none-eabi gcc-aarch64-linux-gnu
On Ubuntu 20.04 this results with 9.2.1 and compiler triplets matching current makefile defaults of
arm-none-eabi-gcc and
aarch64-linux-gnu-gcc
The versions you will get will vary based on distro version used.
With the above packages installed you do not need to set {M0_,}CROSS_COMPILE vars.
qemu-arm64 and rockpro64 build OK with the above versions and qemu-fip runs OK

Ubuntu has versioned gcc packages, but they install commands like:
arm-none-eabi-gcc-9.2.1 and
aarch64-linux-gnu-gcc-9.2.1
This form is hard to work with CROSS_COMPILE as we need to add a suffix to the command

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.