Difference between revisions of "EBC Installing Kernel Source"
m (Moved to exer40)
|Line 1:||Line 1:|
Latest revision as of 19:21, 6 August 2014
Embedded Linux Class by Mark A. Yoder
Early in the class most of the exercises we will do will all run on BeagleBone Black. You'll be able to edit (via Cloud9), compile (gcc) and run all on the Bone. Later, when we start compiling the kernel or the boot loader, (U-boot) you will need to cross compile on a Linux machine and copy the results to the Beagle.
The purpose of this exercise is to install all the tools needed for compiling on your host so they will be ready when you need them.
Tip: Run this exercise using a wired connection if you can. The Ubuntu wireless driver can be finicky, and if it stops working you'll have to restart some of this.
Getting the Current Kernel
We are using the Debian kernel from Robert C. Nelson's BeagleBone Black page.
host$ git clone git://github.com/RobertCNelson/bb-kernel.git host$ cd bb-kernel host$ git tag (This shows what versions can be checked out.) host$ git checkout origin/am33x-v3.8 -b am33x-v3.8
Now build the kernel.
host$ ./build_kernel.sh + Detected build host [Ubuntu 14.04 LTS] + host: [x86_64] + git HEAD commit: [58ee2121370badd3c0a22e39f67068f242d5e068] Debian/Ubuntu/Mint: missing dependencies, please install: ----------------------------- sudo apt-get update sudo apt-get install build-essential device-tree-compiler fakeroot lzma lzop u-boot-tools libncurses5-dev:amd64 libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386 ----------------------------- * Failed dependency check
The build script is telling you what you need to install. Do the installs and rerun the build command.
Building the 3.8 Kernel
Rerun the kernel build
At some point you will see
Here you can configure the kernel, however no changes are needed at this time. Once you've exited the configuration tool the kernel will start compiling. If you have a multicore machine you will see all the cores busy. It's only a few more minutes before it is done. (About 15 minutes on an eight core machine.)
Installing the 3.8 Kernel on Your Bone
If you are running off the SD card (rather than the eMMC) installing is easy. Now install by inserting the SD to be installed on into your host machine and run:
All the needed files are copied to your SD. It is possible to have multiple kernels on the SD card. The file /boot/uEnv.txt tells which kernel to boot.
bone$ head /boot/uEnv.txt #Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0 uname_r=3.8.13-bone60 #dtb= cmdline=quiet init=/lib/systemd/systemd ##Example #cape_disable=capemgr.disable_partno=
This one is set up to boot the 3.8.13-bone60 kernel. Edit /boot/uEnv.txt if you want to change the kernel you are booting.
Updating to a new version of the kernel
When you build your kernel the files have some version information in the name. For example vmlinuz-3.16.0-rc5-bone0. The 3.16.03 is the version of the kernel and the bone0 is the version of the patches applied to the kernel for the Bone. Over time new patches will be posted. These instructions show how to get the latest version.
How do you know if you have the latest version? Run
beagle$ uname -a Linux yoder-debian-bone 3.8.13-bone60 #1 SMP Mon Jul 21 18:22:58 EDT 2014 armv7l GNU/Linux
to see what version you are running. git tag will show what versions are available. See if yours is the newest, if not continue on.
This post to the Google Group lists the steps as "You need to recheckout master, delete your old branch and re-pull". Here's how you do it.
host$ cd bb-kernel host$ git checkout master error: Your local changes to the following files would be overwritten by checkout: patches/defconfig Please, commit your changes or stash them before you can switch branches. Aborting
Hmm.... something has changed. See what it is.
host$ git diff patches/defconfig diff --git a/patches/defconfig b/patches/defconfig index d903776..3268287 100644 --- a/patches/defconfig +++ b/patches/defconfig @@ -2041,6 +2041,7 @@ CONFIG_JHD629_I2C=y # CONFIG_SERIAL_NONSTANDARD is not set # CONFIG_N_GSM is not set # CONFIG_TRACE_SINK is not set +CONFIG_LPD8806=m CONFIG_DEVKMEM=y #
It looks like some configuration setting have changed. Since we are getting a new version of the kernel, let's revert back to the previous file and try again.
host$ git checkout patches/defconfig host$ git checkout master Switched to branch 'master'
Success, now step 2.
host$ git branch -d am33x-v3.8 warning: deleting branch 'am33x-v3.8' that has been merged to 'refs/remotes/origin/am33x-v3.8', but not yet merged to HEAD. Deleted branch am33x-v3.8 (was 3fc8a73).
host$ git pull
Then start over again
host$ git checkout origin/am33x-v3.15 -b am33x-v3.15 Branch am33x-v3.15 set up to track remote branch am33x-v3.15 from origin. Switched to a new branch 'am33x-v3.15'
Your system.sh file should be unchanged, so start building
Mine took some 26 minutes on an 8 core machine.
Is needs to be updated...
These instructions came from Robert C Nelson's eewiki.net.
While we're at it, let's get the boot loader we'll be using. It takes some 40 seconds.
host$ cd ~/BeagleBoard host$ git clone git://git.denx.de/u-boot.git host$ cd u-boot/ host$ git checkout v2013.07 -b tmp
host$ wget https://raw.github.com/eewiki/u-boot-patches/master/v2013.07/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch host$ patch -p1 < 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
Now configure and build. The first time takes some 1.5 minutes. After that it's only 5 seconds or so.
host$ source ~/crossCompileEnv.sh host$ make distclean host$ make am335x_evm_config host$ make
host$ scp u-boot.img root@beagle:. beagle$ mkdir /media/BONE beagle$ mount /dev/mmcblk0p1 /media/BONE beagle$ cd /media/BONE beagle$ mv u-boot.img u-boot.img.orig # Save the working u-boot beagle$ cp ~/u-boot.img u-boot.img.new beagle$ cp u-boot.img.new u-boot.img
Once installed you are ready for u-boot work.
If your Beagle fails to boot, follow the EBC_Exercise_22_Recovering instructions to recover.
Embedded Linux Class by Mark A. Yoder