CM9 boot.img source - Galaxy S I9000 Q&A, Help & Troubleshooting

Hi,
Could anybody tell me which are the bare minimum sources needed to compile a working cyoanogenmod 9 kernel boot.img?
I'm currently trying to compile one on my own but I can't afford to download the whole CM9 source due to the internet contract i have.
Thanks

Nobody? Ok then... May someone please copy and paste their makefile inside the root directory of his Android tree? (the one from wich they issue the command "make -j4 out/target/product/galaxysmtd/boot.img").

Maybe you could try cloning the android_build project and the teamhacksung buildscript project as well. Then adjust the buildscripts to point to the correct toolchain directory...

Boot.img contains the kernel. Therefore you need the kernel sources since at cm9 the kernel is build while compiling cm. You can find that sources at github (in project kernel_samsung_aries or something). You need to put this directory to your root directory of your android build system (there you have the device dir, frameworks, vendor etc). Rename it into kernel/samsung/aries. Then you should be able to build. It has worked like this for i9001, and it should also for i9000

You could also look at the kernel source of semaphore/devil. They use their own build script which does not require the full cm9 source, but only the kernel source. I made an adapted version of their scripts to build my own kernel...
Verstuurd van mijn GT-I9000

I think he already has:
__Pol__ said:
Nobody? "make -j4 out/target/product/galaxysmtd/boot.img"
Click to expand...
Click to collapse

Thanks everybody!
Sorry if the first two posts misled you.
I already have the kernel source. What I need are some instructions in order to build the boot.img from them. I can't download the whole source branch because I'm on a data diet .
Also a copy paste of the main make file is accepted.

I think this could help you:
http://forum.xda-developers.com/showthread.php?p=28096022
It's again for i9001 (sorry, but I own one ), but should also work

I think this could help you:
http://forum.xda-developers.com/show...php?p=28096022
It's again for i9001 (sorry, but I own one ), but should also work
Click to expand...
Click to collapse
Thanks. I've already tried the split_bootimg.pl but it did not work. According to sbuild.sh from semaphore kernel what i need to do is just "cp bzImage boot.img". I had already done it before but my phone did not boot up. It showed the bootloader logo but then nothing so something is wrong with the initramfs. Is the one included with the kernel sources correct or am I missing something?

So you can build the kernel? And just copying the kernel image to boot.img won't work. As you can see in the splitted boot.img from arco or anyone else, there are some other things needed.
I think you need to split it, replace the kernel image (zImage I thinl) and put all files again together (including the other files from the working boot.img).
No warranty on that, but that's what I understood

hahnjo said:
So you can build the kernel? And just copying the kernel image to boot.img won't work. As you can see in the splitted boot.img from arco or anyone else, there are some other things needed.
I think you need to split it, replace the kernel image (zImage I thinl) and put all files again together (including the other files from the working boot.img).
No warranty on that, but that's what I understood
Click to expand...
Click to collapse
Actually I can't split the boot.img because split_bootimg.pl does not work. The problem is in the initramfs and that is why I was asking for some advice about the sources needed. The auto-generated initramfs does not work.

__Pol__ said:
Actually I can't split the boot.img because split_bootimg.pl does not work. The problem is in the initramfs and that is why I was asking for some advice about the sources needed. The auto-generated initramfs does not work.
Click to expand...
Click to collapse
When I tried it, it worked... Are you sure that you have Pearl installed. Which OS do you use?
How do you generate initramfs?

I'm running Debian wheezy, pearl is installed. The script says it has not found android magic. The initramfs is automatically generated by the kernel source. I fear some files are missing here: https://github.com/CyanogenMod/android_kernel_samsung_aries
Do I need to get *bootimg from here?
https://github.com/CyanogenMod/android_device_samsung_aries-common
If yes how do I use these 2 scripts?

Sorry they're not two scripts but a script and a make file. From where does that makefile obtain the variables?

