[dev] fastboot kernel + patches - Milestone XT720 Android Development

As we are able to fastboot, it make sense to have choice
As it is done now. Normal booting using 2ndinit
PC booting, not using 2ndinit (as the proper files can be inside the boot.img)
The drawback of 2. are obvious. if battery die, etc... but then 1. can be used. so i think 2. will have spread usage.
The pros of 2. are obvious too (no 2nd init, kernel can be modifed e.g. swap etc...) and not so obvious .... But it can be tested / used without compromising the phone usage (e.g. a plain reboot will go to 1.).
Having that in mind, fjfalcon your boot.img are working. (mine doesn't, mioze7ae`s too, there is some old post in some thread about that, but let's stick to this one).
So could you be so kind to share how to build usable (e.g. working) boot.img ?
Then using mio`s knowledge of preparing fastboot openrecovery it will be easy to implement inits, which don't rely on 2ndinit.
And then the real work can begin . Patching the kernel
I have found good starting point of patches:
http://omappedia.org/wiki/Patches_being_done_on_2.6.29_Android_kernel_not_yet_submitted_upstream
had checked some of them (there are not in our moto-compiled kernel), and most of them seems promising...
Of-course this will be just the beginning.
We can try to "patch" discovered goodies (via modules) to the moto-kernel
we can try to use newer version of the kernel (using 2./
etc...

i used motoroi devtree from opensource and kernel.tar.gz from 2.1.
Also i just patched some files... and that should be all.
I think when i get free time i will post our kernel to git.
But, idea about move 2ndinit away is back...
Much better idea will be usyng 2ndinit both times, with if/else statements.
Also, i'am almost done to building uart for kernel testing. I hope it will work.
I pushed mine kernel to https://github.com/CyanogenModXT720/android_kernel with xt720 branch. When it will be finished it will appear.
I need to run, good luck.
I also using command to build: make -j8 -f kernel/kernel.mk BLD_CONF=mine3

10x,
when i build modules, i had issue... they just did not load to the kernel... it turns out that my toolchain was not the right one... using another fixed the modules loading....
about 2ndinit we can brainstorm it later (i have mind floating around about the location of init_prep_keypad.sh)
i am curious about uart, where should we hook the wires :?)
i am curious more because of that commit comment
commit 9638a7f382b7ac1629cfa431bd32790362e3af70
Author: Muhammed Siju <[email protected]>
Date: Thu Jun 17 11:02:09 2010 +0530
IKSTR-401.Disable TV out accessory detection.
TV out code is currently enabled in kernel.So some 3.5mm accessory is getting detected as TV cable.However the TV out service APK was removed from the build.
This causes issues like accessory removal not getting detected and TTY cable failures.This is workaround to treat high impedence cables as headset without mic instead
Click to expand...
Click to collapse
i am not sure how to interpret the bolded one (and i am afraid to hope )

http://xt720.ru/foto mine uart.
Sent from my Milestone XT720 using xda premium

stock recovery adb ?
i just take a look at
cg35.img (e.g. boot image, when boot normaly) and
cg47.img (e.g. boot image, when booted in stock recovery)
equals: kernel
differs: kernel cmdline, and the ramdisk.
in the normal boot.img there is no cmdline, in the recovery one there is
Code:
console=ttyS2,115200n8 rw [email protected] init=/init ip=off motobldlabel=none mtdparts=omap2-nand.0:128k(mbmloader),640k(mbm),640k(mbmbackup),384k(bploader),384k(cdt),1536k(pds),384k(lbl),384k(lbl_backup),384k(cid),1536k(sp),384k(devtree),640k(logo),384k(misc),3584k(boot),3840k(bpsw),4608k(recovery),8960k(cdrom),384k(unused0),204416k(system),384k(unused1),106m(cache),177280k(userdata),1536k(cust),384k(unused2),2m(kpanic),512k(rsv)
kernel cmdline is curious to me, and will need more investigate, mostly because it is present in the normal boot too. (have to compare to the recovery one). I suppose, that the bootloader passes it to the normal boot ...
about initial ramdisk there is something interesting in it
mainly the adbd
service is defined in init.rc
Code:
service adbd /sbin/adbd recovery
on property:persist.service.adb.enable=1
start adbd
on property:persist.service.adb.enable=0
stop adbd
but disabled in default.prop
Code:
persist.service.adb.enable=0
as we are able to fastboot, it will be very interesting to see what can be done within the recovery shell (just have to modify default.prop using unpackbootimg and mkbootimg )
Personally i plan to do it near future (e.g. have time, did not test long term stability etc....)

recovery.img afaik also signed.

peshovec said:
i just take a look at
cg35.img (e.g. boot image, when boot normaly) and
cg47.img (e.g. boot image, when booted in stock recovery)
equals: kernel
differs: kernel cmdline, and the ramdisk.
in the normal boot.img there is no cmdline, in the recovery one there is
Code:
console=ttyS2,115200n8 rw [email protected] init=/init ip=off motobldlabel=none mtdparts=omap2-nand.0:128k(mbmloader),640k(mbm),640k(mbmbackup),384k(bploader),384k(cdt),1536k(pds),384k(lbl),384k(lbl_backup),384k(cid),1536k(sp),384k(devtree),640k(logo),384k(misc),3584k(boot),3840k(bpsw),4608k(recovery),8960k(cdrom),384k(unused0),204416k(system),384k(unused1),106m(cache),177280k(userdata),1536k(cust),384k(unused2),2m(kpanic),512k(rsv)
kernel cmdline is curious to me, and will need more investigate, mostly because it is present in the normal boot too. (have to compare to the recovery one). I suppose, that the bootloader passes it to the normal boot ...
Click to expand...
Click to collapse
Normal boot ignores cmdline and uses atags struct from cdt.bin table (CG31) instead. Recovery boot ignores atags struct and uses cmdline from recovery.img. This is why:
xt720mod.sbf uses normal Milestone XT720 boot.img (UK) but has Motoroi partition structure and recovery--the cmdline inside boot.img is ignored--partition locations come from CDT. If the normal boot used cmdline, xt720mod.sbf could never work using the Milestone XT720 kernel--we'd have to use the Motoroi kernel.
Normal boot has boot.img read-only and missing bpsw etc, but booting into stock recovery has all of the missing ones and they are read/write (because recovery.img uses the cmdline instead of atags)
Tangentially, there's also the devtree (CG61). For some reason the vulnerable Motoroi recovery.img used in xt720mod.sbf doesn't work with Milestone XT720 devtree {=stuck at (M)} *but* Milestone XT720 boot.img does work with Motoroi devtree ... sensorfix.ko tries to correct for some of the Milestone/Motoroi devtree differences (most of the devtree data is actually identical--just some subtle differences), but I haven't gotten to all of them yet (sensorfix.ko at the moment just corrects the accelerator axis mapping--I suspect there's something weird going on with the light sensor, too but I haven't figured that out yet).
fjfalcon said:
recovery.img afaik also signed.
Click to expand...
Click to collapse
I think he's talking about making a fastboot recovery. That's also what I did here: http://forum.xda-developers.com/archive/index.php/t-1477752.html and http://forum.xda-developers.com/showthread.php?p=23965193#post23965193. I thought about putting in a different recovery at first--but the more I thought about it, I couldn't find any reason to justify using a recovery different from openrecovery--just about anything you'd want to do in a custom recovery requires a sdcard to be present and openrecovery is already field-tested on XT720. I can't remember if fastbooted recovery uses the atags or cmdline... I don't think I ever figured out if the difference is in the bootloader or in the kernels.
Edit: when I created the fastboot-openrecovery.img I used the kernel from normal boot.img and used a custom ramdisk that was derived from recovery.img. And I didn't add any command line:
Code:
rm ramdisk.cpio.gz
cd ramdisk/
find . | cpio -o -H newc | gzip > ../ramdisk.cpio.gz
cd ..
rm openrecovery-fastboot.img
mkbootimg \
--kernel stock-boot.img-zImage \
--ramdisk ramdisk.cpio.gz \
--cmdline '' \
--base 10000000 \
--pagesize 00000800 \
-o openrecovery-fastboot.img
I can't remember if I tried using the recovery.img kernel or if I just decided not to risk that the recovery.img kernel wasn't flexible enough--I wanted the same fastboot recovery to work on both stock.sbf's and xt720mod.sbf... i.e. I explicitly wanted to use the atags data in cdt.bin that will always match the installed sbf rather than a static command line... and the mtdhack.ko I've made for XT720 is carefully crafted to work on both Milestone XT720 and Motoroi sbfs by relying on atags... so... I doubt I ever pursued using the recovery kernel.

Normal boot ignores cmdline and uses atags struct from cdt.bin table (CG31) instead. Recovery boot ignores atags struct and uses cmdline from recovery.img.
Click to expand...
Click to collapse
10x
will have to play using simultaneously fastboot and pressing the buttons, which screamed "stock recovery" just to check if we can benefit from cmdline somehow..
however i tried to automate the boot.img repack.
https://github.com/CyanogenModXT720/fastboot-repack
the default generated image (boot-custom.img) should work as test proofing
(will use the init*rc from my testing build, and will avoid 2ndint), the kernel is still stock (yet).
When i will find enough time to test, will start playing with different kernel (mainly the above mentioned patches )
p.s. yes i know fastbooting is annoying, but if there are charger near where, it will be perfectly usable for a long time...

One thing I've wanted to try is creating a basically stock kernel+compcache/ramz. Nadlabak says it's very helpful on A853 (he has a motorola development grade A853 that has high-security mode disabled so he can flash anything). The idea is you could fastboot to have a ram boost without using a swap partition (ramz does swap into a compressed region of ram).

Nadlabak says it's very helpful on A853 (he has a motorola development grade A853 that has high-security mode disabled so he can flash anything)
Click to expand...
Click to collapse
interesting, i have read something like that somewhere, but it was stated this is just rumor....
the approach with starting with stock kernel, then just enable some useful options (like swap), then start observing patches fits my vision too

peshovec said:
i tried to automate the boot.img repack.
https://github.com/CyanogenModXT720/fastboot-repack
Click to expand...
Click to collapse
I was just reading through the repository and saw the comment about replacing /init with one that handles parameters properly for insmod. You can also replace /init just before 2nd-init for the hijacked boot (2nd-init kills* /init and it gets restarted fresh). nadlabak's been doing this to add udev support on a853. I think fjfalcon's done that, too iirc.
*not really kill, it causes the original /init to exec /init

it can be done in the squisher...
# Rootfs stuff
mkdir -p $REPACK/ota/system/etc/rootfs/sbin
cp $OUT/root/sbin/adbd $REPACK/ota/system/etc/rootfs/sbin/adbd
cp $OUT/root/init $REPACK/ota/system/etc/rootfs/init
Click to expand...
Click to collapse
(nadlabak "Replaces" init and adbd)
then have to set permission in sh_hijack ...
probably will do that sometime in the future (if we had for example usb otg, probably we should have benefit of udev, but right now, it is just the feeling to be on the edge/latest and greatest ......e.g. not so high priority )

ok, run some tests
successful boot is achieved after
Code:
export CROSS_COMPILE=.......cyano/nadlabak/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
will try to attach the .config (swap enabled and the zImage
(attached in kernel_plus_config.tar )
of course i had some troubles mainly because the stock modules, are build with gcc 4.4.0 . Before seeing that, i was using different prebuilt toolchains ... and the kernel was tainted, paniced etc.....
using the above right now....
Code:
<6>[ 0.000000] Initializing cgroup subsys cpu
<5>[ 0.000000] Linux version 2.6.29-omap1 ([email protected]) (gcc version 4.4.0 (GCC) ) #2 PREEMPT Tue Apr 24 10:17:21 EEST 2012
/system/xbin/dd if=/dev/zero of=/sdcard/swap.img bs=1M count=50
mkswap /sdcard/swap.img
swapon /sdcard/swap.img
~ # free
total used free shared buffers
Mem: 230256 219232 11024 0 212
-/+ buffers: 219020 11236
Swap: 51192 1700 49492
So Mio, you can now try the swapz/
i will play with other options (moto has at least hdmi and camera driver, which are not present in later version of the omap 2.6.29 ... so i will try to merge

the gsm radio is very easy to break ...
i discovered, that if some module did not load 100% clean, the phone will lock/reboot ....
Then i start playing around that. Did not load any modules, and when load the modules about radio i discovered the title (e.g. still no radio, but phone lock/reboot again....)
So till now, my best combination (which i plan to test for a long (few days atleast) period) is:
plain stock + swap + 250, 500, 600, 800 Mhz (the default were always strange to me 250, 500, 550, 720 )
Also till now, i was not able to compile zram module
p.s. btw, i hope everybody knows, that actually there is no need for a separate swap partition,for somebody to use the swap, right ?

linkdriver
the following commit is very interesting to me ...
Code:
commit 1b533b8c037ae496a329e8e6c5e793232310b559
Author: Wei-Yu-Neng Loic <[email protected]>
Date: Tue Jun 9 17:48:14 2009 +0200
Add netmux_linkdriver and compile the netmux drivers in modules and not static
I wonder if before this commit, the radio was working?
Also this commit adds some harcoded configs ...
Code:
drivers/misc/netmux_linkdriver/usb/ModKconfig
....
+title = netmux_linkdriver
+obj_tree =
+depends =
+kconfig = Kconfig
+config = .config
+autoconf_header = modkconfig/autoconf.h
+config_header = modkconfig/config.h
.....
the autoconf.h and config.h are basically the kernel config ...
I suspect, that if we change the kernel config, in such way, that the modules will not be able to load, then we have to modify the modkonfig headers too...

I have created a kernel that has ramz and the ramzswap module for testing/experimentation.
Built from compcache-0.6.2 with the notify patches applied
Kernel source: ramz branch @ https://github.com/CyanogenModXT720/android_kernel
Rough notes on how to make your own bootz.img:
Compile using 4.4.0 toolchain from the android NDK version 5c. Something like:
Code:
export ARCH=arm
export CROSS_COMPILE=path/to/android-ndk-r5c/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi-
export KERNEL_DIR=path/to/android_kernel
cd $KERNEL_DIR
make str_ramz_defconfig
make
Create bootz.img something like this:
Code:
mkbootimg \
--kernel path/to/android_kernel/arch/arm/boot/zImage \
--ramdisk path/to/uk-boot.img-ramdisk.gz \
--cmdline "" \
--base 10000000 \
--pagesize 00000800 \
-o bootz.img
Build the ramzswap.ko something like this:
Code:
cd compcache-0.6.2
# edit compat.h as described in "HIGHLY RECOMMENDED" section of README to enable use of the notify patch
make -C $KERNEL_DIR SUBDIRS=`pwd` modules
The kernel config I used is modified from str_defconfig, added as str_ramz_config (basically add swap, lzo_compress/lzo_decompress, /proc/config.gz) Link to config: https://github.com/CyanogenModXT720/android_kernel/blob/ramz/arch/arm/configs/str_ramz_defconfig
I haven't figured out how to cross-compile the rzscontrol yet so the CM compcache script doesn't work. OG Droid builds it as part of CM, so we can probably snag theirs.
Example of manual use (after fastboot boot bootz.img):
Code:
# Create 20MB zram
insmod ramzswap num_devices=1 disksize_kb=20480
# Enable swap on the new ramzswap0 device
swapon /dev/block/ramzswap0
# Set swappiness
echo 100 > /proc/sys/vm/swappiness
Be sure to check if your sdcard has a swap partition, you may want to disable the script that turns on swap there--it's usually in /system/etc/init.d/ with the name "swap" in the filename. I'm not sure how android sets priorities on different swap devices, the usual linux command isn't supported.
I have no idea what size of ramz people use. sholes (OG Droid) has compcache support in their CM7, so I'll probably look there next.
I've only tested this on a custom-tweaked version of peshovec's Apr 4 CM7 build running on xt720mod.sbf--I don't expect problems, but ymmv and you should be very aware of what the various /system/etc/init.d scripts (and possibly /system/etc/rootfs/*.rc) are up to.
The config can also be obtained from /proc/config.gz -- I propose we "insist" that custom kernels use that feature and then shell scripts can easily test existence of /proc/config.gz to detect custom kernels. On the other hand, that file consumes 16k...

Mioze7Ae said:
[*]Built from compcache-0.6.2 with the notify patches applied
Click to expand...
Click to collapse
hehe, that explain my troubles with compiling
i had used https://github.com/a853/a853_compcache
now tried the same setup with the old plain 0.6.2 and it compiles ...

Sweet. On peshovec's CM7 with a 40mb ramzswap, I'm able to keep XDA, HackerNews, Diode and Gh4a all running and switch between any of them instantly (also note I was already very happy with memory use on peshovec's CM7 without ramzswap). Probably not big news for people who've been using a swap partition, but compcache/ramzswap is swap without a swap partition--so no sdcard chewing. My perspective is: phone is perfectly usable without ramz if a reboot happens, but if I keep it charged I get some extra boost. For now, this is what I'm using as /system/etc/init.d/02ramz:
Code:
#!/system/xbin/busybox sh
# Don't do anything unless custom boot.img
[ -f /proc/config.gz ] || exit
# Create 40MB zram
/system/xbin/insmod /system/lib/modules/ramzswap.ko num_devices=1 disksize_kb=40960
/system/xbin/swapon /dev/block/ramzswap0
echo 100 > /proc/sys/vm/swappiness

hopefully in some days i will gather enough information, about how much exactly memory we are missing...
preliminary results are:
about 25 swap (pure one) needed,
-
about 5 which can be recovered with pkill at 4am (hello cron)
equal to about 20 MB more ram needed for full pleasure
This number can be used for calculating the percentage of ramz (which obviously is a trade between more RAM and faster RAM )

Doh! The device is automatically created as /dev/block/ramzswap0 on android not /dev/ramzswap0. I've updated my posts above appropriately.

Related

[Q] custom kernel with initrd?

Hi everyone, I'm looking for a little help in booting a custom linux kernel on the Acer Iconia a500 with an initrd (not an initramfs, and the distinction is important). I'm working on building an ARM version of the Porteus Linux OS, which is a slackware-based linux-live distribution.
I have compiled a custom kernel based on sp3_dev's 2.6.38 kernel sources, added a patch for aufs, compiled in support for XZ compression, squashfs and a few other things, and I can get this system to boot into a functional GUI using an initramfs that I've embedded into the kernel (it looks like this is how other folks are using a ramdisk). However, Porteus typically uses an initrd to set up the live filesystem, and moving to an initramfs will require rewriting a number of scripts and maintaining them separately from the x86 tree. I have tried booting with an initrd in a number of ways, and have failed each time and google/xda searches have not yielded a solution. I've packaged my zImage and initrd.xz with mkbootimg and flashed it to mmcblk0p1 to dual boot linux with android, and tried hard-coding a number of calls for initrd in the kernel cmdline, such as, "initrd=/dev/mmcblk0p1/intird.xz", "initrd=/initrd.xz", "initrd=0x11000000,16M" all to no avail.
So, my question is this: is there any way to get the kernel to load an initrd (which is not embedded in the kernel itself) without replacing the stock bootloader? I'd prefer to keep the installation easy and low-risk for other users.
Thanks for your time, and many thanks to the devs who have been contributing to getting native Linux on the Iconia! Your threads have been an invaluable resource.
-Ahau
And I am trying making something similar,but I'm want make initrd who boots from internal storage like tf101 kernel, and I can't make kernel working with initrd , I'm using netham's initrd source and guide http://forum.xda-developers.com/showthread.php?t=1158260&page=24 , when I compiled the kernel and make boot.img then it says - kernel panic, can't find initrd... . My question is - what format initrd should be .cpio, .img, .gz... if it doesn't matter, then what kernel command should be in boot options to kernel .config. sorry for bad English.
Thanks, Tautvaldas. If you are following netham's instructions, you are using an initramfs that is built into the kernel. You can either specify a cpio/gzipped archive in the kernel config (CONFIG_INITRAMFS_SOURCE) or point it to a directory containing the files and subdirectories you want inside your initramfs and the compiler will cpio and compress it at build time. I use the second approach as it saves the steps involved in creating the cpio image and gzipping it. Once you've done this, I don't believe you need to specify an initrd in CONFIG_CMDLINE. The initramfs is then contained inside zImage, so when you generate the new "recovery.img" with mkbootimg, you still point -initrd to /dev/zero.
To clarify, an initramfs (probably named something like initrd.gz) is both a cpio archive and gzip compressed. Google 'initrd cpio' for more on how to extract and compress them.
HTH
worked-around
Well, I didn't sort out how to load an initrd directly, but a friend did find a script for me that can be used in an initramfs and make it look (and work) like an initrd. In case anyone else runs into this issue, here's the relevant portions of the script:
# Build a ramdisk and copy ourselves over, so we look like an initrd
mke2fs -m 0 /dev/ram0 >/dev/null 2>&1
mount -t ext4 /dev/ram0 /mnt
for item in /*; do [ "$item" != "/mnt" ] && cp -a $item /mnt; done
mkdir /mnt/mnt
# Transfer control to linuxrc as an initrd would
exec switch_root -c /dev/console /mnt /linuxrc $*

uboot bootloader - for the true multiboot

Hi! I have ported the u-boot bootloader to Samsung Galaxy S2.
What's this for
This is for allowing true multi-boot on our device. Since Samsung combined boot and recovery partitions into a single one, it is impossible to use different kernels for boot and recovery, thus it is impossible to, say, dual-boot android and ubuntu with different kernels without reflashing.
Is it safe?
Should be not more dangerous than flashing a new kernel. We're not overwriting the original Secondary Bootloader (SBL), we're chainloading from it.
Mind that currently only european galaxy s2 (with max8997 pmic and wvga screen) is supported.
How to install and test
Download the precompiled u-boot.bin http://www.mediafire.com/?ovd6asa90de4ifn
Download the uImage (3.0.30 cm9 image) http://www.mediafire.com/?y3g1e463rzas9vm
flash the uboot with heimdall
Code:
heimdall flash --kernel u-boot.bin
we abuse the unused-by-default recovery partition for keeping the linux kernel
Code:
heimdall flash --recovery uImage
You may put a custom uImage and u-boot boot script to the emmc ums partition (the 12G one). Put them to
Code:
boot/vmlinux.uimg
boot/boot.scr.uimg
accordingly. vmlinux.uimg is just a renamed uImage. Take care - for this 'custom' kernel the cmdline is different from android one, it tells the kernel to boot off microsd partition 2. If you want to use custom kernels, please hardcode the command line in kernel config when compiling. To boot the 'custom' kernel you need to hold the home key while turning on the device.
A practical example - booting Siyah kernel from emmc
Get boot.scr.uimg http://www.mediafire.com/?k4s2ldudk8g9u4e
Get siyah uImage http://www.mediafire.com/?w57aqn7jig4ij5k
copy them to the device
Code:
adb shell mkdir /sdcard/boot
adb push boot.scr.uimg /sdcard/boot
mv uImage android.uimg
adb push android.uimg /sdcard/boot
For devs - How to compile
Grab u-boot source @ my gitorious, branch is i9100_tracking
https://gitorious.org/i9100-proper-linux/i9100-uboot
for compiling uboot:
export PATH, CROSS_COMPILE and ARCH variables and do sth like this
Code:
make galaxys2_config
make -j6 galaxys2
for compiling uImage either add uboot/tools to PATH and use "make uImage" target in kernel. Or, wrap the existing zImage into uImage
Code:
u-boot/tools/mkimage -A arm -O linux -T kernel -C none -a 0x40008000 -e 0x40008000 -n Linux-android-sucks -d cm9_kernel/arch/arm/boot/zImage uImage
for compiling boot script, use the following command. Please remember that you need to use a different loadaddr not to overwrite the boto script
Code:
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "android" -d boot.cmd boot.scr.uimg
Here is an example boot script
Code:
setenv android_cmd loglevel=4 console=ram sec_debug.enable=0 sec_debug.enable_user=0 [email protected] s3cfb.bootloaderfb=0x5ec00000 ld9040.get_lcdtype=0x2 consoleblank=0 lpj=3981312 vmalloc=144m;
if test $sgs2_bootmode_val -eq 1; then
setenv android_cmd ${android_cmd} bootmode=2;
fi
setenv bootargs ${android_cmd}
setenv devtype mmc
setenv devnum 0
setenv kernel_part 0xb
setenv kernel_name /boot/android.uimg
setenv loadaddr 0x4EF08000
echo Load Address:${loadaddr};
echo Cmdline:${bootargs};
if fatload ${devtype} ${devnum}:${kernel_part} ${loadaddr} ${kernel_name}; then
bootm ${loadaddr};
exit 0;
elif ext2load ${devtype} ${devnum}:${kernel_part} ${loadaddr} ${kernel_name}; then
bootm ${loadaddr};
exit 0;
else
echo failed to boot custom image;
fi
TODO
Add lcd and board revision detection to build a proper command line
Add support for other galaxy s2 and Note revisions - depending on the user feedback and testing volunteers
Fix MTYPE (linux kernel machine type). Samsung uses the same mtype for all boards which is clearly wrong. In my linaro-based kernel I'm using a new mtype which I registered for I9100. Since CM9 kernels enable more than one board, booting will fail if mtype is wrong. So, for now, uboot is using samsung's mtype, and I want to find a way to switch it in runtime.
Add galaxys2 modem support to fsogsmd or ofono, install Mer or ubuntu and get rid of the java-ridden crapware named Android
Great job! Any chance on getting it as a .tar ODIN flashable file? I could make a guide to help newbies use the uboot bl as well when it's developed further
Using both CM9 Kernel for CM9 and Siyah for Resurrection Remix ICS is a great sight!
looks promising. great going
dual boot ... mean two different roms on sgs2 like siyah kernel???
Deleted
I am unsure about multiple android kernels - need to make some boot scripts to test. My initial aim was to support both android and native Ubuntu. I will tell you about dual-booting android, but I need time for testing
How about using my code in board_unit()? Seems to me like the only way. I don't see how it can be done without modifying uboot.
Sent from my GT-I9100 using XDA
MemoryController said:
How about using my code in board_unit()? Seems to me like the only way. I don't see how it can be done without modifying uboot.
Sent from my GT-I9100 using XDA
Click to expand...
Click to collapse
Please take a look at my git, the boot key detection is done in a very similiar way. I would suppose that we can put any commands in the uboot script file and can boot custom android kernels with that
About the mtype I mean. Doesn't it need to be set in board_init ()? I will checkout the git later.
Sent from my GT-I9100 using XDA
need to think of mtype..
anyway, updated the first post with the instructions how to boot siyah from emmc. now we can multi-boot android kernels
With the SGS3 and this,I think my SGS2 will just replace my fried old PC and get hooked to my TV.Nice job man.Really nice.
cool
Would love it on international gs2 variant
Sent from my GT-I9100 using Tapatalk 2
Awesome work. But I want to know if, at the actual state, it could handle the true multiboot between android and linux's distros
Inviato dal mio GT-I9100 con Tapatalk 2
Why is this posted in the general thread ? Shouldn't it be moved to Original Development?
hello
I know you state this will only work on the European version but just wanted to confirm this would not work on att i777. There was so many variants i was not sure.
I think i have the max8997 pmic and wvga screen but not positive
This is geat news. Just wondering why this is not buzzing as big news. Native booting linux, who wouldn't apreciate that. Especially if the telephony part got worked out, could hardly see much point in booting to android. Good work.
Uboot is extremely useful, and native debian is awesome, not that chroot crap
Sent from my GT-I9100 running CM10
Could anyone write a step by step tutorial. I am a little confused as to how to and what to do. Do I loe my siyah kernel? Or does it dual boot my dual boot kernel, lol.
Sent from my GT-I9100 using Tapatalk 2
This is awesome.. ¿any detailed tutorial, please?

[UTIL] unmkbootimg

I've put together a tool undoing what mkbootimg does. There are other tools splitting a boot image into the
kernel and root file system, but I didn't find any extracting the command line and base addresses, so I wrote this one.
It handles plain boot images as well as boot images embedded in larger filer, e.g. update-images.
Code:
$ unmkbootimg boot.img
Kernel size 2419636
Kernel address 0x20008000
Ramdisk size 152656
Ramdisk address 0x21000000
Secondary size 0
Secondary address 0x20f00000
Kernel tags address 0x20000100
Flash page size 2048
Board name is ""
Command line "no_console_suspend=1"
This image is built using standard mkbootimg
Extracting kernel to file zImage ...
Extracting root filesystem to file initramfs.cpio.gz ...
All done.
---------------
To recompile this image, use:
mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x20000000 --cmdline 'no_console_suspend=1' -o new_boot.img
---------------
$ ls -l
totalt 5044
-rw-r--r-- 1 kuisma kuisma 2576384 9 sep 09.44 boot.img
-rw-r--r-- 1 kuisma kuisma 152656 9 sep 09.44 initramfs.cpio.gz
-rw-r--r-- 1 kuisma kuisma 2419636 9 sep 09.44 zImage
Version 1.2 - Support for embedded boot images
Version 1.1 - Support for non-standard mkbootimg images.
Version 1.0 - Initial release.
Including a gziped binary for GNU/Linux in this post (32 bit, linked static). Download, unzip, make sure it is executable.
If running on a 64bit machine, make sure you've got the ia32-libs installed to be able to run 32bit binaries.
Great Tool........ i Always use it..........Thanks For Share
I've updated unmkbootimg. Now it detects and warns if the boot.img is built using a non-standard mkbootimg, and tells you how to patch it.
$ unmkbootimg samsung-boot.img
Kernel size 4905092
Kernel address 0x40408000
Ramdisk size 893395
Ramdisk address 0x41800000
Secondary size 0
Secondary address 0x41300000
Kernel tags address 0x40400100
Flash page size 2048
Board name is ""
Command line "androidboot.hardware=qcom msm_watchdog.appsbark=0 msm_watchdog.enable=1 loglevel=4"
*** WARNING ****
This image is built using NON-standard mkbootimg!
OFF_RAMDISK_ADDR is 0x01400000
Please modify mkbootimg.c using the above values to build your image.
****************
Extracting kernel to file zImage ...
Extracting root filesystem to file initramfs.cpio.gz ...
All done.
---------------
To recompile this image, use:
mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x40400000 --cmdline 'androidboot.hardware=qcom msm_watchdog.appsbark=0 msm_watchdog.enable=1 loglevel=4' -o new_boot.img
---------------
Click to expand...
Click to collapse
Thank you for your tool my friend
Though I have one question regarding this:
--cmdline 'no_console_suspend=1'
Click to expand...
Click to collapse
When I attempt to compile kernel from source, Sony said in the read me file that memory layout and other stuff are passed to kernel via cmdline. I do that just like it's written in the cmdline I quoted?! because I want to use the latest kernel source with an existing zRam but i'm unable to make the newly compiled kernel to boot because I am unable to pass arguments via cmdline on boot :crying:
DeepUnknown said:
Thank you for your tool my friend
Though I have one question regarding this:
When I attempt to compile kernel from source, Sony said in the read me file that memory layout and other stuff are passed to kernel via cmdline. I do that just like it's written in the cmdline I quoted?! because I want to use the latest kernel source with an existing zRam but i'm unable to make the newly compiled kernel to boot because I am unable to pass arguments via cmdline on boot :crying:
Click to expand...
Click to collapse
As far as I know, Sony passes all important parameters via kernel ATAGs, not command line.
kuisma said:
As far as I know, Sony passes all important parameters via kernel ATAGs, not command line.
Click to expand...
Click to collapse
I'm sorry I wasn't clear in the previous comment, here is what Sony mentioned:
In the official SW the following command line arguments are given
to the kernel:
cachepolicy=writealloc
noinitrd
init=init
board_id=1
logo.nologo
root=/dev/ram0
rw
rootwait
console=ttyAMA2,115200n8
androidboot.console=ttyAMA2
androidboot.hardware=st-ericsson
<memory layout>
mpcore_wdt.mpcore_margin=359
Click to expand...
Click to collapse
I'm sorry I went out of subject but I was using tools like yours to get zRam from other boot.img file.
Very nice tool, thanks for sharing.
unmkbootimg as of version 1.2 now supports embedded boot images, e.g. a boot image embedded deep in an update.img file.
$ unmkbootimg update.img
unmkbootimg version 1.2 - Mikael Q Kuisma <[email protected]>
File update.img not a plain boot image, seeking for embedded image ... found!
Kernel size 8073252
Kernel address 0x60408000
Ramdisk size 6380372
Ramdisk address 0x62000000
Secondary size 0
Secondary address 0x60f00000
Kernel tags address 0x60088000
Flash page size 16384
Board name is ""
Command line ""
*** WARNING ****
This image is built using NON-standard mkbootimg!
OFF_KERNEL_ADDR is 0x00380100
OFF_RAMDISK_ADDR is 0x01F78100
OFF_SECOND_ADDR is 0x00E78100
Please modify mkbootimg.c using the above values to build your image.
****************
Extracting kernel to file zImage ...
Extracting root filesystem to file initramfs.cpio.gz ...
All done.
---------------
To recompile this image, use:
mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x60087f00 --pagesize 16384 -o new_boot.img
---------------
$ ls
initramfs.cpio.gz update.img zImage
$
Click to expand...
Click to collapse
kuisma said:
unmkbootimg as of version 1.2 now supports embedded boot images, e.g. a boot image embedded deep in an update.img file.
Click to expand...
Click to collapse
Thanks for the update, very cool feature.
Can not extract zImage?
Could you check why I Can not extract zImage from this Kernel:
http://forum.xda-developers.com/showpost.php?p=37909023&postcount=56
mafamafa said:
Could you check why I Can not extract zImage from this Kernel:
http://forum.xda-developers.com/showpost.php?p=37909023&postcount=56
Click to expand...
Click to collapse
It's because it's not an Android boot image, but a Rockchip specific kernel image file.
Hi, could you please post the source here or upload in github or similar and provide the link. That will be much better.
Sent from my Amazon Kindle Fire HD using xda app-developers app
jeevas.v said:
Hi, could you please post the source here or upload in github or similar and provide the link. That will be much better.
Click to expand...
Click to collapse
Why? It's a trivial hack, and if you're a programmer, you'll put one together in minutes anyway.
So, no.
That is very bad and unethical. It is not a question of I or somebody can do it. Even it violates many things by saying no. What a pathetic situation.
Sent from my Amazon Kindle Fire HD using xda app-developers app
jeevas.v said:
That is very bad and unethical. It is not a question of I or somebody can do it. Even it violates many things by saying no. What a pathetic situation.
Click to expand...
Click to collapse
Say what? I'm providing the community a useful software for free - and you blame me for being unethical? :laugh:
I'm saying that you are using Foss as you like and hesitating to publish even a trivial change that you made. How can the community trust your binaries unless they don't have the source. What kind of mindset is that? Have you ever read GPL?
What do you think you are doing? Social service the Microsoft way? What a joke!
Sent from my Amazon Kindle Fire HD using xda app-developers app
jeevas.v said:
I'm saying that you are using Foss as you like and hesitating to publish even a trivial change that you made. How can the community trust your binaries unless they don't have the source. What kind of mindset is that? Have you ever read GPL?
What do you think you are doing? Social service the Microsoft way? What a joke!
Click to expand...
Click to collapse
GPL? My code is written from scratch, and is not a subject of GPL whatsoever.
You, my friend, are making a fool of your self. Please, don't let me hinder you.
I am trying to spread the awareness against the closed source behaviour and I hope I achieved that in whatever miniscule way.
I don't care about your binary or code but thought of asking you to know if you are intentionally not giving the source by giving just the 32bit binaries. Anyway so now everyone knows...
Sent from my Amazon Kindle Fire HD using xda app-developers app
how to build Rockchip specific kernel image file?
kuisma said:
It's because it's not an Android boot image, but a Rockchip specific kernel image file.
Click to expand...
Click to collapse
Can you tell how to build Rockchip specific kernel image file - or where to loog for that information?
mafamafa said:
Can you tell how to build Rockchip specific kernel image file - or where to look for that information?
Click to expand...
Click to collapse
I have no idea whatsoever how Rocketchip manages its boot images.

[B928] OC kernel 0.1 [one-hit wonder]

This will not be worked on any longer thanks to Huawei's incompetence. I'm glad my main phone isn't by them. I leave my 0.2 diff attached (which did make my phone faster FWIW - and has fsync() control. Not of use to me, but people who use a modified libsqlite would like it...). Feel free to apply it and see if you can somehow fix dhd.ko loading.
Hi,
Not one for names, so this shall be known as "OC kernel" This is built from the ICS U8800pro source that Huawei put out.
Install at your own risk; I take no responsibilty for any damage that may occur through the usage of this kernel.
Features:
ADB as root
Overclocking enabled (thanks to genokolar)
Undervolting interface added (from genokolar, who took it from a SE kernel modder somewhere) - I think SetXperia can use it
SIO I/O scheduler added
SmartassV2 cpufreq scheduler (AnDyX mod) - although I think ondemand does a bit better IMO
sysfs entry to turn off keypad lights (I wrote an applet for this some time back, I'll dig it out later)
Logcat is always enabled now as the ServiceMenu toggle doesn't work anymore
Minimum display backlight is set to 15, but I think Android needs a framework change to use it. You could try RootDim
Kernel actually builds (and Bluetooth works)
ZRAM (+ swap) support. ZRAM is optimized for Android (taken from Siyah kernel). I'll write up the instructions on enabling this later
CIFS as module
Extras:
Change schedulers and phone speed:
Use a tool like No Frills CPU or SetCPU.
Turn off button lights:
Install the ButtonLight widget and add it to your main screen. I've published the source before in another thread; seek it out if you're after its (bad) code.
It's buggy the first few times you run it, but works fine after that.
Dim screen to 14:
The minimum backlight level is now set to 15. RootDim from the Play Store lets you set it to that.
Mount Windows shares:
Grab CifsMounter and point it to the cifs.ko in /system/lib/modules. You may also need to insmod nls_utf8.ko and md4.ko.
Enable ZRAM (taken from Siyah kernel):
(Note I've not used ZRAM so I have nothing to say on its stability, good or bad)
Grab a BusyBox binary from somewhere
Run the following commands:
Code:
echo 90 > /proc/sys/vm/swappiness #You must set the swappiness high to ensure that the compressed RAM is accessed first!
echo $SIZE > /sys/devices/virtual/block/zram0/disksize #Set size to whatever you wish. 100MB is 104857600 = 100 * 1024 * 1024
busybox mkswap /dev/block/zram0
busybox swapon /dev/block/zram0
Dump the lines in install-recovery.sh if you want to be ZRAMMed every time you boot the phone (although in that case, make sure you have
Code:
busybox swapoff /dev/block/zram0 > /dev/null 2>&1 #Use > /dev/null 2>&1 for every busybox command in install-recovery.sh as it will discard any messages outputted
echo 1 > /sys/devices/virtual/block/zram0/reset
before the lines above)
Install:
Flash the attached ZIP in CWM recovery. You should backup your original boot.img and /system/lib/modules first
Source:
Take http://www.huaweidevice.com/worldwi...=toDownloadFile&flay=software&softid=NDY3NTU= and apply attached diff
at last..xaaxxaa!!but why with modules too???whats their use?
pikachukaki said:
at last..xaaxxaa!!but why with modules too???whats their use?
Click to expand...
Click to collapse
'cause I add a new module - cifs (used by CifsMounter if you want to mount Windows shares) - and because the modules that are originally in /system/lib/modules need to be replaced so that they can load with this kernel (I don't know what those modules do, but I'd rather play it safe)
qwerty12 said:
'cause I add a new module - cifs (used by CifsMounter if you want to mount Windows shares) - and because the modules that are originally in /system/lib/modules need to be replaced so that they can load with this kernel (I don't know what those modules do, but I'd rather play it safe)
Click to expand...
Click to collapse
Boot normally change io to sio and smartassv2...1500mhz lets check..good work..i envy you and i want your guide on compiling...xaaxax im off to bed!!
fps is locked!!xaaxax
pikachukaki said:
Boot normally change io to sio and smartassv2...1500mhz lets check..good work..i envy you and i want your guide on compiling...xaaxax im off to bed!!
fps is locked!!xaaxax
Click to expand...
Click to collapse
I'll write it up sometime - but bear in mind I'm not an expert at this
Regarding FPS: do the install-recovery.sh trick
Only thing I modify in initramfs is the ro.secure setting so that ADB can be ran as root
qwerty12 said:
I'll write it up sometime - but bear in mind I'm not an expert at this
Regarding FPS: do the install-recovery.sh trick
Only thing I modify in initramfs is the ro.secure setting so that ADB can be ran as root
Click to expand...
Click to collapse
You did a great job i couldnt even compile the kernel without changes!!you did great!!
the difference is obvious !!
Sent from my U8800Pro using xda premium
Pika When U add This Kernet To ur ROM?
As expected from qwerty12!
Great job!
I'll also request a guide on how to build the kernel like pika asked.
Hope you continue to improve the kernel! A thanks is simply not enough to thank you for your work, but thanks again
husen4u said:
Pika When U add This Kernet To ur ROM?
Click to expand...
Click to collapse
I wont!just d/w it and flash it!simple!
Sent from my U8800Pro using xda premium
Now what you suggest oc ics or kalo gb?
Sent from my U8800pro using xda app-developers app
husen4u said:
Now what you suggest oc ics or kalo gb?
Sent from my U8800pro using xda app-developers app
Click to expand...
Click to collapse
From now on i wont ever go back to GB ever again! if our luck changes and someone release cm9 i will forget what gb is!! there are some small bugs but the rom is usable for everyday!!
Moihack said:
As expected from qwerty12!
Great job!
Click to expand...
Click to collapse
Thank you
I'll also request a guide on how to build the kernel like pika asked.
Click to expand...
Click to collapse
Certainly, sir.
Hope you continue to improve the kernel! A thanks is simply not enough to thank you for your work, but thanks again
Click to expand...
Click to collapse
Unfortunately I won't be working on this anymore unless Huawei get back to my request for the source to the the dhd.ko module (which they may not have to comply with because the license for the module states "Unless you and Broadcom execute a separate written software license agreement governing use of this software" so the U8800pro version may not be under GPL). I made (well, found on the Internet) more optimizations but the Wi-Fi refuses to turn on because the dhd.ko module refuses to load. Only way I can get something working is to build the source that Huawei give or attempt to force other versions of the bcm source to load, but it's unlikely that would work.
--
Anyway, a small guide.
I used an x86_64 laptop running (X)ubuntu 12.04.1 to follow these steps. This page was a great resource.
Prerequisites:
A computer running GNU/Linux (a Mac should work in theory - the same toolchain we use is built for it, too, but I have no idea how OS X works)
git installed (apt-get install --no-install-recommends git-core is enough under Ubuntu)
sudo apt-get install flex bison gperf build-essential libncurses5-dev zlib1g-dev ia32-libs lib32z1-dev lib32ncurses5-dev gcc-multilib g++-multilib abootimg
Getting ADB working
One of the best things to do is getting ADB set up, as you then have easy communication with the device. It's not essential but you'll just end up wasting time transferring files through other, longer means.
Grab the Linux platform tools ZIP from here: http://www.hariadi.org/android/manually-download-of-android-sdk-tools-and-sdk-platform-tools/. Extract the adb binary from the zip file, preferably to somewhere in your $PATH. chmod 755 it. chown, if necessary.
Next, open http://aur.archlinux.org/packages/an/android-udev/android-udev.tar.gz and, doing all this as root (sudo in Terminal etc.), place 51-android.rules in /lib/udev/rules.d/ (not the best place - but it works), chmod 644 it and chown root:root it.
Next, execute /usr/sbin/groupadd adbusers, followed by gpasswd -a USERNAME adbusers, USERNAME being the user you normally log on with.
Restart (while you can force Linux to see the new group through the, well, newgrp command udev will not "see" the new rule, despite how much you try with udevadm).
That should be ADB set up (give it a test, remembering to enable USB debugging mode on the phone first!).
On to preparing your workarea.
--
Create a new folder in your home folder and cd to it. This folder will house the prebuilt folder of toolchains and other stuff, and the kernel source in a folder of its own.
In this folder, execute git clone --depth 1 https://android.googlesource.com/platform/prebuilt.git and move onto the next step, since the download takes a while. That command grabs the prebuilt toolchain from Google using Git, but doesn't obtain a deep history for each file to make the download quicker.
Open http://www.huaweidevice.com/worldwi...=toDownloadFile&flay=software&softid=NDY3NTU= and save the source to your Downloads directory. After git has finished running, still in the folder with the "prebuilt" folder, execute tar jxf ~/Downloads/HUAWEI_U8800pro<tab - as in actually press tab> and you should have a kernel folder alongside the prebuilt one.
Building the kernel
cd to this new kernel folder.
First things first: make sure that Bluetooth is properly enabled by editing the Makefile. Find the line #ifeq ($(ENABLE_BTLA_VER30),true) and comment out every line in that section except for KBUILD_CFLAGS += -DHUAWEI_BT_BTLA_VER30 so you end up with this:
Code:
#/* < DTS2012020604357 zhangyun 20120206 begin */
# Add Huawei Marco for different BT chip
#ifeq ($(ENABLE_BTLA_VER30),true)
KBUILD_CFLAGS += -DHUAWEI_BT_BTLA_VER30
#endif
#ifeq ($(ENABLE_BLUEZ_VER30),true)
#KBUILD_CFLAGS += -DHUAWEI_BT_BLUEZ_VER30
#endif
#/* DTS2012020604357 zhangyun 20120206 end > */
Commenting out the offending code leaves you with a kernel that builds but a Bluetooth module that won't start up - the same also applies if you try to build with the other define.
You can also make things easier for yourself by replacing the following
Code:
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
with
Code:
ARCH ?= arm
CROSS_COMPILE ?= ../prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
else you will have to put "ARCH=arm CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-" after "make" each time. Remember this as I'll be assuming that you went for the option to edit the Makefile. I also assume that the prebuilt folder is above the kernel one. Adjust CROSS_COMPILE if necessary.
The ARCH variable is self-explanatory, but the CROSS_COMPILE variable (and the toolchain that it's pointing to) need to be set because the standard GNU development tools that apt installs don't produce output that an ARM processor can understand. So you cross-compile: the tools are for the X86 architecture but produce ARM output. 4.4.3 is chosen because the stock kernel is compiled with GCC 4.4.3 (if you run "adb shell cat /proc/version" you'll see). The arm-eabi-4.4.3 folder is chosen over arm-linux-androideabi-4.4.x because it specifies that magic "3" (I know, bad way to decide but it works), and over i686-android-linux-4.4.3 because we don't want to produce code for the PC.
Get the current configuration in use by the stock kernel (as that's a good point to start from - a known working configuration): http://wiki.cyanogenmod.com/wiki/Building_Kernel_from_source#Configure_the_Build
I'd also recommend placing a copy of .config as arch/arm/configs/<your funky name here> so that if .config gets deleted (make clean etc.) you can run make <the name you gave to the file in arch/arm/configs> and have .config come back again.
(cp arch/arm/configs/<the name you gave to the file> .config if you didn't modify the Makefile to specify the ARM arch.)
Run make oldconfig (not always necessary - generally it's invoked if you've applied a patch that introduces a new config option and the option then needs to go into your .config. Run make menuconfig afterwards and customize away.
When you're done, run make -jX - X as in the number of cores you have + 1. So, in my case, with a quad-core processor and HyperThreading enabled on all of them, "make -j9" works for me. If the compile went OK, you'll be left with a message saying that arch/arm/boot/zImage is ready. If not, run "make" without the -jX argument and make should stop where the error occurs. Have fun fixing the error!
Assuming that you have a new, shiny zImage, it's now time to put it into your boot.img.
Updating your boot.img:
Google have tools for this purpose but I've never used them so I don't know how they work. abootimg works fine for this, however.
Pull the current boot.img off your phone: adb pull /.cust_backup/image/boot.img.. I'd recommend creating a backup somewhere.
Create a new directory to store the boot.img in on your computer and run abootimg -x boot.img (if you had fun enabling every option in the kernel, you'll see why I'm telling you to use the -x option first rather than directly use the -u option). Now run abootimg -u boot.img -k <path to your newly built zImage>.
If this succeeds, yay! If not and you're told it's too big for the boot image, then don't worry. Take the size it's saying that the zImage is and convert that number into hex. Edit bootimg.cfg and change the value of the bootsize setting into the number you just converted into hex. We'll now repack again, but this time running abootimg -u boot.img -f bootimg.cfg -k <path to your newly built zImage>. This should work.
Sending the boot.img to the phone
If your ADB is already running as root, you can do the following to upload the new bootimg:
Code:
adb shell mount -o remount,rw /.cust_backup
adb push boot.img /.cust_backup/image/
adb reboot
If not, just reboot into pink screen mode and copy and paste.
Check System Settings and the version number should've changed. Congratulations!
Extras
Installing the modules:
OK, so you decided to build parts of the kernel as a module and you want to actually, y'know, have the modules present on the device. After building the kernel, execute:
make INSTALL_MOD_STRIP=1 modules_install INSTALL_MOD_PATH=<any folder name here>
If you look in that folder, you'll find the modules neatly wrapped up in folders, along with other text files. These text files are useless on a stock ROM because there's no modprobe - you need BusyBox for that. And since we don't want to have them seperated in folders (this is how the stock kernel does it), the files would be wrong, anyway. If you want to use modprobe and have BusyBox installed, you can run depmod on the phone after transferring the modules.
To get the modules into one folder make the directory "modules" in a folder higher-up to where the modules are stored, and then run for i in `find . | grep ko`; do mv "$i" ../modules/; done to move them into that folder.
At this point, I'd just recommend using my OC_Kernel.zip and replacing the modules in that. Or you can adb push them over to the /system/lib/modules folder (after issuing an "adb remount" - assuming that ADB is running as root in the first place).
Making ADB run as root:
As root on your computer, (we want to preserve permissions) use abootimg to split the boot image and extract the contents of the initrd:
abootimg -x boot.img && mkdir newramdisk && cd newramdisk && zcat ../initrd.img | cpio -i --no-absolute-filenames (--no-absolute-filenames is important! I trashed a Ubuntu install by leaving it out - the initrd contains ARM binaries of core Linux programs and if the initrd.img contains an absolute path of "/" then these files will get placed in /)
Make any changes you desire to the initrd. To have adb run as root, just edit /default.prop and set ro.secure to 0. Make sure that the editor you used didn't leave any backup files.
When you're done, run find . -print | cpio -o -H newc | gzip -n -9 > ../initrd.img and this will put the modified initrd folder back into initrd.img.
After that run cd .. ; abootimg -u boot.img -r initrd.img to actually put the initrd.img back into the boot.img.
If you run into a space error, you can do one of three things:
if you only made a single change (like enabling ADB), check to see that there is no backup file (default.prop~) littered about
you can remove the lengthy comments and copyright notices from the files to make space
you can use the trick we used earlier with abootimg to increase the size number in bootimg.cfg for the initrd
Overclocking:
Just look at the acpuclock C file (and possibly relevant cpufreq changes - but I can't remember) in my "OC kernel" diff. Make sure that the option in the kernel config is selected to limit the speeds to the U8800pro's native 1GHz, otherwise the phone will boot at 2GHz!
Rebuilding the Wi-Fi module:
I hope to be able to write this one since it's apparently needed in some cases, but it depends on if Huawei come through
any idea about this error?
drivers/mfd/pmic8058.c:327: error: rtc_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:327: error: rtc_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:241: error: othc0_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:241: error: othc0_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:250: error: othc1_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:250: error: othc1_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:261: error: othc2_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:261: error: othc2_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:183: error: misc_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:183: error: misc_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:210: error: thermal_alarm_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:210: error: thermal_alarm_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:270: error: batt_alarm_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:270: error: batt_alarm_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:152: error: pm8058_charger_resources causes a section type conflict
drivers/mfd/pmic8058.c:152: error: pm8058_charger_resources causes a section type conflict
matteof93 said:
any idea about this error?
drivers/mfd/pmic8058.c:327: error: rtc_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:327: error: rtc_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:241: error: othc0_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:241: error: othc0_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:250: error: othc1_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:250: error: othc1_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:261: error: othc2_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:261: error: othc2_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:183: error: misc_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:183: error: misc_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:210: error: thermal_alarm_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:210: error: thermal_alarm_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:270: error: batt_alarm_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:270: error: batt_alarm_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:152: error: pm8058_charger_resources causes a section type conflict
drivers/mfd/pmic8058.c:152: error: pm8058_charger_resources causes a section type conflict
Click to expand...
Click to collapse
Honestly, I have no idea. What toolchain are you using and where was your .config obtained from? Even when the Bluetooth thing was giving me errors, I never once saw that
same toolchain you have used. i have tried with ubuntu 12.04 x64 and ubuntu 10.04 x86 but same problem.....i have obtained my config from my phone using adb command
matteof93 said:
same toolchain you have used. i have tried with ubuntu 12.04 x64 and ubuntu 10.04 x86 but same problem.....i have obtained my config from my phone using adb command
Click to expand...
Click to collapse
I don't know why the same toolchain works on my laptop but not yours :\
Someone with a similar problem (same?) solved it by using an older toolchain: http://forum.xda-developers.com/showpost.php?p=27294383&postcount=7157
thanks thanks thanks.....i saw that post this morning but i did not noticed the post with the solution
UPDATE: NOW KERNEL COMPILED CORRECTLY....this means that tomorrow i know what to do
ZRAM (+ swap) support. ZRAM is optimized for Android (taken from Siyah kernel). I'll write up the instructions on enabling this later
qwerty your owning us some instructions!!xaaxxa
pikachukaki said:
qwerty your owning us some instructions!!xaaxxa
Click to expand...
Click to collapse
Done, check the first post
I also won't be working on this. My email (which does clearly state what I want, even if it's long-winded):
Dear Sir/Madam,
I recently built a kernel for my U8800pro from your sources and it
works fine, except that the Wi-Fi will not start because the dhd.ko
module that comes with the B928 firmware refuses to load into my
modified kernel. After looking around, the bcm4329 source is what I
need to build (usually distributed outside of the kernel); however, it
seems that the U8800pro uses a customized version. After looking at
the strings of the dhd.ko on the B928 firmware, I have seen many
strings that are present in that dhd.ko binary do not appear in:
* bcm_4.218.248.6_7x25_wifi_driver.tar from the Huawei Device website,
despite it having the same version number
* the bcm4329 source in the Qualcomm CodeAurora Git repository
* the bcm4329 source on the NyVIDIA Tegra Git repository
Furthermore, the strings also do not appear in the ICS kernel nor the
Gingerbread one. I can only conclude that Huawei have their own
specialized version of the bcm4329 4.218.248.6 source for the U8800pro
that is distributed outside the kernel. I understand that Qualcomm
allow the option to let the vendor arrange to have the code
distributed under a different license provided that the vendor makes
an agreement beforehand with Qualcomm. Otherwise it becomes GPLed by
default. If Huawei chose to make an agreement, then I have no right to
ask. However, I believe it is still licensed under the GPL for two
reasons:
* Running modinfo on the dhd.ko from the B928 firmware says this:
"license: GPL v2
* Both bcm_4.218.248.6_7x25_wifi_driver.tar.gz and
[S7][SoftWare]S7_Broadcom_BCM4329_4.218.205.0_Open_Source are under
the GPL
I would like to request the source code, please, of the bcm4329
4.218.248.6 source that is modified for the U8800pro if the code is
under the GPL
Best regards
Click to expand...
Click to collapse
was met with the following generic response:
Dear Customer,
Thank you for contacting Huawei device.
This is our website link http://www.huaweidevice.com/worldwide/searchResult.
do?method=execute&searchString=U8800pro where you can download the secure
code for U8800pro to you.
Once again thank you for contacting Huawei device.
Best Regards.
Huawei Device Customer Care Team.
Click to expand...
Click to collapse
Since my U8800pro is not my main phone anymore, I do not have the energy to fight. Nor do I want to work on Huawei's kernel, where you have to be careful about what you change or the Wi-Fi module won't load (and Huawei won't give you the source - which they should do since I'm sure it's under GPL). matteof93 will most likely produce something better or when everyone starts producing their own kernels and make enough improvements to be hit with the same issue as I, they'll start to get more emails and listen
@qwerty at the last command it said that device is busy...also is there any way that you can make it for init.d so it will be easier??thx!!

[vision][fried emmc] Booting CM 7.2 from SD card

Hi there,
I just found catherall's thread on [how to boot CM 7.1 from the external SD card][0] on a Desire Z/G2 with the infamously fried eMMC.
I used his instructions to boot CM 7.2 (the last stable version for the Vision); since the above thread ends with a dangling question on how to update the system to be booted, I thought I'd document my efforts.
anonymousthing said:
anybody know what system.img format he is using?
Click to expand...
Click to collapse
It's just an ext4 file system:
Code:
$ file system.img
system.img: Linux rev 1.0 ext4 filesystem data, UUID=b4db3ed8-7d52-46a0-85fb-46fb67c5e837 (needs journal recovery) (extents) (huge files)
$ adb shell
~ # mount | grep system
/dev/block/loop0 on /tmp/boot.img-ramdisk/system type ext4 (rw,nodev,noatime,nodiratime,nouser_xattr,commit=19,barrier=0,data=ordered)
Disclaimer: On the original image, `file` actually identifies the FS as a `mounted or unclean` ext2; it's definitely an ext4 with journaling, though. Accordingly a `mount -t ext2` will fail with a `wrong fs type`.
You can create a new one with
Code:
$ dd if=/dev/zero of=system.img bs=4k count=64000
$ /sbin/mkfs.ext4 system.img
# mount -o loop -t ext4 system.img /media/new_sys
anonymousthing said:
I have tried making my own system.img from the rom but it does not work
Click to expand...
Click to collapse
This is potentially due to missing binaries:
Code:
$ diff -r /media/orig_sys update-cm-7.1.0-vision-signed/system | head -n 5
Only in /media/orig_sys/bin: cat
Only in /media/orig_sys/bin: cmp
Only in /media/orig_sys/bin: date
Only in /media/orig_sys/bin: dd
Only in /media/orig_sys/bin: dmesg
If you download a version of CM, at least the `toolbox` and the `busybox` binaries will be missing from the `system/bin` and `system/xbin` directories respectively. I couldn't be bothered to check for up-to-date versions but just copied the ones provided by catherall before copying over the new CM version:
Code:
# cp -r /media/orig_sys/bin /media/orig_sys/xbin /media/new_sys
# cp -r cm-7.2.0-vision/system/* /media/new_sys
This will obviously update all the files that come with CM 7.2 and just keep what's not included in the box.
While you're at it, you might want to add up-to-date gapps:
Code:
# cp -r gapps-gb-20131214-signed/system/* /media/new_sys
This gives you a booting CM 7.2. Just replace the `system.img` that comes with catherall's `.zip` with the one you just created and off you go
Unpleasant issue: Booting from SD seems to require a specifically prepared kernel, so the `boot.img` that comes with a different ROM/CM version won't work. So until someone finds out how to prepare a kernel for booting from SD, you will have to continue to boot the one provided by catherall. However, the WIFI driver has not been compiled into the kernel but lives in a separate kernel module in `/system/lib/modules/bcm4329.ko`. Which we (by copying over the `/system` dir from the CM 7.2 build) replaced with a version incompatible with the old kernel we have to boot. So if you intend to boot through `fastboot` and use WIFI (and why wouldn't you? ;P), we will have to put the old kernel module back:
Code:
# cp /media/orig_sys/lib/modules/bcm4329.ko /media/new_sys/lib/modules/
Weirdly enough, in the CM 7.2 version I downloaded, the permissions for the `dhcpd-run-hooks` script were broken, so I at least needed to fix those too:
Code:
# chmod 550 /media/new_sys/etc/dhcpd/dhcpd-run-hooks
So, `umount` your pristine new `system.img`, move it to your SD card and boot into CM 7.2.
HTH
D.
PS I naively tried to create a larger 1 GB `data.img`, copying over the content from the existing one, but the phone didn't boot with that one. I might have made a mistake (was rather late at that point -.- and I didn't investigate any further), but it seems like the size of the partitions may be hardcoded somewhere. If someone has any additional information, please let me know Thx!
PPS If anyone ([MENTION]@catherall[/MENTION]? ;P) knows anything about the kernel issue, I'd be highly interested
PPPS After creating this account (to be fair, I've been profiting from this community since the old Windows Mobile days), I was informed that as an account noob, I obviously didn't have anything to contribute to this community and was ordered to place my undoubtedly profane question (which certainly had been answered may times before, I was only too lazy/dumb to search) outside the elite developer forums [/rage]. Maybe one of the Mods can stitch the [original thread][0] and this st0pid workaround back together again? :/ Thanks!
[0]: http://forum.xda-developers.com/showthread.php?t=1572924

Categories

Resources