cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
3,798 Views
Registered: ‎05-12-2016

Building u-boot outside petalinux

Jump to solution

Hi!

 

I've got a very simple design for Arty (Microblaze + interrupt controller + timer + uartlite) and I got petalinux to build both linux and u-boot for it succesfully.

 

However, I want to manually build u-boot to learn about the process, yet I'm having trouble finding what it is that petalinux does in order to compile u-boot for the specific board. I've downloaded Xilinx's u-boot repo, version xilinx-v2017.1 and I've copied the DTS file as uboot-xilinx-v2017.1/arch/microblaze/dts/microblaze-generic.dts However, petalinux's u-boot.elf file boots succesfully on the board, but the version I compile isn't showing any serial output. I'm using microblaze-generic target.

 

I would like to know what is it that petalinux does in order to do so myself and learn more detail about the process. I haven't even been able to find where it is that petalinux compiles u-boot, so I can't even compare petalinux u-boot with mine, or check its .config file or nothing. It seems like it's been purposefully hidden so I can't get a grasp of what's going on!

 

Best regards!

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Explorer
Explorer
4,096 Views
Registered: ‎02-08-2017

@a.gamez

I thought you may use this cloned source to find the **_defconfig file from which you can extract the device tree name.

 

Anyways, I can suggest other workaround based in your method: you can run another loop like

 

while true; do find -name .config; done

 

so instead of complete configuration file, you search for .config file in which all executed configuration are copied in.

Once it is found copy it before petalinux deletes it.

View solution in original post

12 Replies
Highlighted
Scholar
Scholar
3,786 Views
Registered: ‎11-09-2013

there are things you should not do, unless really badly needed.

 

compiling u-boot standalone is one of such things. Doable but unless you have a real reason to-do it, you should not.

0 Kudos
Highlighted
Explorer
Explorer
3,780 Views
Registered: ‎12-29-2007

Just to make sure you are aware about this:

http://www.wiki.xilinx.com/U-boot

There are at least the sources you can inspect.

Highlighted
Adventurer
Adventurer
3,774 Views
Registered: ‎05-12-2016
Yes, I know about that, and also about http://www.wiki.xilinx.com/Build%20U-Boot but I haven't been able to build myself a bootable u-boot. Thanks anyhow!
0 Kudos
Highlighted
Explorer
Explorer
3,744 Views
Registered: ‎02-08-2017

@a.gamez

When starting your project in Petalinux, before building the project. In configuration menuconfig go to "Linux Component Selection"

ubooterror_01.PNG

 

In u-boot section, you can choose other than petalinux, in My shot here I chose remote u-boot (but there is other option to choose other local u-boot directory).

Then go to the next field to choose where the other u-boot source

ubooterror_02.PNG

 

In my case I had to define URL of u-boot

ubooterror_03.PNG

 

Then in the main configuration window again, go to u-boot Configuration. Then choose in the first field configuration "other" then Petalinux, in the following field you have to write down the name of your configuration file.

 

But my advice, DO NOT use Petalinux for configuring standalone u-boot, If you have an error, you will repeat complete long compilation cycle

 

 

 

 

Highlighted
Adventurer
Adventurer
3,734 Views
Registered: ‎05-12-2016

Thanks @moibrahim


Then in the main configuration window again, go to u-boot Configuration. Then choose in the first field configuration "other" then Petalinux, in the following field you have to write down the name of your configuration file.

 

But my advice, DO NOT use Petalinux for configuring standalone u-boot, If you have an error, you will repeat complete long compilation cycle

 


I think you've misunderstood me. What I want to do is precisely that, NOT using Petalinux to configure and build u-boot. Your guide is useful for building u-boot from a different codebase using a custom config.

 

However, what I'm in need of, is extracting from petalinux' u-boot the modifications it does (.dts file, .config, etc) in order to build u-boot for my exported hardware (system.hdf), because I can't find what's the right configuration & dts for building it.

0 Kudos
Highlighted
Explorer
Explorer
3,728 Views
Registered: ‎02-08-2017

@a.gamez

By default, petalinux is using suitable configuration file that resides in:

u-boot-directory/configs/<<baordName>>_defconfig

 

