Reliable build of the Linux Kernel for the BeagleBone Black
Asked Answered
S

3

10

Is there a reliable build of the Linux kernel for the BeagleBone Black platform anywhere ? I've followed the instructions here, as well as numerous other places, and none of them work. Either the modules don't build (the .ko files just don't get built and can't be found in the case of the link above), or there's missing build targets for the kernel. I'm using the Linaro ARM compiler (arm-linux-gnueabihf-gcc) cross compiling on 32-bit x86 Ubuntu 14.04.

Specifically, I've checked out the source at the BeagleBone Git repository, branches 3.8, 3.11, 3.12, 3.13 and 3.14. I've also checked out a 3rd party git clone here. The problems I've encountered are as follows:

  • 3.8: Kernel will compile (with numerous warnings), but the modules fail to compile due to errors in the patching process from running patch.sh in the branch.
  • 3.11: Kernel will compile (with numerous warnings), but the uImage-dtb.am335x-boneblack Make target will not. Compiling modules fails due to at least one file having an incorrect patch that yields incorrect C syntax.
  • 3.12: Kernel will compile (with numerous warnings), along with the modules. Copying kernel and modules to the board succeeds. Booting the kernel fails, and freezes as soon as the bootup begins right out of the boot command in U-Boot.
  • 3.13, 3.14: The kernel compilation fails with numerous syntax errors.
  • 3.8.13+ from TowerTech: The kernel compilation succeeds (with numerous warnings), the module compilation fails, again due to incorrect patching from patch.sh.

In the cases where I could compile a kernel, I copied it to a fresh, vanilla board in memory using a TFTP boot server from U-Boot, and booted the kernel in memory. However, none of the successfully compiled kernels could work properly because they were missing their modules / firmware / dtbs. What could be causing the incorrect patching ? Surely, the developers who've written the code and patches must have tested it, so there may be something wrong with my workspace, though I can't imagine what at this point. The commands I used were the same as those at link 1.

Spracklen answered 20/5, 2014 at 17:29 Comment(9)
What platform are you using to perform the cross compile?Carpio
A brief look at the interwebs sort of suggests that existing beaglebone howtos are not any worse than the typical embedded breed. Would you mind to make your question more specific regarding the problems you're experiencing?Smite
@Smite I was extremely frustrated earlier and my question was poorly worded. It has been updated and corrected.Spracklen
@wallyk, I'm cross-compiling on a 32-bit x86 laptop running Ubuntu 14.04. All of the BeagleBone Blacks I've dealt with are using stock Angstrom straight out of the box.Spracklen
I've been using the stock debian built kernels with the BBB and found it to be rock solid, with nothing missing. What are you trying to achieve by compiling your own kernel?Portly
@JasonLewis I need to patch the OMAP UART driver to add a fix for supporting 500kbaud transfer rates. Supposedly kernels later than 3.8.13 already have this fix, but I can't get 3.11 or 3.12 to compile properly with modules, and 3.13+ doesn't have a capemgr built-in any more, and that's a rabbit hole I really don't want to go down.Spracklen
@JasonLewis Do the Debian kernels support automated kernel upgrades through apt on the BeagleBone Blacks?Spracklen
As far as I know yes - but I can't recall actually doing that myself. I'm not sure if there has been a kernel update since I installed.Portly
It may be that your u-boot doesn't support device tree. You may want to check these links armadeus.com/wiki/index.php?title=Kernel-with-device-treeMillepore
P
10

I also followed the link you have mentioned and I am able to boot the BBB. I am using the mainline kernel from https://www.kernel.org/. The following are the steps I followed

  1. Download the latest kernel. My version is 3.18-rc4
  2. Use "omap2plus_defconfig" which is the default config for beaglebone black
  3. Make commands are

    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- omap2plus_defconfig -j4

    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage dtbs LOADADDR=0x80008000 -j4.

    The image produced is present in the following path.

    arch/arm/boot/uImage uImage

    arch/arm/boot/dts/am335x-boneblack.dtb

  4. After this compile the modules.

    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules -j4

  5. I was using busybox and NFS server as root

Compiler used is arm-linux-gnueabi-gcc. With this I am able to boot successfully and run modules. It has the advantage that we are using the latest kernel available.

Paranoia answered 5/12, 2014 at 5:12 Comment(2)
This, but I also had to set fdtaddr to 0x88000000 in the u-boot environment, because (I believe) the default address overlaps with the kernel in ramCarmelcarmela
With omap2plus_defconfig I got a bunch of "Selected processor does not support xxx in ARM mode" where xxx can be one of many instructions. I had to use omap1 with my crosstool-based toolchain. Have any idea why?Wallow
R
5

I was finally able to boot the BBB with a new kernel 3.14

I am on a beagleboneblack rev C with debian pre-installed.

I basically followed steps here http://dev.ardupilot.com/wiki/building-for-beaglebone-black-on-linux/

Kernel download: (I didn't use git, limited bandwidth...) https://github.com/beagleboard/linux/archive/3.14.tar.gz

Build (done on a Ubuntu 14.04) : (I am not sure if some steps are not relevant or redundant)

Install mkimage

sudo apt-get install libssl-dev
wget ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2
tar -xjf u-boot-latest.tar.bz2
cd u-boot-2014.10/
make sandbox_defconfig tools-only
sudo install tools/mkimage /usr/local/bin

Download am335x-pm-firmware.bin from http://arago-project.org/git/projects/?p=am33x-cm3.git;a=tree;f=bin;h=75a5de7aa94ff6ccbfb1b3b9dc80bc2fe5b423bf;hb=refs/heads/master and copy to kernel directory

Build the kernel

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- bb.org_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage dtbs LOADADDR=0x80008000 -j4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules -j4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- am335x-boneblack.dtb -j4

Install Modules

mkdir -p ../export/rootfs
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=../export/rootfs/ modules_install

Now copy modules to /lib/modules/ directory in your beaglebone black (create a new directory for the modules)

cd ../export/rootfs/lib/modules/
rsync -avz 3.14.25/ [email protected]:/lib/modules/3.14.25/

Next is to copy the zImage and am335x-boneblack.dtb to the BBB

copy zImage from arch/arm/boot to /boot/uboot/ of BBB

copy am335x-boneblack.dtb from arch/arm/boot/dts to /boot/uboot/dtbs

If you replace the existing zImage and am335x-boneblack.dtb with new ones directly and they don't work, you will be in trouble. I stored the new images in a folder in /boot/uboot and manipulated environment variables in uboot to pick the one i wanted.

I know, I could have used tftpserver..

I hope it helps someone. I spent a lot of time on this which should have been very straightforward :(

Ruy answered 12/12, 2014 at 19:59 Comment(1)
exactly how did you "manipulated environment variables in uboot to pick the one i wanted".Dirac
A
1

Yeah, the documentation is really out of date (circa 2011 or early 2012) and very confusing. First, the github/beagleboard/kernel area says it is deprecated and to use beagleboard/linux for the kernel. BUT, it is still be actively used 1) to add patches that have not been accepted to the kernel tree yet and 2) to add kernel configs specifically for the beaglebone devel builds. The bb.org_defconfig in the kernel tree does not turn on some debug stuff.

So.. both github/beagleboard/linux AND github/beagleboard/kernel work for me (3.14) on a BBB. If you want a standard image, use "linux"; if you want a bells-and-whistles image use "kernel".

Also, a more recent cross-compiler is in APT at gcc-arm-linux-gnueabihf. Make sure you have the "hf" (hard floating point unit) version. No need to depend on linaro.

I'll update the docs after I get the project rolling....

Aristides answered 2/10, 2014 at 18:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.