Jump to content
  • 0

Compile linux-Digilent-dev from within Petalinux tools



Somewhat out of curiosity, somewhat out of frustration to get zybo linux builds all complete manually, I decided to try configuring/compiling the Linux-Digilent-dev kernel source from within petalinux tools.  This avoids a large number of steps (to generate uboot, fsbl, project management, etc).

After creating a project via `petalinux-create -t project`, and then importing hardware bsp, I placed a copy of the Linux-Digilent-dev within %PETALINUX_PROJECT%/components/linux-kernel/Linux-Digilent-dev.

I only had to run petalinux-config and set the device tree include dir manually to point within the above directory, and to select the above as the kernel source.

Compiles mostly work, except for an exception looking for BITS_PER_LONG in various places.  I found the ./arch/arm/include/uapi/asm/bitsperlong.h file missing, copied it from one of the other locations, and that got through a few errors, until I hit this one:

[ALL  ] In file included from ~/ZYBO_linux_bd/petalinux_bd/components/linux-kernel/Linux-Digilent-dev/scripts/mod/devicetable-offsets.c:2:0:
[ALL  ] ~/ZYBO_linux_bd/petalinux_bd/components/linux-kernel/Linux-Digilent-dev/include/linux/mod_devicetable.h:311:48: error: 'BITS_PER_LONG' undeclared here (not in a function)
[ALL  ]   kernel_ulong_t evbit[INPUT_DEVICE_ID_EV_MAX / BITS_PER_LONG + 1];
[ALL  ]                                                 ^
[ERROR] make[5]: *** [scripts/mod/devicetable-offsets.s] Error 1
[ERROR] make[4]: *** [scripts/mod] Error 2
[ERROR] make[3]: *** [scripts] Error 2

I am beginning to think some other config setting is incorrect.


Does any one have an idea of what the issue could be?  I'll go and try to compile the kernel manually, but I ran into issues trying to configure and compile u-boot, which is why I ended up taking this path.

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

Thanks for the response, and another tutorial (the first you listed).  I have followed several others (from Digilent) that are out of date, inaccurate, or otherwise in need of touch up.

After following the Linux on Zybo tutorial (through u-boot anyway), I can build it correctly.  A few warnings and errors were cleaned up by converting scripts from DOS format to unix via dos2unix (mkconfig and tools/scripts/define2mk.sed had ^M as line endings that coughed up a few messages after I allowed the shell called in mkconfig to report errors.)  Removing petlainux from my search path also may have helped.

I'll follow up if I make it all the way through.  I still like the petalinux methods, as the wrapper scripts keep everything simple & clean.  But I prefer understanding the flow beneath those scripts, as these examples show.


Thanks again.

Link to comment
Share on other sites

I spoke too soon.  I found some issues, and think they may have been due to the fact that I originally git cloned the repo from within windows, and then copied into my VM/CentOS home dir for building (so symlinks & such would work).

So I re-cloned directly from within my linux VM.  Now there is no zynq_zybo.h or zynq_zybo board config available.

1060 ~/ZYBO_linux_bd $ git clone -b master-next https://github.com/Digilent/u-boot-Digilent-Dev.git
Initialized empty Git repository in /home/ME/ZYBO_linux_bd/u-boot-Digilent-Dev/.git/
remote: Counting objects: 252883, done.
remote: Total 252883 (delta 0), reused 0 (delta 0), pack-reused 252883
Receiving objects: 100% (252883/252883), 71.40 MiB | 5.44 MiB/s, done.
Resolving deltas: 100% (200876/200876), done.


1079 ~/ZYBO_linux_bd/u-boot-Digilent-Dev $ find -name *zybo*
1080 ~/ZYBO_linux_bd/u-boot-Digilent-Dev $ 

Link to comment
Share on other sites

The devil is always in the details, and thanks for noticing.  I didn't realize there could be two root directories for digilent projects.

However, the master branch I checked out seems to have much more recent activity than the master-next branch of the DigilentInc projects.  That doesn't mean it'll work, or is better, but it seems like that is where the current attention is.


Link to comment
Share on other sites

On 3/8/2016 at 0:51 AM, miguel_rodrigues said:

Hello jkoller, I verified just now and it is in master-next. Instead of doing

you should do

Then if you run

  • grep -r "zybo"

you will find zynq_zybo.h under /include/configs/

This is correct.  


Link to comment
Share on other sites

On 3/7/2016 at 9:33 AM, miguel_rodrigues said:

Hi jkoller, if your end goal is having the Linux on Zybo I would follow this tutorial. If you just want to have Busybox, I would follow this one instead.


They are mostly the same. What are you trying to configure that leads to errors when compiling u-boot?

In the first ("Linux on Zybo") tutorial, in Step 9: Obtaining the Linaro file system, the link to the Linaro file system page is no longer valid!

How do you currently obtain the Linaro file system?


Link to comment
Share on other sites

Linaro archived that fs... the new link is:


That guide is in more peril though: we are about to take down the "DigilentInc" github account because it has been deprecated by our "Digilent" account. Our new Linux fork is maintained here: https://github.com/Digilent/linux-digilent . I will do my best to contact the creator of the guide before we do this.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...