Robert Nelson's kernel build for the BBB

From Crashcourse Wiki

Jump to: navigation, search

Contents

Overview

My attempt to use Robert Nelson's instructions here and do as little as possible to get a booting system on my BBB. The operative phrase is "as little as possible."

Checking out

$ git clone https://github.com/RobertCNelson/linux-dev.git
$ git checkout am33x-v3.12

Dev host dependencies

According to Robert's dependency script, I needed to do the following:

$ sudo apt-get install u-boot-tools lzma

Robert's scripts will let you know if you're missing any dependencies.

Local mods before getting started

system.sh

It appears that, for a simple kernel build, my entire system.sh script can be nothing more than:

#!/bin/sh

CC=arm-poky-linux-gnueabi-
LINUX_GIT=/home/rpjday/k/git   [or whatever is appropriate for you]
ZRELADDR=0x80008000

Create this manually for now.

Building a uImage (not necessary anymore)

Uncomment the appropriate lines from build_kernel.sh:

... snip ...
make_kernel () {
        image="zImage"
        unset address

        #uImage, if you really really want a uImage, zreladdr needs to be defined on the build line going forward...
        #image="uImage"
        #address="LOADADDR=${ZRELADDR}"
... snip ...

Doing the build

$ ./build_kernel.sh

which produces:

+ Detected build host [Ubuntu 12.04.3 LTS]
+ host: [x86_64]
+ git HEAD commit: [ebe1beca16c49514a9f514e00caeb82798f1575d]
Debug: CORES=8
-----------------------------
scripts/gcc: Using: arm-poky-linux-gnueabi-gcc (GCC) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------
debug: CC=arm-poky-linux-gnueabi-
Debug: CORES=8
Debug: CORES=8
-----------------------------
scripts/git: Debug: LINUX_GIT is setup as...
/home/rpjday/k/git
-----------------------------
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[branch "master"]
	remote = origin
	merge = refs/heads/master
-----------------------------
scripts/git: Updating LINUX_GIT tree via: git fetch
remote: Counting objects: 2838, done.
remote: Compressing objects: 100% (529/529), done.
remote: Total 2172 (delta 1805), reused 1978 (delta 1641)
Receiving objects: 100% (2172/2172), 409.26 KiB | 680 KiB/s, done.
Resolving deltas: 100% (1805/1805), completed with 431 local objects.
From git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
   b05430f..a22a0fd  master     -> origin/master
/home/rpjday/devkits/bbb/rcn/linux-dev
Cloning into '/home/rpjday/devkits/bbb/rcn/linux-dev/KERNEL'...
done.
Resolve operation not in progress, we are not resuming.
git tree is clean...

[master ea0a8cf] empty cleanup commit
HEAD is now at ea0a8cf empty cleanup commit
Already on 'master'
Your branch is ahead of 'origin/master' by 1 commit.
Already up-to-date.
... snip ...
Switched to a new branch 'v3.11-bone0.4'
v3.11-8764-g7426d62
Starting patch.sh
dir: bone-support
Applying: ARM: OMAP2+: am335x-bone*: add DT for BeagleBone Black
dir: general-fixes
Applying: add PM firmware
Applying: defconfig add for mainline on the beaglebone
dir: dtc-fixes
Applying: Fix util_is_printable_string
Applying: fdtdump: properly handle multi-string properties
dir: dtc-overlays
Applying: dtc: Dynamic symbols & fixup support
Applying: dtc: Dynamic symbols & fixup support (shipped)
dir: of-fixes
Applying: of: i2c: Export single device registration method
Applying: OF: Clear detach flag on attach
Applying: OF: Introduce device tree node flag helpers.
Applying: OF: export of_property_notify
Applying: OF: Export all DT proc update functions
Applying: OF: Introduce utility helper functions
Applying: OF: Introduce Device Tree resolve support.
Applying: OF: Introduce DT overlay support.
dir: pdev-fixes
Applying: pdev: Fix platform device resource linking
Applying: of: Link platform device resources properly.
Applying: omap: Properly handle resources for omap_devices
Applying: omap: Avoid crashes in the case of hwmod misconfiguration
dir: dma-devel
Applying: dma: edma: add device_slave_sg_limits() support
Applying: dmaengine: add dma_get_slave_sg_limits()
Applying: mmc: omap_hsmmc: set max_segs based on dma engine limits
Applying: da8xx: config: Enable MMC and FS options
Applying: ARM: dts: add AM33XX EDMA support
Applying: ARM: dts: add AM33XX SPI DMA support
Applying: ARM: dts: add AM33XX MMC support
Applying: DMA: EDMA: Split out PaRAM set calculations into its own function
Applying: DMA: EDMA: Add support for Cyclic DMA
Applying: sound: soc: soc-dmaengine-pcm: Add support for new DMAEngine request API
Applying: mmc: omap_hsmmc: Fix the crashes due to the interrupts racing
Applying: ARM: EDMA: Fix clearing of unused list for DT DMA resources
dir: mmc-fixes
Applying: omap-hsmmc: Correct usage of of_find_node_by_name
Applying: omap_hsmmc: Add reset gpio
dir: dts-fixes
Applying: dts: beaglebone: Add I2C definitions for EEPROMs & capes
Applying: arm: beaglebone: dts: Add capemanager to the DTS
Applying: OF: Compile Device Tree sources with resolve option
Applying: arm: bone: dts: add CD for mmc1
Applying: am335x-boneblack: add eMMC DT entry
Applying: am335x-bone*: fix MMC regulators on boneblack
Applying: am335x-bone*: enable HDMI on black
dir: i2c-fixes
Applying: i2c-EEPROM: In kernel memory accessor interface
Applying: grove-i2c: Add rudimentary grove i2c motor control driver.
dir: pinctrl-fixes
Applying: pinctrl: pinctrl-single must be initialized early.
dir: capemgr
Applying: capemgr: Capemgr makefiles and Kconfig fragments.
Applying: capemgr: Beaglebone capemanager
Applying: capemgr: Remove __devinit/__devexit
Applying: bone-capemgr: Make sure cape removal works.
Applying: bone-capemgr: Fix crash when trying to remove non-existant slot
Applying: bone-capemgr: Force a slot to load unconditionally
Applying: capemgr: Added module param descriptions
Applying: capemgr: Implement disable overrides on the cmd line
Applying: capemgr: Implement cape priorities
Applying: bone: capemgr: Introduce simple resource tracking
Applying: capemgr: Add enable_partno parameter

dir: reset
Applying: reset: Add driver for gpio-controlled reset pins
dir: capes
Applying: capemgr: firmware makefiles for DT objects
dir: lcdc-fixes
Applying: gpu:drm:tilcdc: get preferred_bpp value from DT
Applying: drm/tilcdc fixing i2c/slave initialization race
Applying: drm: tilcdc: Fix scheduling while atomic from irq handler.
Applying: tilcdc: Slave panel settings read from DT now
dir: net
Applying: am33xx: cpsw: default to ethernet hwaddr from efuse if not defined in dt
dir: saucy
patch.sh ran successful
[v3.11-bone0.4 8e27220] 3.11-bone0.4 patchset
... kernel build ...

The build results

In the deploy/ directory:

-rw-rw-r-- 1 rpjday rpjday   113007 Sep 20 08:02 3.12.0-rc1-bone1.1.config
-rw-rw-r-- 1 rpjday rpjday    55007 Sep 20 08:02 3.12.0-rc1-bone1.1-dtbs.tar.gz
-rw-rw-r-- 1 rpjday rpjday  1182996 Sep 20 08:02 3.12.0-rc1-bone1.1-firmware.tar.gz
-rw-rw-r-- 1 rpjday rpjday 35335609 Sep 20 08:02 3.12.0-rc1-bone1.1-modules.tar.gz
-rw-rw-r-- 1 rpjday rpjday  2946024 Sep 20 08:02 3.12.0-rc1-bone1.1.uImage

The dtbs tarball:

-rw-rw-r-- rpjday/rpjday 24493 2013-09-20 14:42 am335x-boneblack.dtb
-rw-rw-r-- rpjday/rpjday 24255 2013-09-20 14:42 am335x-bone.dtb
-rw-rw-r-- rpjday/rpjday 26126 2013-09-20 14:42 am335x-evm.dtb
-rw-rw-r-- rpjday/rpjday 24140 2013-09-20 14:42 am335x-evmsk.dtb
-rw-rw-r-- rpjday/rpjday 12200 2013-09-20 14:42 am3517-evm.dtb
-rw-rw-r-- rpjday/rpjday 12179 2013-09-20 14:42 am3517_mt_ventoux.dtb
-rw-rw-r-- rpjday/rpjday  1613 2013-09-20 14:42 am43x-epos-evm.dtb
-rw-rw-r-- rpjday/rpjday  7658 2013-09-20 14:42 omap2420-h4.dtb
-rw-rw-r-- rpjday/rpjday 17921 2013-09-20 14:42 omap3430-sdp.dtb
-rw-rw-r-- rpjday/rpjday 17180 2013-09-20 14:42 omap3-beagle.dtb
-rw-rw-r-- rpjday/rpjday 16890 2013-09-20 14:42 omap3-beagle-xm.dtb
-rw-rw-r-- rpjday/rpjday 17087 2013-09-20 14:42 omap3-devkit8000.dtb
-rw-rw-r-- rpjday/rpjday 15441 2013-09-20 14:42 omap3-evm.dtb
-rw-rw-r-- rpjday/rpjday 19280 2013-09-20 14:42 omap3-igep0020.dtb
-rw-rw-r-- rpjday/rpjday 18074 2013-09-20 14:42 omap3-igep0030.dtb
-rw-rw-r-- rpjday/rpjday 17390 2013-09-20 14:42 omap3-tobi.dtb
-rw-rw-r-- rpjday/rpjday 25901 2013-09-20 14:42 omap4-panda-a4.dtb
-rw-rw-r-- rpjday/rpjday 25901 2013-09-20 14:42 omap4-panda.dtb
-rw-rw-r-- rpjday/rpjday 26139 2013-09-20 14:42 omap4-panda-es.dtb
-rw-rw-r-- rpjday/rpjday 28031 2013-09-20 14:42 omap4-sdp.dtb
-rw-rw-r-- rpjday/rpjday 28031 2013-09-20 14:42 omap4-sdp-es23plus.dtb
-rw-rw-r-- rpjday/rpjday 19499 2013-09-20 14:42 omap4-var-som.dtb
-rw-rw-r-- rpjday/rpjday 25482 2013-09-20 14:42 omap5-uevm.dtb

The actual build process

version.sh

ARCH=$(uname -m)

if [ $(which nproc) ] ; then
        CORES=$(nproc)
else
        CORES=1
fi

#Debian 7 (Wheezy): git version 1.7.10.4 and later needs "--no-edit"
unset GIT_OPTS
unset GIT_NOEDIT
LC_ALL=C git help pull | grep -m 1 -e "--no-edit" >/dev/null 2>&1 && GIT_NOEDIT=1

if [ "${GIT_NOEDIT}" ] ; then
        GIT_OPTS="${GIT_OPTS} --no-edit"
fi

config="omap2plus_defconfig"

#linaro_toolchain="arm9_gcc_4_7"
#linaro_toolchain="cortex_gcc_4_6"
#linaro_toolchain="cortex_gcc_4_7"
linaro_toolchain="cortex_gcc_4_8"

#Kernel/Build
KERNEL_REL=3.12
KERNEL_TAG=${KERNEL_REL}-rc1
BUILD=bone1.2

#v3.X-rcX + upto SHA
KERNEL_SHA="dcb30e659287a6b40dafed1362532da42ec27229"

#git branch
BRANCH="am33x-v3.12"

BUILDREV=1.0
DISTRO=cross
DEBARCH=armhf

system.sh

CC=arm-poky-linux-gnueabi-
LINUX_GIT=/home/rpjday/k/git
ZRELADDR=0x80008000

patch.sh

Setting the patching command:

git="git am"

At the bottom, all the function calls to apply patches:

arm
dma_devel
general_fixes
dtc_fixes
dtc_overlays
of_fixes
pdev_fixes
mmc_fixes
dts_fixes
i2c_fixes
pinctrl_fixes
capemgr
reset
capes
lcdc_fixes
net
deassert_hard_reset
saucy

And a sample patch function:

capemgr () {
        echo "dir: capemgr"
        ${git} "${DIR}/patches/capemgr/0001-capemgr-Capemgr-makefiles-and-Kconfig-fragments.patch"
        ${git} "${DIR}/patches/capemgr/0002-capemgr-Beaglebone-capemanager.patch"
        ${git} "${DIR}/patches/capemgr/0003-capemgr-Remove-__devinit-__devexit.patch"
        ${git} "${DIR}/patches/capemgr/0004-bone-capemgr-Make-sure-cape-removal-works.patch"
        ${git} "${DIR}/patches/capemgr/0005-bone-capemgr-Fix-crash-when-trying-to-remove-non-exi.patch"
        ${git} "${DIR}/patches/capemgr/0006-bone-capemgr-Force-a-slot-to-load-unconditionally.patch"
        ${git} "${DIR}/patches/capemgr/0007-capemgr-Added-module-param-descriptions.patch"
        ${git} "${DIR}/patches/capemgr/0008-capemgr-Implement-disable-overrides-on-the-cmd-line.patch"
        ${git} "${DIR}/patches/capemgr/0009-capemgr-Implement-cape-priorities.patch"
        ${git} "${DIR}/patches/capemgr/0010-bone-capemgr-Introduce-simple-resource-tracking.patch"
        ${git} "${DIR}/patches/capemgr/0011-capemgr-Add-enable_partno-parameter.patch"
}

The relevant part of build_kernel.sh

. ${DIR}/version.sh
export LINUX_GIT

#unset FULL_REBUILD
FULL_REBUILD=1
if [ "${FULL_REBUILD}" ] ; then
        /bin/sh -e "${DIR}/scripts/git.sh" || { exit 1 ; }

        if [ "${RUN_BISECT}" ] ; then
                /bin/sh -e "${DIR}/scripts/bisect.sh" || { exit 1 ; }
        fi

        patch_kernel
        copy_defconfig
fi
if [ ! ${AUTO_BUILD} ] ; then
        make_menuconfig
fi
make_kernel
make_modules_pkg
make_firmware_pkg
if [ "x${DTBS}" != "x" ] ; then
        make_dtbs_pkg
fi




(Back to BeagleBone Black page.)

Personal tools