For splitting, did you use a running boot.img, e.g. from CM9 for your device?
You have two possibilities for building a running boot.img:
1) It is builded if you compile CM or AOSP or another ROM from Source (therefore you would need the complete sources)
2) You only build the Kernel and put it in an existing boot.img (for your phone of course) by just replacing the kernel.
For second you need to split an existing boot.img

Hi
Sent from my GT-S5830 using xda app-developers app

hahnjo said:
For splitting, did you use a running boot.img, e.g. from CM9 for your device?
You have two possibilities for building a running boot.img:
1) It is builded if you compile CM or AOSP or another ROM from Source (therefore you would need the complete sources)
2) You only build the Kernel and put it in an existing boot.img (for your phone of course) by just replacing the kernel.
For second you need to split an existing boot.img
Click to expand...
Click to collapse
Well, actually there's a third method. I need the initramfs source, the kernel source and the recovery source. After building I need to pack them together. Until yesterday I had only the sources for kernel and initramfs (?). Now I'll head for some sources for the recovery but I still need the main makefile (inside the Android directory) to know what commands I have to issue.
Sorry guys if I stil can't explain my problem to you. I really appreciate your patience and your helpful tips though.

You could look at devil/semaphore, as they use a complete initramfs, including recovery (both have a slightly different implementation).
Verstuurd van mijn GT-I9000

kasper_h said:
You could look at devil/semaphore, as they use a complete initramfs, including recovery (both have a slightly different implementation).
Verstuurd van mijn GT-I9000
Click to expand...
Click to collapse
Yep! I had a look there and I understood I was missing the recovery. Semaphore uses a custom amde initramfs and recovery whith load of scripts I don't need. I downloaded the CWM source from cyanogenmod git. There is only an Android.mk that obviously won't work. The question still remains: has anybody here downloaded the whole cyanogenmod source? If yes, may they post the makefile here please?

I have the whole CM sources, CM7 and CM9. Atm I can't access them because I'm on travel. I will return next week, maybe then.
Though, I think that it is impossible to extract the needed Makefiles. The Main-Makefile includes another makefile, but from then on several files are included which include again files. I stopped trying to understand it after the first 3 files...

Related

Building CM Kernel Discussion

