Easiest way to compile 3.17/3.19 kernel

87 17341
Edited by igorpec at Fri May 1, 2015 07:21

Use my script - it contains all necessary (default, not RT) patches (and answers to your questions):

Regarding RT. I once successfully compiled 3.4.x version - of course you need additional patches, never tried to do so on 3.19.x

Thanks, I'll try your script.  As far a my using 3.18 is was simply to find a later version that had a matching rt patch.  There is one for 3.4.107(in your signature) so I would be more than happy to build that.

I tried your scipt and built next.  I built ubuntu successfully 3.19.5--very nice.  

I wanted to confirm it works before moving on.  But now I am confused again.   If I want to make a bootable sd card from it, what do I write to the card (lots of stuff in the lib-next directory)
The faq says in the "How to create / write to SD card?" section "dd bs=1M if=filename.raw of=/dev/sdx"/  What is filename.raw?  where do I find it.

If I am already using an sd card with lubuntu 3.4.103, can I upgrade the kernal on that card from this build?  If so, what files need to be copied where.

Last question.  If I want to customize the build and use 3.18.11 and apply the rt patch, can I somehow tell the script to use my source instead of pulling down the source from the git repository?

Edited by igorpec at Sat May 2, 2015 19:44

The final output is a ZIP package, for example: Cubietruck_Ubuntu_3.6_trusty_3.19.6.zip

Inside ZIP you have:
  1. Archive:  Cubietruck_Ubuntu_3.6_trusty_3.19.6.zip
  2.     testing: Cubietruck_Ubuntu_3.6_trusty_3.19.6.raw   OK
  3.     testing: Cubietruck_Ubuntu_3.6_trusty_3.19.6.raw.asc   OK
  4.     testing: readme.txt               OK
  5.     testing: readme.txt.asc           OK
  6.     testing: imagewriter.exe          OK
  7.     testing: imagewriter.exe.asc      OK
Copy the Code

This is the file you need to write on the SD card. It's an image of the card.

Kernel 3.4.x upgrading is also depended from your Uboot so you might need to change that and/or create boot script on your boot drive / directory or by installing my kernel deb pack + converting zImage to uImage:
  1. mkimage -A arm -O linux -T kernel -C none -a "0x40008000" -e "0x40008000" -n "Linux kernel" -d /boot/zImage /boot/uImage
Copy the Code
Last question.  If I want to customize the build and use 3.18.11 and apply the rt patch, can I somehow tell the script to use my source instead of pulling down the source from the git repository?

You can switch between different git sources in configuration.sh but if you need to look for certain directory you'll need to alter a script. Take some time and look around.

You are welcome to add functionality to the script.

Hum, my bananapipro_Ubuntu_2.7_trusty_3.19.5.zip file is only 20k in size and only contains the 2 files, imagewriter.exe and bananapipro_Ubuntu_2.7_trusty_3.19.5.raw which is a files size of 0.  I guess the build must not have succeeded.  Is there log file created during build?

Edited by igorpec at Sat May 2, 2015 22:27
markwinger replied at Sat May 2, 2015 20:31
Hum, my bananapipro_Ubuntu_2.7_trusty_3.19.5.zip file is only 20k in size and only contains the 2 fi ...

Aha, yes ... something went wrong.

Update script, I have fix something today regarding kernel building.

No, no logs. It's a bash script so if you check terminal history you might find out where it breaks.

You can try first to compile kernel only and if this went O.K., start again with SOURCE_COMPILE="n", to tell script not to compile kernel but to use kernel(s) from local cache while building an image.

And rather use Bananapi not pro.  

Before you posted the last one, I tried it again.  This time the banana kind of locked up.  Looked like the zip file got generated but the os system was so messed up after work I couldn't do anything so I rebooted and it wouldn't boot.

So I re-imaged my sd card (again)(I saved a backup image just before stating this).  Just as I was about to try again I saw your post, so I downloaded the latest script version and started it again.  It has been building for 3+ hours now.  We'll see how this one goes.


I must be doing this all wrong.  I just built it both natively on the bananapro, and cross compiled on an other linux machine.

If I run script on the bananapi it seems to build but the system hangs and is unbootable after.
On my cross build my x86 ubuntu 14.4 it finishes the build and the system end up dead as well, however that one reboots ok.

SO, first I pulled the Bananapipro_Ubuntu_2.7_trusty_3.4.107.zip from the sd card of the banana (by mounting it on the x86 machine).  I moved the zip file to a windows maching and unziped the file.  Then ran the image writer binary.  But it does not recognize my usb sd card adaptor.  So I tried win32diskimager.  But it does not recognize the Bananapipro_Ubuntu_2.7_trusty_3.4.107.raw file, so I changed it to Bananapipro_Ubuntu_2.7_trusty_3.4.107.img.  I was then able to create write it to the sd card.

Now trying to boot it does the same thing as it did I rebooted the pi after the build script completed.

I then did the same thing with the image created on the x86, same thing.

The attempt to boot first says: warning bad crc, using default environment.
The says hdmi connected invalid edid data.
It seems to find usb devices.
Then scsi device 0 not available.
It seems to negotiate tcp ok gets ip address
Then says warning no boot file name using C0A816d.img
Then loading adress 0x42000000
Loading: T T T T T T T T T
Then a bunch or error about serverip not set.
config file not found
Then tries to load boot.src.uimg
loading adresssL 0x43100000
loading:T T T T T T T T T T T
retry count exceeded, trying again.

(This does not show everything since I have to manually type it)
But nothing happens after this.  It appears it does not respond to keyboard input.
What do I do now?

Edited by igorpec at Mon May 4, 2015 07:29

Hard to say, from log it looks like you are missing kernel (or boot script or board fex file) ... Building normal Banana is tested by me and it's working. I think I'll simply remove PRO since we can have one image for both boards.

I am starting to build a manual for all this, there are few relevant things at the bottom to check:
https://github.com/igorpecovnik/ ... -kernel-or-sd-image

You must have all those files. If not, there is a problem.

I successfully compiled an image for Bananapi PRO. There might be one problem which I need to recheck since I am using cached wheezy root file-system. Debian recently changed their main repos - stable become oldstable, testing becomes stable.

ADD2: I made fully clean compilation and everything went fine / BananaPRO - Wheezy - kernel 3.4.107 ... I also booted the image - working like charm. Try using some other SD card, try pre-build image first.

you need to have root access for building SD
you can build kernel without root
you need to use default sources because on others patching might not work
you need to cross compile on Ubuntu 14.04.2 LTS

Edited by igorpec at Mon May 4, 2015 11:59


I created a movie of compilation. Real time, some narration and on-screen info. Quickly made, full length (30min).

It might be useful as a reference.

You have to log in before you can reply Login | Sign Up

Points Rules