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 ?
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...
Hi, i am trying to build a simple u-boot that fast load kernel. I edited bootmode.c for hummingbird or ovation depending on which tablet i was testing. It looks like :
SORRY CANT POST LINK BUT IT WOULD HAVE BEEN:
github dot com/astarasikov/uboot-bn-nook-hd-fastboot/blob/master/board/bn_ovation/bootmode.c
Kernel command line for hummingbird :
vmalloc=768M init=/init rootwait omap_wdt.timer_margin=20 androidboot.hardware=hummingbird display.vendor=AUO boot.fb=b2600000
I replace uImage with the custom u-boot.bin i build no success.
I also tried to build the stock u-boot as provided by b&n or the one at :
SORRY CANT POST LINK BUT IT WOULD HAVE BEEN:
github dot com/fat-tire/u-boot-hummingbird-ovation
In this case i replaced the u-boot.bin with the u-boot.bin i generated (this one would load the second u-boot.bin that is uImage).
In all cases i used a working sdcard that can boot cyanogen fine with the provided u-boot.bin or uImage. Depending on which case i only replaced either u-boot.bin or uImage.
I tried building with several different toolchain :
debian-7.0.0-minimal-armel-2013-05-05.tar.xz
gcc-arm-none-eabi-4.4.1-2010q1-188-linux32.tar.gz (sourcery one)
gcc-linaro-4.4-2011.02-0.tar.bz2
gcc-linaro-arm-linux-gnueabi-2012.03-20120326_linux.tar.bz2
and android ics toolchain (gcc 4.4.3)
In no case i was able to build a working u-boot.bin (all compiled with proper path to toolchain with fully clean source tree and ARCH=arm and CROSS_COMPILE properly set). By the way i am able to build working kernel.
So what is it that i am missing ? Is there some magic patch to u-boot ?
Would appreciate any information, tips on what is it that i am doing wrong.
Thanks, keep up the good work.
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.
Obligatory first post on the forums here so hopefully this is the right place!
I have been lurking on the forums for the past month or so and have been working on building a custom kernel from source for the SM-G780F/DSC(Exynos) edition. I've built some kernels from source before so I have some experience there, but actually getting the kernel to flash and run on the device is a different story. I have built the kernel with the modifications that I wanted, fixed some flashing issues I was running into, finally got the boot.img to flash succefully to the device, rebooted the device and the phone just hangs at the Samsung logo. (See "Image from iOS.png").
Here is the steps that I did:
Unlock Bootloader on the device.USB Debugging on, OEM Unlocking enabled in dev settings/ OEM Lock: OFF(U) in DL mode.
Checked to make sure KG State is not Prenormal, it is in checking state.
Device is currently running stock G780FXXS7CUI5, so I download this version source from https://opensource.samsung.com/uploadSearch?searchValue=SM-G780F
Extract Kernel.tar.gz, update toolchain paths in the Makefile/build_kernel.sh, and I make some modifications to the defconfig file.
Code:
./build_kernel.sh
; Fix compiler errors/warnings as they appear. Rinse and repeat until the kernel is built.
Now that the kernel is built I pull the stock ROM that this device is currently running from Sammobile. https://www.sammobile.com/samsung/g.../SM-G780F/MID/download/G780FXXS7CUI5/1583411/
Extract the AP directory from the Sammobile ROM download.
Extract the boot.img.lz4 from the AP directory so I now have the uncompressed boot.img.
Copy over the the stock boot.img to my AIK directory. (AIK-Kinux-V3.8)
Code:
./unpackimg.sh boot.img
, cd into split_img, rm the stock boot.img-kernel
Move my custom kernel image to the AIK directory,
Code:
mv kernel_source/out/arch/arm64/boot/Image /AIK-Linux/split_img/boot.img-kernel
Run AIK repackimage.sh
Now I have a SM-G780G(Snapdragon edition) S20_FE with Magisk installed. So I copy over my image-new.img to this device and patch the image-new.img with Magisk
Move back the patched image to my linux enviroment. Rename my patched image boot.img.
Compress my boot img with
Code:
lz4 -B6 --content-size boot.img boot.img.lz4
.
Replace the stock boot.img.lz4 in my AP directory with my modded boot.img.lz4
Pull down a clean vbmeta.img from https://dl.google.com/developers/android/qt/images/gsi/vbmeta.img
Compress this image as well
Code:
lz4 -B6 --content-size vbmeta.img vbmeta.img.lz4
Replace the stock vbmeta.img.lz4 in the AP directory with my clean vbmeta.img.lz4 in the
So the contents of the AP directory currently is
Code:
22556009 Apr 7 12:57 boot.img.lz4
1155 Sep 23 2021 dqmdbg.img.lz4
219753 Sep 23 2021 dtbo.img.lz4
4096 Sep 23 2021 meta-data
1148 Sep 23 2021 metadata.img.lz4
2773 Sep 23 2021 misc.bin.lz4
35115127 Sep 23 2021 recovery.img.lz4
5457239441 Sep 23 2021 super.img.lz4
822394050 Sep 23 2021 userdata.img.lz4
2375 Apr 7 12:57 vbmeta.img.lz4
2812 Sep 23 2021 vbmeta_samsung.img.lz4
tarball all these files with
Code:
tar -cvf Modded_AP.tar *
Spin up latest version of ODIN
Place Custom AP into AP slot, Stock BL into BL slot, Stock CP into CP slot, and Stock HOME_CSC into CSC slot
Start Flashing.
Flashing is successful.
Device reboots, and hangs at the Samsung Galaxy S20FE Screen with the warning "I am not running samsungs official software."
A couple of questions I am asking myself is the stock vbmeta_samsung.img.lz4 necessary, as well as some of the other stock files? Is patching my boot.img with Magisk running on a different
device giving me issues? Am i missing a step somewhere or is there still extra steps I need to take to get a modded kernel running on this device. Any help would be greatly appreciated or if I need to provide any more insight please let me know! Thanks again!
you'd be extremely welcome in our little group
S20 FE Modding
Exynos AOSP: https://t.me/S20FE_Exy TurboUI: https://t.me/projectxs20fe Prime Kernel Snap: https:/t.mes20fesnapdragon Prime Kernel Exynos: https://t.me+vpzEK9kPMc41MmY9 Bandido Kernel https://t.me/bandidokernel Klimbo Kernel https://t.me/klimbokernel
t.me
there's also a kernel dev there from time to time who has built kernels for all versions FE completely blind, i.e. without being able to flash them himself. maybe we can get you two talking.
it sounds like you've added two kernels to your AP archive. as I understand it once you've built your kernel, compressed it to .lz4 you can just archive it inside a tar file and flash that alone (as long as it matches your firmware).
Hi there Buddy, so answering your questions- we dont need vbmeta everytime, we only use it once to flash twrp after which flashing vbmeta not necessary. Now yes patching boot.img with other device other than the one you are running causes problems here and device doesnt like to boot. As per the last kernel dev he just used our stock boot.img and compiled his changes. And we flash hi kernel like normal flash.
S20 FE Modding
Exynos AOSP: https://t.me/S20FE_Exy TurboUI: https://t.me/projectxs20fe Prime Kernel Snap: https:/t.mes20fesnapdragon Prime Kernel Exynos: https://t.me+vpzEK9kPMc41MmY9 Bandido Kernel https://t.me/bandidokernel Klimbo Kernel https://t.me/klimbokernel
t.me
You can even join this group, there are many people willing to help others.
Also i have been developing stock based roms for all the variants, so would be happy to test them once they get stable enough to boot.
Thanks for the responses everyone! I'll take my follow up questions to the group!
Hi. There are some kernel changes that is needed to be applied in order to successfully boot the custom kernel. I suggest you post the kernel source so I can review it. You don't need to place everything inside the AP. You can just archive the boot.img.lz4 as tar.
Also, a lot of your steps can be simplified by making a twrp-flashable zip instead. You can use my template here:
android_kernel_samsung_s20fe/AnyKernel3 at exynos · pascua28/android_kernel_samsung_s20fe
Custom kernel for Samsung S20 FE (Snapdragon and Exynos variants) - android_kernel_samsung_s20fe/AnyKernel3 at exynos · pascua28/android_kernel_samsung_s20fe
github.com
Just move the arch/arm64/boot/Image as zImage and you can zip the AnyKernel3 folder and there you have a twrp-flashable zip. It's a lot more convenient this way as people do not need to carry around their computers whenever they need to flash custom stuffs plus, it's more universal this way as they don't have to have a matching firmware version; it will just use the existing boot image, unpack it, replace the kernel, repack and then flash it back to the device.
If you have any questions, feel free to contact me on telegram (pascua14). I hope you succeed
Regards