Hey guys,
Currently I'm planning to learn a thing or two about building Kernel...
As per Knzo's posting at G+ here are the steps:
Manuel Saraiva - Oct 11, 2011 - Limited (locked)
Since I'm receiving so many requests on how to build and tune CM's kernel for Optimus Black, here's a short tutorial:
0. You'll need: a linux distro like ubuntu, some packages (check CM's wiki on how to build a kernel for a list of them) and some GB of free space.
1. Go to github.com/cyanogenmod/lge-kernel-sniper, download and extract.
2. You'll need a .config file to build. Either pull it from /proc/ (check CM's wiki on how to build a kernel for the full command) or build it from CM's defconfig (located in arch/arm/config).
3. Download a toolchain of your choice. CodeSourcery is fine. I personally use Linaro though.
4. Edit Makefile and change the ARCH flag to arm and the CROSS_COMPILER flag to your toolchain's bin folder, ending on arm-linux-eabi- or whatever.
5. Do the desired modifications.
6. Build. You'll get a zImage and the modules (.ko).
7. Since Koush's AnyKernel doesn't work on Black (afaik), just unpack a boot.img (obtained from a nandroid or something) using unpackbootimg tool or a kitchen like dsixda. Then replace the zImage, repack.
8. Now create a flashable package with the boot.img and the modules in /system/lib/modules.
Click to expand...
Click to collapse
Anyone tried it? If yes, please share your knowledge so we can learn together....
Currently i'm stack at Linaro setup, it has too much dependency and i'm failed to instal qemu-arm-static...
I tried to run ./configure but there is error
Error: zlib check failed
Make sure to have the zlib libs and headers installed.
Click to expand...
Click to collapse
I've tried to intall zlib, but still no luck......
Regardig to Linaro, you don't have to install anything.
Once all installed (previous to toolchain), you only have to download linaro (in my case linaro 4.5 to match gcc version) in .zip version (not binary to install) and decompress it into a certain folder. Then, you have to add linaro's folder to path and set CCOMPILER to new linaro's bin folder (+ the sufix of the files contained into it).
Regards.
hi, help me
after comand make ARCH=arm CROSS_COMPILE=$CCOMPILER -j`grep 'processor' /proc/cpuinfo | wc -l`
i have
mm/page-writeback.c: In function 'write_cache_pages':
mm/page-writeback.c:822: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[1]: *** [mm/page-writeback.o] Ошибка 1
make: *** [mm] Ошибка 2
make: *** Ожидание завершения заданий...
what is it?
Huexxx said:
Regardig to Linaro, you don't have to install anything.
Once all installed (previous to toolchain), you only have to download linaro (in my case linaro 4.5 to match gcc version) in .zip version (not binary to install) and decompress it into a certain folder. Then, you have to add linaro's folder to path and set CCOMPILER to new linaro's bin folder (+ the sufix of the files contained into it).
Regards.
Click to expand...
Click to collapse
I cannot get .config from /proc/ to build the kernel... where is it supposed to be?
At /proc/ you can found config.gz, but if you rename it to .config, you get it!
Huexxx said:
At /proc/ you can found config.gz, but if you rename it to .config, you get it!
Click to expand...
Click to collapse
I even cannot find config.gz from /proc/.. I am using Nova Rom anyway.. or should I use CM to get it?
Sent from my LG-P970 using XDA App
You need config.gz from a running kernel like the one you want to compile.
Then, if you want to compile CM7, you need config.gz from /proc/ of a OB with CM7 running.
If you don't have a OC with CM7, why do you want to compile that kernel?
Regards.
Huexxx said:
You need config.gz from a running kernel like the one you want to compile.
Then, if you want to compile CM7, you need config.gz from /proc/ of a OB with CM7 running.
If you don't have a OC with CM7, why do you want to compile that kernel?
Regards.
Click to expand...
Click to collapse
I see, thanks for the explaination Huexxx...
Right know I'm still on the stage of learning, it's still far away from dev-ing. And also OB is my only phone, so I can't experiment too much on it...
But I had boot.img from CM7 SK7-2 nand backup in my phone and I tried to extract the .config from it using script as told in CM wiki page:
Retrieve a working kernel config from the device, and unzip it:
adb pull /proc/config.gz /home/user_name/android/kernel/cm-kernel/config.gz
cat config.gz | gunzip > .config
Alternatively, you can pull the .config from the newest boot.img
scripts/extract-ikconfig boot.img > .config
Click to expand...
Click to collapse
But i got error:
scripts/extract-ikconfig boot.img > .config
bash: .config: Is a directory
Click to expand...
Click to collapse
Only two things:
- The boot.img from SK7-2 doesn't have config info.
- Where you are attemting to extract the file, seems to have a .config folder... Try with another name (config.gz for example) and then rename it...
Why not ask for a config.gz from anybody?
Huexxx said:
Only two things:
- The boot.img from SK7-2 doesn't have config info.
- Where you are attemting to extract the file, seems to have a .config folder... Try with another name (config.gz for example) and then rename it...
Why not ask for a config.gz from anybody?
Click to expand...
Click to collapse
I can't find config.gz neither...
I'll appreciate if someone provide me the file....
hi guys,i decide to join in
donwloading toolchain,very slow speed here

[Q] [Kernel] initramfs & j4fs

