Building the Kernel from Source

256 views
Skip to first unread message

Nick Burkitt

unread,
Jun 27, 2016, 4:43:06 PM6/27/16
to snickerdoodle forum
Hi Guys.

I'm trying to follow the instructions in the Snickerdoodle Book on building the Linux kernel from source (Ch. 19-21), but I haven't been able to make it very far. Here are some comments and questions.
First, it's probably not the best idea to give your u-boot git repo the same name as the Xilinx u-boot repo, in case someone (like me) wants to use both.
Next, it would appear that there's a step or two missing in the u-boot "Build from Source" section, between clone and make scripts:

cd u-boot-xlnx <-- obvious, perhaps, but it needs to be there
make ARCH=arm zynq_snickerdoodle_defconfig <-- missing?
make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- scripts

Actually, "make zynq_snickerdoodle_defconfig" is not entirely missing, but it doesn't appear in the instructions until the Kernel chapter.

And then I get stuck, since make scripts still fails, with a "Nothing to be done for 'scripts'." message, and the subsequent commands, which depend on the dtc script(s) having been built, also fail.
Any suggestions?
Thanks,

-Nick

Nick Burkitt

unread,
Jun 27, 2016, 7:45:40 PM6/27/16
to krtkl-sni...@googlegroups.com
Okay, I think I've got it figured out. This is how I think it's supposed to go. I think.
First you download the kernel sources. Then, you build the scripts, including the DTC, which is a prerequisite for building u-boot.
Then you download u-boot and build it to create mkimage, which is a prerequisite for building the kernel.
Optionally, you then configure the kernel.
Then you build the kernel, and then the loadable kernel modules.
Then you install the kernel modules into the root file system.
Close?

Set up SDK environment

$ cd /opt/Xilinx/SDK/2016.1

$ source settings64.sh

Download kernel source

$ cd ~/git

$ git clone https://github.com/krtkl/snickerdoodle-linux.git

$ git checkout sd-linux/3.14

Build kernel scripts

$ cd ~/git/snickerdoodle-linux

$ make ARCH=arm zynq_snickerdoodle_defconfig

$ make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- scripts

Add scripts to path

$ cd ~/git/snickerdoodle-linux/scripts/dtc

$ export PATH=$PATH:$(pwd)

Download u-boot source

$ cd ~/git

$ git clone https://github.com/krtkl/u-boot-xlnx.git

Build u-boot

$ cd ~/git/u-boot-xlnx

$ make ARCH=arm zynq_snickerdoodle_defconfig

$ make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi-

Add tools to path

$ cd ~/git/u-boot-xlnx/tools

$ export PATH=$PATH:$(pwd)

Configure kernel

$ cd ~/git/snickerdoodle-linux

$ make ARCH=arm <config_interface>

Build kernel

$ cd ~/git/snickerdoodle-linux

$ make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- LOADADDR=0x8000 uImage

Build kernel modules

$ cd ~/git/snickerdoodle-linux

$ make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- modules

Install kernel modules

$ cd ~/git/snickerdoodle-linux

$ make ARCH=arm INSTALL_MOD_PATH=<path_to_rootfs> modules_install


Nick Burkitt

unread,
Jun 27, 2016, 7:52:01 PM6/27/16
to krtkl-sni...@googlegroups.com
Oh, and git branch sd-linux/3.14 is MIA.

Bush

unread,
Jun 27, 2016, 10:08:55 PM6/27/16
to snickerdoodle forum
Well documented. You don't need the sd-linux/3.14 branch to build a supported kernel with the Snickerdoodle features (wireless drivers, etc.). The mainline kernel with Snickerdoodle configuration will work and customizations can be made from there. I will review and update the docs to update accordingly.

Rob Barris

unread,
Jun 30, 2016, 11:57:07 PM6/30/16
to krtkl-sni...@googlegroups.com
I'm following the flow that Nick wrote and ran into two things, one of which was easily fixed and the other I am unsure on.

1.  I didn't have the arm-linux-gnueabi binaries in my path.  Had to add this to my .bashrc:

export PATH=$PATH:/opt/xilinx/SDK/2016.1/gnu/arm/lin/bin/
# your path may vary depending on where you installed Xilinx SDK.

2. I am running into a missing header on this Ubuntu 14.04 system - as I try to do the last step of building u-boot.
same error as discussed here:  http://zedboard.org/content/u-boot-compilation-errors

make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- )
---
  HOSTCC  tools/aisimage.o
In file included from tools/aisimage.c:10:0:
include/image.h:923:27: fatal error: openssl/evp.h: No such file or directory
 # include  <openssl/evp.h>
                           ^
compilation terminated.
make[1]: *** [tools/aisimage.o] Error 1
make: *** [tools] Error 2

OK, solution after more googling -->

sudo apt-get install libssl-dev

Nick Burkitt

unread,
Jul 1, 2016, 2:32:52 PM7/1/16
to snickerdoodle forum
I should probably post my notes on installing Ubuntu, XSDK, Vivado, and PetaLinux, which would cover installing SSL. I'll add the step of setting up the SDK environment to my instructions, too. There are a couple of scripts in /opt/xilinx/SDK/2016.1/ (following your example path) that are intended to set up the SDK environment. That's probably your best bet. (e.g. source /opt/xilinx/SDK/2016.1/settings64.sh).

weath...@krtkl.com

unread,
Jul 1, 2016, 11:31:56 PM7/1/16
to krtkl-sni...@googlegroups.com
I'm just the "hardware/firmware guy" but what I really want to do is build the Linux Kernel from source on snickerdoodle.
In the old days ~2.4 kernel I used to do builds of the Linux kernel on a 686 class PC running at 133MHz with 32MB of RAM so I'm pretty sure it can be done.

Nick Burkitt

unread,
Jul 5, 2016, 3:12:16 PM7/5/16
to snickerdoodle forum
There's no reason it wouldn't work. If I find myself with time on my hands and nothing to do, I may try it just to see how long it takes. For now I'll stick to using the octa-core Xeon workstation that I liberated from its number-crunching duties. :-)
Reply all
Reply to author
Forward
0 new messages