Android OS Forum banner

1 - 11 of 11 Posts

·
Premium Member
Joined
·
97 Posts
Discussion Starter · #1 ·
Another little script I wrote to help make working on android a little easier...i'm sure its been done before but thought I'd share & maybe help someone else out...

BBK.sh is a script I use to build the 18 kernels I compile for every release. I got tired of building a kernel, wait, grab all of the modules & the zImage and packaging them up in a zip then start another compile...it gets old quick. With this script I execute it, go play with my daughter, spend some time with the wife, etc...come back to 18 update.zip files waiting to be uploaded & shared.

There is a bit of work to initially setup this script, you have to build a config for every kernel you want to compile. Edit the script with the paths from your working environment, add your update.zip contents.

You Must Have 7zip Installed!
I used 7zip for compression, it's my preferred method.

Basics you will need in your kernel directory.

Configs- I have mine located at /arch/arm/configs/BBKconfigs/
Update.zip- Mine is at /tools/bbk/(3 folders; /system /kernel /META-INF
and of course the script... I keep that in the root directory of the kernel source.

Grab the script, open a terminal and run
Code:
wget [URL=https://raw.github.com/corcor67/BBK/master/BBK]https://raw.github.com/corcor67/BBK/master/BBK[/URL].sh
Or grab it from source here BBK Script

If you need a reference for setting this up heres my kernel source with BBK integrated Kernel

Need any help setting it up just ask, Find a bug, Please let me know about it so I can fix it!

Credits need to go out to XoomDev for help in direction and borrowed a couple lines from one of his build scripts, and cvpcs, I borrowed the line that picks up the modules from one of his build scripts.
 

·
Android Beginner
Joined
·
6 Posts
Nice script,
I do something similar, except I use a common config and sed it to build D/S kernel for ebi0 ebi1 and 2708 radios

basically I
Code:
make -j`grep 'processor' /proc/cpuinfo | wc -l` zImage<br />
find arch/arm/ -name zImage -exec install -D {} $OutDir/zImage \;<br />
INSTALL_MOD_PATH=${OutDir}/system make modules_install<br />
I also package the modules in a sqf
Code:
<br />
SquishModules ()<br />
{<br />
cd ${OutDir}/system/lib/modules<br />
wlan=`find -name wlan.ko |grep -v "\./wlan."|sed s~\./~~`<br />
if [ "`echo $wlan|grep -q wlan;echo $?`" = "0" ];<br />
then<br />
    ln -sf $wlan `basename $wlan`<br />
fi<br />
mksquashfs * ${OutDir}/modules.sqf -all-root<br />
cd $KERNEL_DIR<br />
return<br />
}<br />
little bit of extra junk in there for the wlan.ko :D
 

·
Premium Member
Joined
·
97 Posts
Discussion Starter · #7 ·
Firerat said:
Nice script,
I do something similar, except I use a common config and sed it to build D/S kernel for ebi0 ebi1 and 2708 radios

basically I
Code:
make -j`grep 'processor' /proc/cpuinfo | wc -l` zImage<br />
find arch/arm/ -name zImage -exec install -D {} $OutDir/zImage \;<br />
INSTALL_MOD_PATH=${OutDir}/system make modules_install<br />
I also package the modules in a sqf
Code:
<br />
SquishModules ()<br />
{<br />
cd ${OutDir}/system/lib/modules<br />
wlan=`find -name wlan.ko |grep -v "\./wlan."|sed s~\./~~`<br />
if [ "`echo $wlan|grep -q wlan;echo $?`" = "0" ];<br />
then<br />
    ln -sf $wlan `basename $wlan`<br />
fi<br />
mksquashfs * ${OutDir}/modules.sqf -all-root<br />
cd $KERNEL_DIR<br />
return<br />
}<br />
little bit of extra junk in there for the wlan.ko :D
Nice, might I ask why package the modules in squashfs if they are going to be installed to the given file system on the device anyways? Am I missing something?
 

·
Android Beginner
Joined
·
6 Posts
Main reason is that the G1 is very low on space, every mb counts,
i.e. not squashed @ 2.3mb vs squashed @ 0.9mb
The modules.sqf is installed to system/lib/modules/modules.sqf
and mounted by init.rc
Code:
mount squashfs [email protected]/system/lib/modules/modules.sqf /system/lib/modules ro
not really needed if you have plenty of space, but I suppose it could be considered more secure with sqf being read only

the real advantage of the above is the INSTALL_MOD_PATH= as it lets you easily install the full structure of the modules including dependency mapping etc.
 

·
Android Beginner
Joined
·
6 Posts
just noticed you pass mtdparts= on the cmdline :)

tbh I'm not sure how your recovery works, but I maintain a script for resizing mtd partitions

https://github.com/Firerat/CustomMTD/tree/unstable

this may be of interest
https://github.com/Firerat/CustomMTD/blob/unstable/MakeZips.sh
that is how I gen my updater-script, handy as you can input variables, e.g. print build date / version
( it's a little hacky tbh, I might switch to using python )

now this could also be useful to you
https://github.com/Firerat/android_build/commit/f6c0c448b27e93cc9c4c5a25b47713be4d9667e9
that is in python, but ignore that fact
it's the cMTD.sh script + the logic that gets added to the updater-script which may be of interest

like I said I don't know how your recovery works,
on the G1, MT3G , Hero , Desire, Bravo, Evo + others, we change the mtdparts of our recovery's kernel cmdline, format system cache and data (we only change the sizes of these), reboot and our partitions are different sizes :)
the AutoCMTD script then just copies this to the boot.img, thus recovery and ROM have compatible partition layouts

so you could add that logic, with a fallback to the hardcoded mtdpart cmdline

with some tinkering it may be possible that my CustomMTD script could be made compatible with the Droid 1,
omap2-nand.0: instead of msm_nand:
will have to look at it further, tbh I don't even know if you guys need or want it :D

Edit:
had a closer look, should be straight forward to fix my scripts ( for *any* device that can use mtdparts )
Off Topic here.. so I will create a thread for it when I have done the needed tweaks.
 
1 - 11 of 11 Posts
Top