Hi all !
I'm new to custom kernel building, and after fairly long searches across the net, I still have some questions. About initramfs first, how do I build an initramfs image compatible with my kernel ? Which files should absolutely be included ? Any (Android-oriented) documentation on this ? I'm able to unpack a zImage and extract the corresponding initramfs, but should I modify some of the files before including them in my custom kernel (besides the modules) ?
Also, as far as I understand, the recovery image is included in the initramfs. If I want to change the recovery (to CWM, say), how should I do : nothing else than changing recovery related files ?
Then, I have found that there is the j4fs.ko module that is included in the Samsung stock kernels I've seen (KK9 and LB1). However, when I compile my kernel from the Samsung's sources, I do not get that module (and I don't find any corresponding sources). Any idea where I could find them, and if j4fs is necessary ?
Thank you !
how to update Kernel ?
Anyone ?

[DEV] Kexec-hardboot

PREAMBLE
Just to clear things up - I'm definitely not responsible for anything. This patch will not work on devices with locked bootloaders.
Tasssadar said:
This patch was made by Mike Kasick for Samsung Epic 4G. Since that, it was ported to several devices, one of them is Asus Transformer TF201 - I used patch from TF201 and modified it a bit (basically just changed few SoC specific constants). People at #ubuntu-arm helped me out with that, thanks.
For flo, I've improved the patch a bit - only the host needs to be patched now and I also fixed a bug with /proc/atags not reading all tags.
Click to expand...
Click to collapse
Thanks to omnirom - I used their kernel as a base.
Special thanks to Tasssadar for his kexec-hardboot patch for the Nexus 4. Also thanks to alvinhochun and krabappel2548. I borrowed some of their code.
WHAT'S KEXEC?
Tasssadar said:
It is syscall of Linux kernel, which allows you to boot another Linux kernel without restarting the device - "Linux boots itself". The functionality is equivalent to fastboot -c *cmdline* boot zImage initrd.img, but without PC and fastboot. It is fairly known thing, so more info at wikipedia and man kexec.
Standard kexec call unfortunatelly does not work on Nexus 4. It freezes somewhere, and it is very difficult to find out where - probably some of the drivers are not shut down/re-initialized properly, it is a commong thing among Android devices, which is why kexec-hardboot was made.
Click to expand...
Click to collapse
What is the difference between normal and hardboot kexec?
Tasssadar said:
Kexec-hardboot patch adds a real device restart to that process, so that all the drivers can be properly reinitialized. It stores new kernel to RAM, reboots the device as usual, and kernel from boot partition immediately jumps to the one which was stored to RAM before reboot.
Unlike grouper's kexec-hardboot patch, this one only requires the host kernel to be patched. This is one of the improvements I made, and I think it is pretty significant.
To sumarize the process:
kexec --load-hardboot.... is called and kernel it loaded into RAM.
kexec -e is called. Special info is written to memory (to area which is not overwritten on reboot) and the device is rebooted.
After reboot, very early in the boot process, kernel checks if that special info is present in RAM and if so, it loads new kernel from RAM and jumps to it.
Kexecd' kernel starts and boots.
For more info, read the original thread.
Click to expand...
Click to collapse
INSTRUCTIONs
Download kexec-hardboot-yuga.zip and unzip it
Flash my patched host kernel (kexec-kernel-20140808-yuga.zip)
Push initrd.img, kexec, kexec.sh and zImage to /cache
Use a terminal to do the following:
Code:
adb shell
su
cd cache
chmod 0755 kexec
sh ./kexec.sh
SOURCEs
Kexec-hardboot patch
Kernel
XDA:DevDB Information
Kexec-hardboot patch for Sony Xperia Z, Tool/Utility for the Sony Xperia Z
Contributors
Olivier
Version Information
Status: Testing
Created 2014-08-08
Last Updated 2014-08-08
I'm sorry I would like to ask a question. If I kexec boot my phone with yuga kernel and cwm, flashes the yuga ROM would it be possible to get dual booting the Yuga ROM?
Source: http://forum.xda-developers.com/showpost.php?p=19460677&postcount=25
Pretty old source but would it be possible?
xarive said:
I'm sorry I would like to ask a question. If I kexec boot my phone with yuga kernel and cwm, flashes the yuga ROM would it be possible to get dual booting the Yuga ROM?
Source: http://forum.xda-developers.com/showpost.php?p=19460677&postcount=25
Pretty old source but would it be possible?
Click to expand...
Click to collapse
Sure thing
Gesendet von meinem Xperia Z mit Tapatalk
Nice to see you got a Z now.
Will try this one out definitly
Sweet! Trying this out straight after work!
Beans
I am still not quite clear about dual booting with kexec. Did OP done it before?
Sent from my C6603 using Tapatalk 2
Can we load some other kernal on our devices using kexec without unlocking bootloader??
I had a Motorola atrix 2 which used to do this..:fingers-crossed:
siddhesh1609 said:
Can we load some other kernal on our devices using kexec without unlocking bootloader??
I had a Motorola atrix 2 which used to do this..:fingers-crossed:
Click to expand...
Click to collapse
No, LB Yuga's are missing kexec, even compiling a external kernel module is not possible as the zimage is missing some required symbols for kexec to work.
Hi. I want to split two kernels. cyanogenmod and multirom (not for xperia z.)
i have kexec, and it working under multirom kernel.
i have edited one kernel, to load init file from another.
I am trayed zimage from multirom kernel.
Now i cannot run both. i can run cm12 kernel, and rut multirom from there, but cm12 wont boot.
when i used zimage from cm12 kernel, i can boot into cm12, but not in multirom.
is there any command to kexec to load another zimage only, and run another init file?
i have init (cm12) and from there i can use sh commands. i want load initmr (multirecovery) with another zimage file.
is it possible?
gouster3 said:
Hi. I want to split two kernels. cyanogenmod and multirom (not for xperia z.)
i have kexec, and it working under multirom kernel.
i have edited one kernel, to load init file from another.
I am trayed zimage from multirom kernel.
Now i cannot run both. i can run cm12 kernel, and rut multirom from there, but cm12 wont boot.
when i used zimage from cm12 kernel, i can boot into cm12, but not in multirom.
is there any command to kexec to load another zimage only, and run another init file?
i have init (cm12) and from there i can use sh commands. i want load initmr (multirecovery) with another zimage file.
is it possible?
Click to expand...
Click to collapse
Ok... What?
vishal_android freak said:
Ok... What?
Click to expand...
Click to collapse
Is there any arguments for kexec to reboot with another zimage, and exec? i want to run initmr (init file)?
but without ramdisk wipe. (or load ramdisk from kernel partition)?? init file with zimage are there.
when i use "exec /initmr", it will boot, but touch not working, and i have screen-shift bug.
Or. another way. how i can get "hot boot" into some boot.img using kexec on my build-in kernel?

How do you compile a boot.img from a kernel source?

With the Note 3 using device tree (dtb) files, what is the new process to create a bootable kernel image without having to build the entire Android stack along with it? I'm working on porting kexec-hardboot to the CyanogenMod hlte kernel. I've compiled my kernel and it produces a zImage and a zImage-dtb. It also provides several msm8974-sec-hlte-r0X.dtb files in the arch/arm/boot directory which I assume are the compiled device tree images for the various HLTE revisions. I extracted a working kernel using the tools here: https://bitbucket.org/itsmikeramsay/mkbootimg/src and examined the extracted dt.img in a hex editor to find that it appears to contain all of these dtb files together. What tool is used to build this combined dtb image? I tried repacking the kernel I extracted with only my new initramfs (containing the kexecboot binary) and that worked, but repacking it with my new kernel (zImage) along with the old dt.img did not.
EDIT 1: I found this: http://forum.xda-developers.com/showthread.php?t=2469510 Looks like it could be what I'm after.
below, good luck
CalcProgrammer1 said:
With the Note 3 using device tree (dtb) files, what is the new process to create a bootable kernel image without having to build the entire Android stack along with it? I'm working on porting kexec-hardboot to the CyanogenMod hlte kernel. I've compiled my kernel and it produces a zImage and a zImage-dtb. It also provides several msm8974-sec-hlte-r0X.dtb files in the arch/arm/boot directory which I assume are the compiled device tree images for the various HLTE revisions. I extracted a working kernel using the tools here: https://bitbucket.org/itsmikeramsay/mkbootimg/src and examined the extracted dt.img in a hex editor to find that it appears to contain all of these dtb files together. What tool is used to build this combined dtb image? I tried repacking the kernel I extracted with only my new initramfs (containing the kexecboot binary) and that worked, but repacking it with my new kernel (zImage) along with the old dt.img did not.
EDIT 1: I found this: http://forum.xda-developers.com/showthread.php?t=2469510 Looks like it could be what I'm after.
Click to expand...
Click to collapse
I struggled with this for like a month. Download me
This is an updated version of the mkbootimg tools with support for device tree images. I think this is exactly what your looking for. You should be able to just overwrite the zImage and proper headers and it'll boot. Good luck! Message me if you have any issues. The older mkbootimg has issues parsing the device tree tables since it doesn't recognize them.
I got it working. The tools I posted work as well (not sure if they're the same or not, didn't check). My problem was not my build process but that my kernel/ramdisk made boot.img too large (>11.0MB) which made it fail to boot. I enabled XZ compression instead of LZMA and that took 3MB off my kernel size and allowed my build to fit, then it worked fine.
How to use the tools suggested
I was able to use xiaolu/mkbootimg_tools to create a recovery image, and flash my phone successfully. I want to know how to create a boot.img with code that I have compiled myself. I created my own dt.img, thanks to Xiaolu, and placed it in the recovery image mentioned above. I am trying to port a compiled code into my phone.

[SOLVED] Help building a custom kernel...

Whatever I do, my custom build kernels fail to boot. There's the ZUK logo very briefly, then device drops to bootloader screen. I'm out of ideas what I'm doing wrong, maybe someone here can give me a hint. :good:
I've tried with current AEX kernel git snapshot and also stock kernel sources. Building using the AEX_defconfig goes ok, I have Image.gz, replace it in previously extracted "stock" boot image and use mkbootimg.py to rebuild the new image. Offsets etc. are all correct (I think), like this: (from AEX)
Code:
kernel=kernel
ramdisk=ramdisk
page_size=4096
kernel_size=9101281
ramdisk_size=2671109
base_addr=0x80000000
kernel_offset=0x00008000
ramdisk_offset=0x01000000
tags_offset=0x00000100
cmd_line='androidboot.hardware=qcom ehci-hcd.park=3 lpm_levels.sleep_disabled=1 [email protected] buildvariant=userdebug'
board=""
format=gzip
But the damn new image won't boot, like described above. There has to be something (probably very stupid) I'm missing...
If I replace my own Image.gz with the originally extracted one and mkboot and so on, it's ok. So I guess it has something to do with my kernel build and/or environment. Are there any subsequent steps needed to do with the compiled kernel Image.gz? Or is it just my kernel config which is wrong? But I'm using the AEX defconfig (n7x-caf_z2_row_defconfig, to be exactly) so this should be fine, no?
Ok, I've got it. I had forgottten (=didn't know about at all) to append the device tree blob (arch\arm64\boot\dts\qcom\msm8996-v3-pmi8996-mtp.dtb) to kernel zImage... Simply cat'ing these together works!
Goodluck bro.
void23 said:
Ok, I've got it. I had forgottten (=didn't know about at all) to append the device tree blob (arch\arm64\boot\dts\qcom\msm8996-v3-pmi8996-mtp.dtb) to kernel zImage... Simply cat'ing these together works!
Click to expand...
Click to collapse
please explain .. what exactly i need to do with that file..

Categories

Resources