u-boot and kernel 2.6.38 for tf101 and iconia - Eee Pad Transformer General

Hi all here!
I ported u-boot and latest chromium kernel to tf101. U-boot can also be used on Acer Iconia.
here it is:
enodev.org/~muromec/u-boot/2011-08-04/u-boot-tf101.bin (tf101)
enodev.org/~muromec/u-boot/2011-08-04/u-boot-picasso.bin (iconia)
enodev.org/~muromec/tf101/vmlinux-2.6.38.3-g3effdbe.uimg
source code at my github page: github.com/muromec/iconia-gnu-kerne github.com/muromec/uboot-tegra
U-boot can be loaded via nvflash like this:
Code:
./nvflash --bct transformer.bct --setbct --configfile flash.cfg --bl u-boot.bin --odmdata 0x300d8011 --sbk 0x1682CCD8 0x8A1A43EA 0xA532EEB6 0xECFE1D98 --sync
Or flashed replacing nvidias boot like this (using flash.cfg from here: enodev.org/~muromec/tf101/flash.cfg
Code:
./nvflash --bct transformer.bct --setbct --configfile flash_hack.cfg --bl bootloader.bin --odmdata 0x300d8011 --sbk 0x1682CCD8 0x8A1A43EA 0xA532EEB6 0xECFE1D98 --sync
./nvflash -r --format_all --configfile flash_hack.cfg --create --bct transformer.bct --setbct
Tries to load kernel image in u-boot format from three different places:
At very first: usb flash (or dockstation sd-slot) partition 3, formatted in ext2. kernel should be placed at /boot/vmlinux.uimg
At second: partition 3 on internal mmc when its partitioned using msdos/mbr.
At last: from internal mmc sector 0x1c00 (SOS partition).
Bootloader passes kernel mtype 3640 (one i registered for tf101).
Feel free to use.

Ummm. So what it be possible to actually port chromium itself?

ilyamuromec said:
Hi all here!
Click to expand...
Click to collapse
Hi ilyamuromec, Welcome to xda-developers!
Thanks for your hard work. I tried to compile your code, but it's unbootable & build size is bigger than yours (266K). I used
Code:
make ventana_config
make
Please guide

Amazing work, lets see what this brings, but will probably be a great addition to ubuntu on the transformer

I get fails with the device tree stuff and can't compile it as a result,

lilstevie said:
I get fails with the device tree stuff and can't compile it as a result,
Click to expand...
Click to collapse
Usually when I have trouble compiling someone else's code, it's due to the version of the armeabi cross-compiler.
ilyamuromec, what cross-compiler and build options do you use?

msticninja said:
Usually when I have trouble compiling someone else's code, it's due to the version of the armeabi cross-compiler.
ilyamuromec, what cross-compiler and build options do you use?
Click to expand...
Click to collapse
at this point it is actually the Device-tree-compiler

I`m building with such command:
make ARCH=arm CROSS_COMPILE=/opt/arm/arm-2010q1/bin/arm-none-eabi- ventana DEV_TREE_SRC="tegra2-tf101"
only difference in devices trees is a label and machid (mtype). and my gcc version:
gcc version 4.4.1 (Sourcery G++ Lite 2010q1-188)
anything newer gives same unbootable crap. about device tree compiler: I`m using one from kernel tree: Version: DTC 1.2.0-g37c0b6a0

ilyamuromec said:
I`m building with such command:
make ARCH=arm CROSS_COMPILE=/opt/arm/arm-2010q1/bin/arm-none-eabi- ventana DEV_TREE_SRC="tegra2-tf101"
only difference in devices trees is a label and machid (mtype). and my gcc version:
gcc version 4.4.1 (Sourcery G++ Lite 2010q1-188)
anything newer gives same unbootable crap. about device tree compiler: I`m using one from kernel tree: Version: DTC 1.2.0-g37c0b6a0
Click to expand...
Click to collapse
Code:
dtc -R 4 -p 0x1000 -O dtb -o dt.dtb /home/lilstevie/transformer_ubuntu/uboot-tegra/board/nvidia/ventana/tegra2-tf101.dts
DTC: dts->dtb on file "/home/lilstevie/transformer_ubuntu/uboot-tegra/board/nvidia/ventana/tegra2-tf101.dts"
FATAL ERROR: Couldn't open "skeleton.dtsi": No such file or directory
Is the error I am getting, dtc version is 1.2.0 from the ubuntu software repos

lilstevie said:
at this point it is actually the Device-tree-compiler
Click to expand...
Click to collapse
Late night, words failed me. You know what I meant...

lilstevie said:
Code:
dtc -R 4 -p 0x1000 -O dtb -o dt.dtb /home/lilstevie/transformer_ubuntu/uboot-tegra/board/nvidia/ventana/tegra2-tf101.dts
DTC: dts->dtb on file "/home/lilstevie/transformer_ubuntu/uboot-tegra/board/nvidia/ventana/tegra2-tf101.dts"
FATAL ERROR: Couldn't open "skeleton.dtsi": No such file or directory
Is the error I am getting, dtc version is 1.2.0 from the ubuntu software repos
Click to expand...
Click to collapse
please, try one from kernel sources. there is some difference in path resolition for dtsi includes.

lilstevie said:
Is the error I am getting, dtc version is 1.2.0 from the ubuntu software repos
Click to expand...
Click to collapse
I got the same error before using DTC 1.3. The syntax inside the dts file isn't compatible with older version.

Awesome, could we possibly use this to dual boot stuff (without replacing the recovery image)?

brando56894 said:
Awesome, could we possibly use this to dual boot stuff (without replacing the recovery image)?
Click to expand...
Click to collapse
yeah, i`m using it for dual-boot. one kernel on sd-card, other on internal mmc.

Okay, cool using device-tree-compiler_1.3.0 builds and works now awesome work, I will forking this now and making the necessary changes for it to work for my ubuntu port this combined with your port of the chromeos kernel has just made things a hell of a lot easier for me mad props man

lilstevie said:
Okay, cool using device-tree-compiler_1.3.0 builds and works now awesome work, I will forking this now and making the necessary changes for it to work for my ubuntu port this combined with your port of the chromeos kernel has just made things a hell of a lot easier for me mad props man
Click to expand...
Click to collapse
I was hoping you'd pick this thread up. I love your dual-boot, but I've always hated using recovery as the second OS. Did the same on my Archos and always felt dirty about it.

lilstevie said:
Okay, cool using device-tree-compiler_1.3.0 builds and works now awesome work, I will forking this now and making the necessary changes for it to work for my ubuntu port
Click to expand...
Click to collapse
Hint: you can place so-called "u-boot script" on 13th partition to hook necessary options into bootloader. u-boot should be sort of thing that is same for different distros.
living with different u-boot forks for ubuntu, chromeos and something like archlinux would be just wrong. if you need, I will merge back some defaults like loading initrd.
lilstevie said:
this combined with your port of the chromeos kernel has just made things a hell of a lot easier for me mad props man
Click to expand...
Click to collapse
eah, but kernel port still misses some pieces like internal battery driver, sound config, etc. also, asusec driver should be cleaned and pushed mainstream.

ilyamuromec said:
Hint: you can place so-called "u-boot script" on 13th partition to hook necessary options into bootloader. u-boot should be sort of thing that is same for different distros.
living with different u-boot forks for ubuntu, chromeos and something like archlinux would be just wrong. if you need, I will merge back some defaults like loading initrd.
eah, but kernel port still misses some pieces like internal battery driver, sound config, etc. also, asusec driver should be cleaned and pushed mainstream.
Click to expand...
Click to collapse
eh work is expected, asus kernel doesn't work that brilliantly anyway, a few of the drivers are pretty broken

just wondering if you have any specific requirements on the emmc partition, been trying various things and the fatload just keeps failing

lilstevie said:
just wondering if you have any specific requirements on the emmc partition, been trying various things and the fatload just keeps failing
Click to expand...
Click to collapse
fatload? do you have FAT support enabled and partition actually in fat?
I`m doing it in sort of tricky way. I created dos partition table on mmcblk0:
/dev/mmcblk0p3 7168 10492927 5242880 83 Linux
it is important that partition number is 3 and starts from block 7168 (all before wiped on reflash). partition formatted with ext2

Related

[REF] How to compile your own kernel and initrd for HTC Leo

Kernel compile :
Do it on user not root :
1. Make sure you have an appropriate environment to get the source (git) and to compile the kernel. Install git, gcc, make and libncurses5-dev at least. For Ubuntu based distributions.
apt-get install git-core build-essential libncurses5-dev
2. Create a directory to hold the kernel sources
mkdir ~/htcleo
3. Download the kernel source
cd ~/htcleo
git clone git://git.linuxtogo.org/home/groups/mobile-linux/kernel.git
cd kernel
git checkout -b htc-qsd8k-2.6.29 origin/htc-qsd8k-2.6.29
4. Download and decompress the arm toolchain (64mb)
cd ~/htcleo
wget http://www.codesourcery.com/gnu_too...-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
tar xjf arm-2008q1-126-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
5. Generate the default .config for the kernel(ARCH is case sensitive)
cd kernel
make htcleo_defconfig ARCH=arm
6. Compile
export PATH=~/htcleo/arm-2008q1/bin:$PATH
make Image ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
Find your kernel Image in /htcleo/kernel/arch/arm/boot/
Now you can configure your proper kernel :
mousepad (Xfce) or gedit (Gnome) ~/htcleo/kernel/arch/arm/configs/htcleo_defconfig
cd ~/htcleo/kernel
make mrproper
make htcleo_defconfig ARCH=arm
export PATH=~/htcleo/arm-2008q1/bin:$PATH (must need once time)
make Image ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
Use git pull in ~/htcleo/kernel to update file and recompile to have the last modified on development
Initrd compile :
Need to be root !
1. Download initrd.gz from other HTC compiled
mkdir initrd (or anything else in propely folder nothing else on)
cd initrd (put your initrd.gz here)
gzip -dc initrd.gz | cpio -id
Now you have all file and folder you can touch and modified
Use mousepad or gedit on root
2. Recompile proper
rm initrd.gz (before do a copy for other instance)
find (all name of folder and file) | cpio --create --format='newc' > initrd
Compile source for Arm :
(root user)
On source folder :
#export ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- PATH=(your path)/arm-2008q1/bin:$PATH
#CC=arm-none-linux-gnueabi-gcc ./configure --host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi
# make
For who want to take time to test and finaly make Android works on HTC Leo.
I thinks all members hav's HTC Leo !!
hey guys..
i really want to use android on my new HD2!
i'm a little-medium (^^) n00b, but spent a lot of time in android on my kaiser.. so i'm not a totally noob, i think.
i can help testing files for you.
so, what do the dev's think, how long did it take to use android on our phones?
greetings
Thanks for the tip, will try it tomorrow and report what I see
wget http://www.codesourcery.com/gnu_tool...ux-gnu.tar.bz2 -O arm-2008q1-126-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
Click to expand...
Click to collapse
On the wget command supplied you have to right click and copy link location and paste that as the wget url or it wont work, the forum has truncated the text with ... in the middle . use the -O afterwards as shown
1. Download initrd.gz from other HTC compiled
Click to expand...
Click to collapse
Im also not quite understanding this, what is other HTC compiled ? Another set of sources with Android?
Thread Edit
You can take any one initrd.gz and modified script on it.
HTC Vogue initrd.gz its the better.
Tigrouzen said:
Thread Edit
You can take any one initrd.gz and modified script on it.
HTC Vogue initrd.gz its the better.
Click to expand...
Click to collapse
Thanks for fixing the wget ..
Cool so i already have another initrd and i hang at the freeing 104k init error .. Are you able to get past this ?
Nice job writing that up.
Personally I use a different toolchain, but if the toolchain you mention works without a problem, then all is well When I used a toolchain from codesourcery I somehow got compile errors as there was no VFP support (maybe I just took the wrong binary).
The toolchain i'm using is in this git repo: http://android.git.kernel.org/?p=platform/prebuilt.git;a=summary and under linux-x86/toolchain/arm-eabi-4.4.0
NetRipper said:
Nice job writing that up.
Personally I use a different toolchain, but if the toolchain you mention works without a problem, then all is well When I used a toolchain from codesourcery I somehow got compile errors as there was no VFP support (maybe I just took the wrong binary).
The toolchain i'm using is in this git repo: http://android.git.kernel.org/?p=platform/prebuilt.git;a=summary and under linux-x86/toolchain/arm-eabi-4.4.0
Click to expand...
Click to collapse
This toolchain works, compiles fine but fails on boot at the 104k error for me .. Not sure how to progress this without further info / debug ..
NetRipper said:
Nice job writing that up.
Personally I use a different toolchain, but if the toolchain you mention works without a problem, then all is well When I used a toolchain from codesourcery I somehow got compile errors as there was no VFP support (maybe I just took the wrong binary).
The toolchain i'm using is in this git repo: http://android.git.kernel.org/?p=platform/prebuilt.git;a=summary and under linux-x86/toolchain/arm-eabi-4.4.0
Click to expand...
Click to collapse
Yes cause you use 2009q3 arm-eabi not contain VFP support maybe not important.. i try with your toolchain and 2008q1 binary
This is one worked with 2008q1 binary
Nice work! When do you think Android will be avaible on HD2?
How should I format the micro SD Card ?
Do I have to create two partitions (one eith FAT to boot and another ext3 to filesystem ?)
Does anyone have a tutorial to configure the sd card ?
My experience format SD card make some mistake and brick some SD card on linux. For now dont do that cause no way and ist not ready to work.
But Android porting hardware its now everything ok, just wait some moment maybe one or two month to see it on HD2.
This test just need put haret, default.txt based on Leo, initrd.gz and Image on sdcard root and executed haret
If you have drivers to every piece of hardware then tell me how did you managed to detect the SD card reader. Because I simply can't.
The developer find right interrupt for hardware on Leo but we dont have definitively realized driver, this is a problem to communicate right with Leo hardware.
If we have main console work then its ok!!
Now just have boot working and freez.
We need wait.
You can maybe look in this thread Martijn Stolk works, 38hours ago he add some instruction on kernel, then its signified we advanced to make Android works.
http://git.linuxtogo.org/?p=groups/mobile-linux/kernel.git;a=shortlog;h=refs/heads/htc-qsd8k-2.6.29
I think 2 months later if everything ok.
Now you dont need formating your sd card just put file on root.
What's about other non-Leo QSD8x50 devices? I tried some of previous NetRipper's kernels, but they didn't work... As I'm completely next to nothing in ARM kernel development, I take someone should port IRQ and GPIO map (If I remember correctly) of respective devices (e.g. neoTouch, Expo, TG01 etc), isn't it?
Or is the kernel universal?
I thinks HTC take's other hardware way and this hardware doesn't have any driver on linux.
HTC just make's driver for Windows mobile and then have realy code source to ported on linux and android.
Or maybe system locked protection !! Like's Archos 5 IT code secure implentation !!
Maybe HTC do it protection hardware cause Microsoft ask him to not porting it on Android !!!
Or marketing way not arrenged HTC to sell HTC Supersonic simillar hardware with Android !!
I hope its not this way, cause no way to ported Android or linux on Leo..
Last issue if there no protection just wait for HTC Supersonic and porting in Leo.
Tigrouzen said:
Last issue if there no protection just wait for HTC Supersonic and porting in Leo.
Click to expand...
Click to collapse
Would love it, with DualBoot in more
I'll donate for Android, I am really excited to get it on our device !
Thank you to all developpers who take time for us !
See you.
Edit : Use "git pull" to update automatically file modified on development
Thanks for developers.
Edit : compile source for Arm

[REF] Unpacking and repacking stock rom .img files

As most of you are aware, the stock rom tarball is comprised of several .img files which don't seem to be of any file system format and it is difficult at first to see what is inside these files without flashing via Odin.
Well, thanks to fguy, this thread http://forum.xda-developers.com/showthread.php?t=1054836 provided me the necessary inspiration to investigate just exactly what are these img made of.
Hopefully, this will allow easy removal of all the Samsung junk, deodexing, rooting etc etc without going through adb.
As it turns out, they are simply sparse ext4 images, and the AOSP source tree already contains the necessary utilities to both unpack and repack these img files via "ext4_utils" in system/extras (https://android.googlesource.com/platform/system/extras/)
For your convenience, I have provided a repackage of the source code for ext4_utils with a simple Makefile, for keen developers to make the necessary tools for unpacking and repacking the stock img files. Making these tools requires a linux development environment, which is beyond the scope of this topic.
To make the tools, simple extract the attached source code and type "make".
To unpack the .img file:
Code:
./simg2img factoryfs.img output.img
To view the contents of .img file:
Code:
mkdir tempdir; mount -o loop output.img tempdir
To repack .img file:
Code:
./mkuserimg.sh -s /some/directory/with/files ./factoryfs_custom.img ext4 ./temp 512M
As I do not have Odin at the moment, I am not able to test the repacked files can be reflashed successfully. I will test this shortly.
UPDATE
I have just tested repacking the stock factoryfs.img. It so happens that the original ext4_utils does not properly preserve permissions on the new ext4 image. I have made a slight modification to the source and reuploaded the zip.
You can now successfully unpack, remove and change the stock apps, root and modify the stock image using instructions above!!
I hope this will help people create their own custom roms.
UPDATE 27th MAY FOR GALAXY S4 TESTING (i9500 i9505)
A few people have messaged me asking why these tools do not work for the new Galaxy S4. Unfortunately I do not have a Galaxy S4 so I can not test any of these utilities. HOWEVER, it seems there has been quite a bit of updates by Google in the ext4_utils package. I have updated the sources according to 4.2.2 which is the latest version of the tools. I must stress that I DO NOT HAVE A GALAXY S4 TO TEST so don't be expecting miracles. In any case I have uploaded the new code now. As it was before, I have provided a MAKEFILE and you simply type "make" in order to build the tools. They are contained in ext4_utils_new.zip.
Thanks for your support guys. And I do apologize for replying late to my inbox...
Update 9th November 2014
Thanks to qwerty_7564 for providing the fixes for cygwin compilation.
Ext4 utils new still missing link arguments to compile. Investigating. I will update the sources to that of the 4.3 branch later.
Update 3rd December 2014
I have updated the tools to 4.3 branch. Note that no attempts has been made to make this compatible with cygwin as I have no cygwin to test.
As I have mentioned earlier, I do not have a newer samsung device to test any of these files, use at your own discretion. The new files are in ext4_utils_r4.3.tar.gz and is based on the jb release 2.0.0 branch.
you mean, with these tools anyone with fair knowledge of linux can create custom ROMs ? what all we can do with this trick to an image/stock ROM ? pls explain
keen to know what change it could bring to the present scenario of tweaks...
Yes and you can even provide root privileges to stock rom without having to pass through insecure firmware
As you said anyone with a little knowledge of Linux could do that
It's only unpacking and repackaging new rom
Sent from my GT-I9100 using Tapatalk
very good jazzor
what is so special samsung img file?
There is nothing special about the img file. It is just that I have not seen anyone write a guide to modify these img files yet. They are simple compressed ext4 images as explained in the first post. AOSP already recognises this format and have made available utilities for you to modify and create your own img files which can be flashed via Odin
hope someone can make this tool....i know little linux knowledge....
Hi, I have given make a mistake, it can be?
Thanks.
[email protected]:~/discoduro/BASURILLA/GSII/Varios/ext4_utils$ make
gcc -I. -DANDROID -c make_ext4fs.c
gcc -I. -DANDROID -c make_ext4fs_main.c
gcc -I. -DANDROID -c ext4_utils.c
gcc -I. -DANDROID -c allocate.c
gcc -I. -DANDROID -c backed_block.c
gcc -I. -DANDROID -c output_file.c
output_file.c:25:18: fatal error: zlib.h: No existe el fichero o el directorio
compilation terminated.
make: *** [output_file.o] Error 1
Click to expand...
Click to collapse
BoRoU said:
Hi, I have given make a mistake, it can be?
Thanks.
Click to expand...
Click to collapse
hi BoRoU, try this:
$ apt-get install zlib1g-dev
Perfect. Gracies.
i get a warning when i try the option make
[email protected]:/home/galaxy/ext4_utils# make
gcc -I. -DANDROID -c make_ext4fs.c
gcc -I. -DANDROID -c make_ext4fs_main.c
gcc -I. -DANDROID -c ext4_utils.c
gcc -I. -DANDROID -c allocate.c
gcc -I. -DANDROID -c backed_block.c
gcc -I. -DANDROID -c output_file.c
gcc -I. -DANDROID -c contents.c
contents.c: In function ‘make_directory’:
contents.c:118:3: warning: format ‘%llu’ expects type ‘long long unsigned int’, but argument 4 has type ‘u32’
how can i fix this?
GalaxyS! said:
i get a warning when i try the option make
[email protected]:/home/galaxy/ext4_utils# make
gcc -I. -DANDROID -c make_ext4fs.c
gcc -I. -DANDROID -c make_ext4fs_main.c
gcc -I. -DANDROID -c ext4_utils.c
gcc -I. -DANDROID -c allocate.c
gcc -I. -DANDROID -c backed_block.c
gcc -I. -DANDROID -c output_file.c
gcc -I. -DANDROID -c contents.c
contents.c: In function ‘make_directory’:
contents.c:118:3: warning: format ‘%llu’ expects type ‘long long unsigned int’, but argument 4 has type ‘u32’
how can i fix this?
Click to expand...
Click to collapse
Code:
error("failed to allocate %llu extents", (unsigned long long)len);
sgstwo said:
Code:
error("failed to allocate %llu extents", (unsigned long long)len);
Click to expand...
Click to collapse
They are just warnings. There's no need to fix anything. It will still compile.
jazzor said:
They are just warnings. There's no need to fix anything. It will still compile.
Click to expand...
Click to collapse
Yes, it will still compile. Since you ignore warnings, I take it you're not a programmer.
And if you look closely, it's also a bug. Nothing serious, but still a bug.
sgstwo said:
Yes, it will still compile. Since you ignore warnings, I take it you're not a programmer.
And if you look closely, it's also a bug. Nothing serious, but still a bug.
Click to expand...
Click to collapse
No, there really is nothing to fix.
Code:
data = inode_allocate_data_extents(inode, len, len);
if (data == NULL) {
error("failed to allocate %llu extents", len);
return EXT4_ALLOCATE_FAILED;
}
Worst case scenario: the error message displays a weird number.
EDIT: Not saying you don't get this (obviously you do - haha), but fixing this for someone asking what the warning means is a bit overkill.
RyanZA said:
Worst case scenario: the error message displays a weird number.
Click to expand...
Click to collapse
And that's the bug. Yes, not a very serious bug, but a bug nonetheless. The compiler can help you find bugs. Ignore compiler warnings at your own risk.
Any Chance to something like this for Windows?
You can make the tools for windows, but it will still be useless since you also need an ext4 driver and a loop mounter. And then theres the issue of maintaining file permissions on said ext4 driver. Unfortunately, windows is not a very friendly environment for such tasks.
Can someone make a simple guide? I have never use linux before
Thanks
Mackzen said:
Can someone make a simple guide? I have never use linux before
Thanks
Click to expand...
Click to collapse
This is the development section. It's not an easy process. Take a read, and google the bits you don't know. The info in the first post is all you need Get a virtualbox set up with ubuntu in it or something
pulser_g2 said:
This is the development section. It's not an easy process. Take a read, and google the bits you don't know. The info in the first post is all you need Get a virtualbox set up with ubuntu in it or something
Click to expand...
Click to collapse
Thanks for the answer
I have write this and place factoryfs.img inside ext4_utils. What I'm doing wrong?
PHP:
[email protected]:~$ cd ~/Desktop/ext4_utils/
[email protected]:~/Desktop/ext4_utils$ ./simg2img factoryfs.img output.img
bash: ./simg2img: No such file or directory

[HOW-TO] Build CM9 Kernel w/o Building ROM!

For those of you with lower powered computers like me (My computer right now is 2gb RAM, Core 2 Duo) its a hassle every time you build ICS. For me it takes around 10 hours, and half the time the build crashes.
So since I wanted to just get my feet wet with the development going on here as far as the actual ROM, I decided I wanted to go the kernel route.
The actual compilation guides around the internet are just for compiling the kernel and then adding it into the ROM's build directory so that it gets build along with the ROM. The thing is though that if you don't compile the build kernel with the ROM, then it lacks the ramdisk and doesn't boot.
So thanks to the help of jcsullins, we now have a guide for building CM9 without the ROM building It is below. Many parts of this guide were taken from here: https://www.evernote.com/shard/s102...6dfbf53e0fe5/ba173394b43ed99ae6a90a4d1c51210f (by danabw) and from here: http://code.google.com/p/moboot/issues/detail?id=20
This guide assumes you havent build android before on your system. The build requires some extra programs which are explained in the steps below as well.
Where ever there is multiple lines of code, run the code lines one at a time. Also, I am not responsible for anything that happens as a result of this guide, though it works perfectly for me on Ubuntu 10.04 and the CM9 Nightlies.
Without further ado, here it is:
Prerequisites:
-Touchpad (d'oh)
-PC running Ubuntu 10.04 or higher (I recommend 10.04 for the best stability as far as android builds go including this one)
-Run these lines of code to install most of the prerequisites you need for building android (approx 103 mb)
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-bin
sudo apt-get install sun-java6-jdk
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool
Click to expand...
Click to collapse
1. Create the kernel build directory
mkdir -p ~/android/kernel/
Click to expand...
Click to collapse
2. Get the kernel source.
cd ~/android/kernel/
git clone git://github.com/CyanogenMod/hp-kernel-tenderloin.git -b ics
Click to expand...
Click to collapse
3. Download & install uboot-mkimage and set the PATH to it:
sudo apt-get install uboot-mkimage
PATH=${PATH}:~/usr/bin
Click to expand...
Click to collapse
4. Download & install CodeSourcery for the ARM Toolchain
Click on the link here: https://sourcery.mentor.com/sgpp/lite/arm/portal/release1802
Click "IA32 GNU/Linux Installer"
Let the package download
After done, go to terminal and navigate to your download directory (mine is /home/rohan/Download)
Type these commands:
chmod +x arm-2011.03-42-arm-none-eabi.bin
./arm-2011.03-42-arm-none-eabi.bin
Click to expand...
Click to collapse
Follow the directions it gives you. If it comes up with an error about reconfiguring dpkg, do what the message in the terminal says about turning off a settings. You can reenable this later if you want by doing the same command and choosing yes instead of no.
5. Configure the configuration file
Close out of that terminal and open a new one.
Navigate to the kernel's build folder (the one whose path ends in the folder hp-kernel-tenderloin)
Then type:
make ARCH=arm tenderloin_android_defconfig
Click to expand...
Click to collapse
6. Build the kernel
Type the following into terminal:
make ARCH=arm -j8 CROSS_COMPILE=~/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-eabi- uImage
Click to expand...
Click to collapse
Where it says "-j8" above, replace with the number of CPU/cores on your system. On a dual core system that should be -j8, but -j3 worked fine on my dual core system as well.
This took my system around 7 minutes.
7. Ready the uimage-extractor tool
Go up one directory in your terminal and then do the following commands:
git clone https://code.google.com/p/moboot
cd moboot/tools
gcc -lz uimage-extract.c -o uimage-extract
Click to expand...
Click to collapse
Now grab the uImage.CyanogenMod you have in your Touchpad's /boot folder (via a file manager with root access or adb) and put the uImage in the moboot/tools directory (where the terminal currently is in)
8. Decompile the existing uImage
Type the following:
./uimage-extract uImage.CyanogenMod
Click to expand...
Click to collapse
9. Grab the built uImage and put it in the extracted folder
Type the following:
cp <location to the hp-kernel-tenderloin folder here>/arch/arm/boot/uImage <location to the moboot/tools folder here>/uImage
Click to expand...
Click to collapse
10. Build the new kernel using the old ramdisk and your new built uImage
Type the following:
mkimage -A arm -O linux -T ramdisk -C none -a 0x60000000 -e 0x60000000 -n "Image" -d ramdisk.img uRamdisk
mkimage -A arm -O linux -T multi -a 0x40208000 -e 0x40208000 -C none -n "multi image" -d uImage:uRamdisk uImage.CyanogenMod.new
Click to expand...
Click to collapse
Thats it!
Your new kernel should now be in the moboot/tools directory under the name "uImage.CyanogenMod.new"
Transfer it to the /boot folder of your device and watch your hard work pay off
Again, HUGE thanks to jcsullins for all his work, along with the entire CM Team. It is truly awesome what they have put together!
Nice job man. While I haven't worked on the kernel side of things much, may have to give it more thought now.
Sent from my PG86100 using Tapatalk
Win7
OP,
Is there a similar guide for Win7 aside from Ubuntu? The above process looks manageable and TC in my experience is semi-unbrickable.
austin_dreq said:
OP,
Is there a similar guide for Win7 aside from Ubuntu? The above process looks manageable and TC in my experience is semi-unbrickable.
Click to expand...
Click to collapse
No. </10char>
For ubuntu users:
Instead of the CodeSourcery compilers you could also use the package gcc-arm-linux-gnueabi which has everything you need. Aside from not installing the CodeSourcery compilers the only thing in the guide that needs to be changed is the compile operation:
From
Code:
make ARCH=arm -j8 CROSS_COMPILE=~/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-eabi- uImage
To
Code:
make ARCH=arm -j8 CROSS_COMPILE=arm-linux-gnueabi- uImage
austin_dreq said:
OP,
Is there a similar guide for Win7 aside from Ubuntu? The above process looks manageable and TC in my experience is semi-unbrickable.
Click to expand...
Click to collapse
Over on RootzWiki there is a similar guide for building the kernel that is incorporated into the ROM, using Oracle VM on Win7. It is very clear and wish I would had this when I started building projects and kernels. I believe that is what Rohan was referring to in his OP. So you can follow those steps, including setting up the VM. The main difference then is the last few steps in terms of making the kernel with the ramdisk.
As an aside, my computer system is not very special, an older quad core amd with 8GB memory and I can typically build the ROM in a VM environment, depending on how many new commits there are, in ~30 minutes. But I do tend to build every day to keep up with the commits and thus keep my build time down. In terms of the kernel, as mentioned, I can usually build in only a few minutes. There are many fewer commits to the kernel, so that is pretty static unless you are doing a lot of development yourself.
O.a.T. said:
Over on RootzWiki there is a similar guide for building the kernel that is incorporated into the ROM, using Oracle VM on Win7. It is very clear and wish I would had this when I started building projects and kernels. I believe that is what Rohan was referring to in his OP. So you can follow those steps, including setting up the VM. The main difference then is the last few steps in terms of making the kernel with the ramdisk.
As an aside, my computer system is not very special, an older quad core amd with 8GB memory and I can typically build the ROM in a VM environment, depending on how many new commits there are, in ~30 minutes. But I do tend to build every day to keep up with the commits and thus keep my build time down. In terms of the kernel, as mentioned, I can usually build in only a few minutes. There are many fewer commits to the kernel, so that is pretty static unless you are doing a lot of development yourself.
Click to expand...
Click to collapse
Yeah I want to develop kernels mainly because I've never done it before for Android. I've developed for a Symbian device before since thats my current phone. The Touchpad is my first Android device, and I really hope to get a GNex soon as soon as it is brought to AT&T. If not, I'll probably either switch to VZ since AT&T is getting really annoying.
As for the non-installation of Code Sourcery, thanks! I never knew that package existed! Seems a lot less bloated than the Code Sourcery version.
And also for the developing on Windows, I'd just set up a VM for Ubuntu 10.04. Or you could install wubi, which is a dual boot solution to your Windows predicament. I'm currently running wubi since my only machine right now is old and aging. I need to migrate over to a full dual boot soon though.
This guide can be used on other phones?
sahibunlimited said:
This guide can be used on other phones?
Click to expand...
Click to collapse
If they use the same uImage format then yes. However, I'm not sure if other devices allow you to boot from the uImage, you may need to further compile a boot.img from this. The Touchpad allows this since it needs the uImage for moboot.
rohan32 said:
Yeah I want to develop kernels mainly because I've never done it before for Android. I've developed for a Symbian device before since thats my current phone. The Touchpad is my first Android device, and I really hope to get a GNex soon as soon as it is brought to AT&T. If not, I'll probably either switch to VZ since AT&T is getting really annoying.
Click to expand...
Click to collapse
HTC ONE X<Should have been the Nexus instead of Samsung version.

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.

Categories

Resources