So I am not sure what is your board name, but in that directory you can find needed configuration.

 

For example I have the board zcu102, so Petalinux by default is using "xilinx_zynqmp_zcu102_revB_defconfig".

Inside this configuration file, you can find out which device tree is used for the configuration. It is defined in the field "CONFIG_DEFAULT_DEVICE_TREE"

Highlighted
Adventurer
Adventurer
3,721 Views
Registered: ‎05-12-2016

@moibrahim

 

Yep. That's what I thought. The problem is that u-boot-directory isn't there at all. u-boot source code doesn't appear anywhere, I think petalinux is deleting the directory after it builds u-boot, so I can't look for those files.

 

I've searched using find for names that I know that exist under u-boot source code (because I've downloaded it) and they simply don't exist.

 

EDIT: I can confirm this. I go to build/tmp/work/plnx_microblaze-xilinx-linux/u-boot-xlnx and do the following:

 

while true; do find -name xilinx_zynqmp_zcu102_revB_defconfig; done

 

Meanwhile, I run petalinux-build -c u-boot, and for a period of time, the loop above finds that file:

 

./v2017.01-xilinx-v2017.4+gitAUTOINC+5fa7d2ed06-r0/git/configs/xilinx_zynqmp_zcu102_revB_defconfig
./v2017.01-xilinx-v2017.4+gitAUTOINC+5fa7d2ed06-r0/git/configs/xilinx_zynqmp_zcu102_revB_defconfig
./v2017.01-xilinx-v2017.4+gitAUTOINC+5fa7d2ed06-r0/git/configs/xilinx_zynqmp_zcu102_revB_defconfig
./v2017.01-xilinx-v2017.4+gitAUTOINC+5fa7d2ed06-r0/git/configs/xilinx_zynqmp_zcu102_revB_defconfig

 

Once petalinux-build -c u-boot finishes, find ceases to well, find that file anymore. Directory git has disappeared. So I cannot inspect what has petalinux really built.

0 Kudos
Highlighted
Explorer
Explorer
3,714 Views
Registered: ‎02-08-2017

@a.gamez

I can suggest the following.

In Petalinux project directory go to build>>downloads>>git2>>github.com.Xilinx.u-boot-xlnx.git

type pwd in a terminal window to get that path

copy it

 

then go to your preferred directorz

 

then use:

git clone <<copied/path>>

 

This will give you copy of the downloaded u-boot version so you can find your configuration file

Highlighted
Adventurer
Adventurer
3,708 Views
Registered: ‎05-12-2016

@moibrahimThat won't be useful, because petalinux modifies u-boot configuration and places the device tree it uses under u-boot sourcecode, and the compiles. Cloning that directory gives me the untouched source code, but that I can already access via Xilinx' github repository. I need that source code after it's being compiled, so all configuration and files changed are there.

0 Kudos
Highlighted
Explorer
Explorer
4,097 Views
Registered: ‎02-08-2017

@a.gamez

I thought you may use this cloned source to find the **_defconfig file from which you can extract the device tree name.

 

Anyways, I can suggest other workaround based in your method: you can run another loop like

 

while true; do find -name .config; done

 

so instead of complete configuration file, you search for .config file in which all executed configuration are copied in.

Once it is found copy it before petalinux deletes it.

View solution in original post

Highlighted
Adventurer
Adventurer
2,915 Views
Registered: ‎05-12-2016

@moibrahimThank you! That was a very good idea. I asked find to -exec cp {} /tmp/.config and I got the file I wanted.

 

I've still have had to find and copy a few other files, but at least I'm now on track: I've built a u-boot that finally outputs something on console. It still doesn't work fully, but now I'm progressing.

 

I still don't believe I have to make such a horrible hack just to get a couple of files. This is something that Xilinx should take a look at, it looks like it's made on purpose just to screw around with people.

Highlighted
Visitor
Visitor
2,837 Views
Registered: ‎04-17-2018

I did a different hack, I added

 

#error stop here

 

at the end of

 

./project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h

 

then used petalinu-build which then stopped telling me of the error and where the file was.

 

I agree that petalinux is a nightmare to work with beyond building the reference bsp designs.