How to update only my Kernel not the entire ROM - Samsung Galaxy Nexus

So right now my phone is running android 4.04.
So I checked out the entire android 4.04 ics branch from the aosp project:
repo init -u h t t p s : / /android.googlesource.kom/platform/manifest -b android-4.0.4_r2.1
And then I go ahead and download the kernel source, change a few options in tuna_defconfig, make the kernel, and copy the zImage to the file:
devices/samsung/tuna/kernel
Now what? I know that in theory, I could build the entire AOSP project -- but I lack the proprietary binaries. How can I just get my updated kernel onto the device smoothly?
PS: I've done fastboot boot zImage -- but this gets me stuck at the Google home screen -- maybe because the modules are not packaged properly.

Well if you have clockwork recovery you can just clear cache then install the zip and then reboot, unless I am not understanding the problem here
Sent from my Galaxy Nexus

Yes, if I had a working zip file, that would be fine.
The way I understand it, I would need to:
1) Download all the source (for AOSP rom)
2) Download the kernel
3) Modify the kernel and build it. This outputs a zImage.
4) Copy the zImage to the stock AOSP kernel file (device/samsung/tuna/kernel)
5) Add proprietary binaries -- this does not exist for my device (toroplus sprint)
6) Make the entire project/ROM.
I don't know why steps 5 and 6 are necessary if I am just adding a couple lines to my kernel.

latecoder said:
Yes, if I had a working zip file, that would be fine.
The way I understand it, I would need to:
1) Download all the source (for AOSP rom)
2) Download the kernel
3) Modify the kernel and build it. This outputs a zImage.
4) Copy the zImage to the stock AOSP kernel file (device/samsung/tuna/kernel)
5) Add proprietary binaries -- this does not exist for my device (toroplus sprint)
6) Make the entire project/ROM.
I don't know why steps 5 and 6 are necessary if I am just adding a couple lines to my kernel.
Click to expand...
Click to collapse
The way I understand it, you would need to:
1) Download a stock ramdisk/unpack it
2) Download the kernel source
3) Modify the kernel and build it. This outputs a zImage.
4) Overwrite the zImage existing on the previously extracted ramdisk
5) Repack ramdisk/flash it through fastboot.
Another thing, it's easier to have modules builtin, than not.

Pick any custom kernel zip for your phone , replace the zimage using winrar and flash using cwm
sent from my limited edition red Gnex

Related

How to make and flash a kernel from Official Htc Froyo Kernel sources?

Hi,
I have a branded Desire which have been first unbranded (goldcard), OTA updated to latest Htc froyo update, and then Unrevoked 3.21+S-off 1.5 by alpharev.
Now, i want to make my own kernel from htc sources.
I know linux (using Gentoo for years), but process to flash a new kernel on an android device is not clear for me.
Is this link ok for Desire?
http://htcevohacks.com/htc-evo-hacks/how-to-build-your-own-htc-evo-4g-android-kernel/
Regards.
Sent from my HTC Desire using XDA App
I followed Cyanogen wiki for building the HTC Kernel as I found the toolchain from Codesourcery threw errors when trying to compile.
Obviously with the CyanogenMod guide, I don't clone the kernel from their git, instead I untar the HTC source.
I would be interested in hearing your findings, if you do try and compile with that toolchain.
As for flashing the Kernel, I just use koush's AnyKernel - drop the zImage into the kernel folder and then compress and sign, to make a flashable zip.
Mekrel said:
I followed Cyanogen wiki for building the HTC Kernel as I found the toolchain from Codesourcery threw errors when trying to compile.
Obviously with the CyanogenMod guide, I don't clone the kernel from their git, instead I untar the HTC source.
I would be interested in hearing your findings, if you do try and compile with that toolchain.
As for flashing the Kernel, I just use koush's AnyKernel - drop the zImage into the kernel folder and then compress and sign, to make a flashable zip.
Click to expand...
Click to collapse
Yeah, basically this. It's pretty straightforward, it can just be a bit finicky sometimes.
Hi,
Thanks for answers.
Mekrel:
For the Sourcery compiler, I have same results as yours: errors and does not compile.
I believe HTC are working with the "google" toolchain, so their sources are not veryfied to work with another compiler.
Using the Cyanogen compile way ( with "google" toolchain), it does compile fine.
I'm happy to see this option in the kernel (Change Cpu Policy While Screen is ON/OFF), but I wonder why it is not activated by default... :
http://img833.imageshack.us/img833/3668/desiredefault.jpg
With changes made:
http://img145.imageshack.us/img145/3707/desiremodified.jpg
It would certainly be better than using SetCpu for me ( I'm using it just to force cpu at 245MHz when screen is off), and not need to hack HTC performance lock feature since I don't want to underclock or overclock my Cpu.
Now I just have to test it...but I do have few questions before doing that:
I can use koush's AnyKernel tool to flash my new zImage, but in case all goes wrong? How to revert back?
-->Can I save my actual boot.img in sdcard, and in case flash process goes wrong revert back to my actual boot.img?
Please help if possible with detailed process (or a web link but I have not being able to find a detailed process for Desire).
Regards.
Edit: Seems for me that Kouch's tool will not reuse my ramdisk, but another one?
-->I just want being able to modify my kernel, so I prefer to reuse ramdisk which is actually in my boot.img if possible.
-->I have tried this way: http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack%2C_Edit%2C_and_Re-Pack_Boot_Images, but script provided on this link gave me error because my boot.img has a "Second Stage".
Judge584 said:
Hi,
Thanks for answers.
Mekrel:
For the Sourcery compiler, I have same results as yours: errors and does not compile.
I believe HTC are working with the "google" toolchain, so their sources are not veryfied to work with another compiler.
Using the Cyanogen compile way ( with "google" toolchain), it does compile fine.
I'm happy to see this option in the kernel (Change Cpu Policy While Screen is ON/OFF), but I wonder why it is not activated by default... :
http://img833.imageshack.us/img833/3668/desiredefault.jpg
With changes made:
http://img145.imageshack.us/img145/3707/desiremodified.jpg
It would certainly be better than using SetCpu for me ( I'm using it just to force cpu at 245MHz when screen is off), and not need to hack HTC performance lock feature since I don't want to underclock or overclock my Cpu.
Now I just have to test it...but I do have few questions before doing that:
I can use koush's AnyKernel tool to flash my new zImage, but in case all goes wrong? How to revert back?
-->Can I save my actual boot.img in sdcard, and in case flash process goes wrong revert back to my actual boot.img?
Please help if possible with detailed process (or a web link but I have not being able to find a detailed process for Desire).
Regards.
Edit: Seems for me that Kouch's tool will not reuse my ramdisk, but another one?
-->I just want being able to modify my kernel, so I prefer to reuse ramdisk which is actually in my boot.img if possible.
-->I have tried this way: http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack%2C_Edit%2C_and_Re-Pack_Boot_Images, but script provided on this link gave me error because my boot.img has a "Second Stage".
Click to expand...
Click to collapse
You can backup via:
Code:
cat /dev/mtd/mtd2 > /sdcard/mtd2.img
Then you can use fastboot to flash boot:
Code:
fastboot flash boot mtd2.img
The guide you linked to doesn't recommend trying to split the boot.img from your phone (in this example, mtd2.img) due to possible corruption issues, which is why I went for Koush' AnyKernel.
So what you're saying is you can't get the ramdisk from your boot.img via:
Code:
% mkdir ramdisk
cd ramdisk
gzip -dc ../boot.img-ramdisk.gz | cpio -i
as this is the part that throws the error?
no, errors came from the perl scripts posted on the link http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
So to resume:
Code:
cat /dev/mtd/mtd2 > /sdcard/mtd2.img
will backup my boot.img but it may be corrupted
Code:
fastboot flash boot mtd2.img
will restore it but if it's corrupted then it's useless.
Why can it be corrupted?
Why not possible to flash this way, without the hassle of dealing with boot.img?:
Code:
fastboot flash zimage zImage
Edit:
OK, I have done some search: please confirm this procedure to be safe to flash a modified kernel:
1°)Make an Nandroid Backup
2°)Since my Desire is rooted and S-OFFed it does not need any-more signed files, so for me I just have to put my new wifi kernel module (bcm4329.ko) to /system/lib/modules/bcm4329.ko (via adb push)
3°And then flash the new kernel zImage in fastboot using this command:
Code:
fastboot flash zimage zImage
4°)Once done: I will have to power off my Desire.
5°)Then, Power it on again in bootloader mode, wait for 3 seconds and then go to fastboot: the zImage should now start flashing automaticaly.
6°)Once done: reboot to test my new kernel.
7°)In case something goes wrong, all I will have to do is to restore boot via my Nandroid backup and all will be fine.
If someone can confirm this procedure to be right and safe, thank you.
Best Regards.
Ok, my new kernel is ready.
Does someone can confirm that step 1 to 7 in previous post are corrects?
Sent from my HTC Desire using XDA App
The 7 steps you posted look about right - I'm not entirely sure about #3, I don't have much experience in fastboot flashing. You might be better off using AnyKernel and flashing that in recovery.
It works good!
Thanks a lot.
Sent from my HTC Desire using XDA App

[HOWTO][KERNEL][G800F][exynos] Custom kernel tutorial

This is a short tutorial on how to compile and flash a (customized) Linux kernel on your G800F.
Note that this tutorial is only for the G800F as G800H/M/Y/... have a totally different architecture (SoC,...).
Toolchain
First of all get a decent toolchain (gcc,...). There are some prebuilt ones at android.googlesource.com.
If you have git installed fetch the arm-eabi-4.6 toolchain with:
Code:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
Other toolchains might work but I had no luck with a Linaro toolchain optimized for the Cortex-A7 (ARM-architecture of the Exynos 3470) - the kernel did not boot at all.
Also the arm-eabi-4.8 toolchain from android.googlesource.com aborted with a compile error, so use the 4.6 version.
Fetch the Linux Kernel sources
Now you have to fetch the kernel sources. At the moment there are only the official sources from Samsung's open source server.
http://opensource.samsung.com/reception/receptionSub.do?method=sub&sub=F&searchValue=SM-G800F
Select a source package:
The source packages at this server contain the kernel sources (Kernel.tar.gz), some part of the Android system (Platform.tar.gz) and some build instructions (README_*). There are multiple versions of the source packages. You can find an explanation of the versioning scheme here: samsung-firmware-version-number.html
For example the version part of a source package G800FXXU1ANG1 is NG1 which stands for N=2014, G=July, 1=1st release.
G800FXXU1ANJ2 is N=2014, J=October, 2nd release.
In addition Samsung adds country code post-fixes like "_MEA" which might contain regional adaptions. See http://forum.xda-developers.com/showpost.php?p=57410625&postcount=5 for an explanation and list of country codes. For example MEA probably stands for "MIDDLE EAST ASIA".
So the newest source packages are G800FXXU1ANG1 and G800FXXU1ANG4 (MEA). I compared the kernel sources of both packages and found no difference. Seems as if only the Android part was changed. Both are from July so not very up-to-date. At least they are based on a 3.4.39 kernel which matches the kernel version of G800FXXU1ANL1.
Mirror:
Note that downloading a source package from Samsung's Open Source server takes a lot of time as the download speed is very poor. It took 12-24 hours for me.
You can also download the sources from my github repository:
https://github.com/tobigun/samsung-kernel-smg800f
At the moment the master contains the G800FXXU1ANG1 kernel sources but might be updated as soon as a newer kernel source is released.
Compile the Kernel
Prepare the build by applying the S5 Mini kernel config:
Code:
ARCH=arm CROSS_COMPILE=<PATH_TO_TOOLCHAIN>/bin/arm-eabi- make kminilte_00_defconfig
If you want to change the config now, you can do this with:
Code:
ARCH=arm CROSS_COMPILE=<PATH_TO_TOOLCHAIN>/bin/arm-eabi- make menuconfig
After you have done some changes to the kernel sources you can build it with:
Code:
ARCH=arm CROSS_COMPILE=<PATH_TO_TOOLCHAIN>/bin/arm-eabi- make -j4
If you do not want to build with multiple CPUs you can remove the "-j4" from the command line (which also is handy if an error occurred).
In either case the resulting kernel image will be in "arch/arm/boot/zImage".
Note that kernel module support is disabled in the S5 mini config so everything you need (all drivers, ...) is in the zImage. There is no need to copy additional kernel modules to the filesystem.
Flashing the Kernel
Almost done. It is not possible to flash the kernel image directly. Instead you have to put the kernel image and a ramdisk together into a flasable boot.img. The easiest way to get such a boot.img is to use an existing boot.img and replace just the kernel image.
1. Get a decent boot.img
There are at least two ways:
a) Download the current firmware image from SamMobile (http://www.sammobile.com/firmwares/database/SM-G800F/) and extract the boot.img. With 7-zip there will be an error message if you extract the .tar.md5 inside the zip - just ignore the message and extract the boot.img file.
b) Extract the current boot.img from the device's flash with (root required):
Connect to the device (with "adb shell" or ssh).
Then copy the contents of the boot-partition to a file:
Code:
dd if=/dev/block/mmcblk0p9 of=boot.img
2. Replace kernel image
For this step AIK (Android Image Kitchen) is required.
Download it at http://forum.xda-developers.com/showthread.php?t=2073775. Probably you want AIK-Linux-v1.7-ALL.tar.gz (or newer).
Extract the files.
Now unpack the boot image, replace the kernel image and repack it (with the original ramdisk) to a new boot.img:
Code:
./unpackimg.sh boot.img
cp <KERNEL_BUILD_DIR>/arch/arm/boot/zImage split_img/boot.img-zImage
./repackimg.sh --original
Note that the zImage name inside split_img might differ from boot.img-zImage.
The new boot.img is "image-new.img". Rename it to boot.img and flash it.
3. Flash new boot.img
Important notice:
- You flash this image at your own responsibility. I am not responsible for any damage that might be caused by flashing this image (bricked device, lost data, ...)
- Flashing this kernel image will trigger the KNOX counter, so your warranty will be void.
- The image is only for S5 Mini SM-G800F (Exynos)
- The kernel might be instable, crash your device, drain your battery, or even might damage your smartphone
- Backup your data before flashing
- Make sure you have the current firmware of your device (e.g. from SamMobile) so you can flash it back in case something goes wrong.
There are multiple ways to flash the boot.img to your device:
a) From recovery with an update.zip
b) Using Odin
c) Directly with dd
a) From recovery with an update.zip
TODO
b) Using Odin
Create tar.md5:
At least some versions of Odin3 (e.g. v3.07) need a tar.md5 instead of a "simple" tar file. Although a simple tar-file can be selected in Odin, the image will not be flashed correctly.
Download tar-Tool_Odin3-v3.07_by_mkh.mourad.zip
Extract it.
On windows copy the boot.img file into the tar-Tool folder first and then drag and drop the boot.img on ImgToTar.MD5.bat. Alternatively you can also pass the filename as a command line parameter to ImgToTar.MD5.bat.
Now you should have a boot.tar.md5.
Flash tar.md5:
Download Odin (for example Odin3-v3.07 contained in CF-Auto-Root)
Reboot your device into Odin mode: turn off your device, then press Volume-Down + Home + Power button at the same time and release them. Confirm the following message with the Volume-Up button.
Connect your device to your PC via USB
Make sure the device driver's are installed on your PC
Start Odin
Select PDA and select the kernel image (boot.tar.md5)
Check that only "Auto Reboot" and "F. Reset Time" is set
Click on "Start": the kernel image should be flashed now and the device should reboot afterwards
c) Directly with dd
Connect to the device (with "adb shell" or ssh).
Then copy the contents of the boot.img file to the boot-partition:
Code:
dd if=boot.img of=/dev/block/mmcblk0p9
Reboot
Done
You can now check in "Settings - Device Info - Kernel-Version" if your kernel is used.
Reserved

[HOWTO][KERNEL][G800H][msm8228] Custom kernel tutorial

This is a short tutorial on how to compile and flash a (customized) Linux kernel on your G800H.
Note that this tutorial is only for the G800H as G800F/M/Y/... have a totally different architecture (SoC,...).
Toolchain
First of all get a decent toolchain (gcc,...). There are some prebuilt ones at android.googlesource.com.
If you have git installed fetch the arm-eabi-4.6 toolchain with:
Code:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
Fetch the Linux Kernel sources
Now you have to fetch the kernel sources. At the moment there are only the official sources from Samsung's open source server.
http://opensource.samsung.com/reception/receptionSub.do?method=sub&sub=F&searchValue=SM-G800H
Select a source package:
The source packages at this server contain the kernel sources (Kernel.tar.gz), some part of the Android system (Platform.tar.gz) and some build instructions (README_*). There are multiple versions of the source packages. You can find an explanation of the versioning scheme here: samsung-firmware-version-number.html
For example the version part of a source package G800HXXU1ANGG is NGG which stands for N=2014, G=July, G=release G.
In addition Samsung adds country code post-fixes like "_LA" which might contain regional adaptions. See http://forum.xda-developers.com/showpost.php?p=57410625&postcount=5 for an explanation and list of country codes
SER: RUSSIA
SWA: SOUTH WEST ASIA
MEA: unknown (maybe MIDDLE EAST ASIA?)
LA: unknown (could be ATLANTIC, as kernel config for G800H LA is named: msm8228-sec_atlantic3geur_defconfig)
SKZ = KAZAKHSTAN
As every source package for the G800H has a different country code it is hard to determine which one to use. Probably the regional differences only concern the Android system but not the kernel. According to the versioning scheme the last release should be G800HXXU1ANGG (LA).
Mirror:
Note that downloading a source package from Samsung's Open Source server takes a lot of time as the download speed is very poor. It took 12-24 hours for me.
You can also download the sources from my github repository:
https://github.com/tobigun/samsung-kernel-smg800h
At the moment the master contains the G800HXXU1ANGG kernel sources but might be updated as soon as a newer kernel source is released.
Compile the Kernel
Prepare the build by applying the S5 Mini kernel config:
Code:
ARCH=arm CROSS_COMPILE=<PATH_TO_TOOLCHAIN>/bin/arm-eabi- make msm8226-sec_defconfig VARIANT_DEFCONFIG=msm8228-sec_atlantic3geur_defconfig
If you want to change the config now, you can do this with:
Code:
ARCH=arm CROSS_COMPILE=<PATH_TO_TOOLCHAIN>/bin/arm-eabi- make menuconfig
After you have done some changes to the kernel sources you can build it with:
Code:
ARCH=arm CROSS_COMPILE=<PATH_TO_TOOLCHAIN>/bin/arm-eabi- make -j4
If you do not want to build with multiple CPUs you can remove the "-j4" from the command line (which also is handy if an error occurred).
In either case the resulting kernel image will be in "arch/arm/boot/zImage".
Flashing the Kernel
Almost done. It is not possible to flash the kernel image directly. Instead you have to put the kernel image and a ramdisk together into a flasable boot.img. The easiest way to get such a boot.img is to use an existing boot.img and replace just the kernel image.
1. Get a decent boot.img
Download the current firmware image from SamMobile (http://www.sammobile.com/firmwares/database/SM-G800H/) and extract the boot.img. With 7-zip there will be an error message if you extract the .tar.md5 inside the zip - just ignore the message and extract the boot.img file.
2. Replace kernel image
For this step AIK (Android Image Kitchen) is required.
Download it at http://forum.xda-developers.com/showthread.php?t=2073775. Probably you want AIK-Linux-v1.7-ALL.tar.gz (or newer).
Extract the files.
Now unpack the boot image, replace the kernel image and repack it (with the original ramdisk) to a new boot.img:
Code:
./unpackimg.sh boot.img
cp <KERNEL_BUILD_DIR>/arch/arm/boot/zImage split_img/boot.img-zImage
./repackimg.sh --original
Note that the zImage name inside split_img might differ from boot.img-zImage.
The new boot.img is "image-new.img". Rename it to boot.img and flash it.
3. Flash new boot.img
Important notice:
- You flash this image at your own responsibility. I am not responsible for any damage that might be caused by flashing this image (bricked device, lost data, ...)
- Flashing this kernel image will trigger the KNOX counter, so your warranty will be void.
- The image is only for S5 Mini SM-G800H (msm8228)
- The kernel might be instable, crash your device, drain your battery, or even might damage your smartphone
- Backup your data before flashing
- Make sure you have the current firmware of your device (e.g. from SamMobile) so you can flash it back in case something goes wrong.
There are multiple ways to flash the boot.img to your device:
a) From recovery with an update.zip
b) Using Odin
a) From recovery with an update.zip
TODO
b) Using Odin
Create tar.md5:
At least some versions of Odin3 (e.g. v3.07) need a tar.md5 instead of a "simple" tar file. Although a simple tar-file can be selected in Odin, the image will not be flashed correctly.
Download tar-Tool_Odin3-v3.07_by_mkh.mourad.zip
Extract it.
On windows copy the boot.img file into the tar-Tool folder first and then drag and drop the boot.img on ImgToTar.MD5.bat. Alternatively you can also pass the filename as a command line parameter to ImgToTar.MD5.bat.
Now you should have a boot.tar.md5.
Flash tar.md5:
Download Odin (for example Odin3-v3.07 contained in CF-Auto-Root)
Reboot your device into Odin mode: turn off your device, then press Volume-Down + Home + Power button at the same time and release them. Confirm the following message with the Volume-Up button.
Connect your device to your PC via USB
Make sure the device driver's are installed on your PC
Start Odin
Select PDA and select the kernel image (boot.tar.md5)
Check that only "Auto Reboot" and "F. Reset Time" is set
Click on "Start": the kernel image should be flashed now and the device should reboot afterwards
Done
You can now check in "Settings - Device Info - Kernel-Version" if your kernel is used.
The topic is wrong: the G800H does not have an exynos SoC but a msm8228. Unfortunately I cannot change the topic name.
Reserved
hennymcc said:
This is a short tutorial on how to compile and flash a (customized) Linux kernel on your G800H.
Note that this tutorial is only for the G800H as G800F/M/Y/... have a totally different architecture (SoC,...).
Toolchain
First of all get a decent toolchain (gcc,...). There are some prebuilt ones at android.googlesource.com.
If you have git installed fetch the arm-eabi-4.6 toolchain with:
Code:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
Fetch the Linux Kernel sources
Now you have to fetch the kernel sources. At the moment there are only the official sources from Samsung's open source server.
http://opensource.samsung.com/reception/receptionSub.do?method=sub&sub=F&searchValue=SM-G800H
Select a source package:
The source packages at this server contain the kernel sources (Kernel.tar.gz), some part of the Android system (Platform.tar.gz) and some build instructions (README_*). There are multiple versions of the source packages. You can find an explanation of the versioning scheme here: samsung-firmware-version-number.html
For example the version part of a source package G800HXXU1ANGG is NGG which stands for N=2014, G=July, G=release G.
In addition Samsung adds country code post-fixes like "_LA" which might contain regional adaptions. See http://forum.xda-developers.com/showpost.php?p=57410625&postcount=5 for an explanation and list of country codes
SER: RUSSIA
SWA: SOUTH WEST ASIA
MEA: unknown (maybe MIDDLE EAST ASIA?)
LA: unknown (could be ATLANTIC, as kernel config for G800H LA is named: msm8228-sec_atlantic3geur_defconfig)
SKZ = KAZAKHSTAN
As every source package for the G800H has a different country code it is hard to determine which one to use. Probably the regional differences only concern the Android system but not the kernel. According to the versioning scheme the last release should be G800HXXU1ANGG (LA).
Mirror:
Note that downloading a source package from Samsung's Open Source server takes a lot of time as the download speed is very poor. It took 12-24 hours for me.
You can also download the sources from my github repository:
https://github.com/tobigun/samsung-kernel-smg800h
At the moment the master contains the G800HXXU1ANGG kernel sources but might be updated as soon as a newer kernel source is released.
Compile the Kernel
Prepare the build by applying the S5 Mini kernel config:
Code:
ARCH=arm CROSS_COMPILE=<PATH_TO_TOOLCHAIN>/bin/arm-eabi- make msm8226-sec_defconfig VARIANT_DEFCONFIG=msm8228-sec_atlantic3geur_defconfig
If you want to change the config now, you can do this with:
Code:
ARCH=arm CROSS_COMPILE=<PATH_TO_TOOLCHAIN>/bin/arm-eabi- make menuconfig
After you have done some changes to the kernel sources you can build it with:
Code:
ARCH=arm CROSS_COMPILE=<PATH_TO_TOOLCHAIN>/bin/arm-eabi- make -j4
If you do not want to build with multiple CPUs you can remove the "-j4" from the command line (which also is handy if an error occurred).
In either case the resulting kernel image will be in "arch/arm/boot/zImage".
Flashing the Kernel
Almost done. It is not possible to flash the kernel image directly. Instead you have to put the kernel image and a ramdisk together into a flasable boot.img. The easiest way to get such a boot.img is to use an existing boot.img and replace just the kernel image.
1. Get a decent boot.img
Download the current firmware image from SamMobile (http://www.sammobile.com/firmwares/database/SM-G800H/) and extract the boot.img. With 7-zip there will be an error message if you extract the .tar.md5 inside the zip - just ignore the message and extract the boot.img file.
2. Replace kernel image
For this step AIK (Android Image Kitchen) is required.
Download it at http://forum.xda-developers.com/showthread.php?t=2073775. Probably you want AIK-Linux-v1.7-ALL.tar.gz (or newer).
Extract the files.
Now unpack the boot image, replace the kernel image and repack it (with the original ramdisk) to a new boot.img:
Code:
./unpackimg.sh boot.img
cp <KERNEL_BUILD_DIR>/arch/arm/boot/zImage split_img/boot.img-zImage
./repackimg.sh --original
Note that the zImage name inside split_img might differ from boot.img-zImage.
The new boot.img is "image-new.img". Rename it to boot.img and flash it.
3. Flash new boot.img
Important notice:
- You flash this image at your own responsibility. I am not responsible for any damage that might be caused by flashing this image (bricked device, lost data, ...)
- Flashing this kernel image will trigger the KNOX counter, so your warranty will be void.
- The image is only for S5 Mini SM-G800H (msm8228)
- The kernel might be instable, crash your device, drain your battery, or even might damage your smartphone
- Backup your data before flashing
- Make sure you have the current firmware of your device (e.g. from SamMobile) so you can flash it back in case something goes wrong.
There are multiple ways to flash the boot.img to your device:
a) From recovery with an update.zip
b) Using Odin
a) From recovery with an update.zip
TODO
b) Using Odin
Create tar.md5:
At least some versions of Odin3 (e.g. v3.07) need a tar.md5 instead of a "simple" tar file. Although a simple tar-file can be selected in Odin, the image will not be flashed correctly.
Download tar-Tool_Odin3-v3.07_by_mkh.mourad.zip
Extract it.
On windows copy the boot.img file into the tar-Tool folder first and then drag and drop the boot.img on ImgToTar.MD5.bat. Alternatively you can also pass the filename as a command line parameter to ImgToTar.MD5.bat.
Now you should have a boot.tar.md5.
Flash tar.md5:
Download Odin (for example Odin3-v3.07 contained in CF-Auto-Root)
Reboot your device into Odin mode: turn off your device, then press Volume-Down + Home + Power button at the same time and release them. Confirm the following message with the Volume-Up button.
Connect your device to your PC via USB
Make sure the device driver's are installed on your PC
Start Odin
Select PDA and select the kernel image (boot.tar.md5)
Check that only "Auto Reboot" and "F. Reset Time" is set
Click on "Start": the kernel image should be flashed now and the device should reboot afterwards
Done
You can now check in "Settings - Device Info - Kernel-Version" if your kernel is used.
Click to expand...
Click to collapse
====================================
Hi.. Im from Venezuela.. And i need help.. I have a S5 mini SM-G800H in QHSUSB-DLOAD.. I need the debrick.img for AOS 6.0 please.. Thank you so much for your help..
Please tell u, how I can build a custom kernel for the build LineageOS-14 for S5 mini SM-G800H?

Bootloop after flashing AOSP 8.0.0 to Pixel XL.

Hello everyone. I have a problem.
I'm building AOSP 8.0.0_r11 for Pixel XL and when I flash the result zip I'm getting a bootloop.
How am I building?
1) Select java 1.8
2) cd AOSP_8.0
3) source build/ensetup.sh
4) lunch aosp_marlin-userdebug
5) make -j9 updatepackage
6) wait a couple of hours
7) PROFIT
I know the ROM needs vendor blobs, I have them downloaded, extracted and extracted from .sh files.
How does the bootloop look?
Power On->Message about unlocked bootloader->0.5 second of white screen with Android on it-> reboot->repeat.
How do I flash the ROM?
I tried:
1) fastboot update -w aosp_marlin-img-eng.user.zip
and
2) extracted everything from zip and fastboot flash --slot _a PARTITION IMG_FILE
What am I doing wrong? Did anyone have success in building AOSP for this phone?
Did you "make clobber" after installing the drivers? If not, run it then try your make command again.
Alternatively, try "make otapackage" instead of "updatepackage" and then flash it in fastboot.
Also, why are you using the -j9 parameter?
noidea24 said:
Did you "make clobber" after installing the drivers? If not, run it then try your make command again.
Alternatively, try "make otapackage" instead of "updatepackage" and then flash it in fastboot.
Also, why are you using the -j9 parameter?
Click to expand...
Click to collapse
I did "make clobber". It just removes the build directory like "make clean". And this step is redundant if you never built the system before (with or without binaries).
Why make -j9? Because it shows better performance than just make. I know the build system should get the cores number and set the number of build threads, but for some reasons it doesn't do it very well.
P.S. I tried to "make" without -j9 and it is MUCH slower than with -j9.
Are you using the most updated fastboot and adb and sure your computer's variables aren't using an older one also? That was my issue when flashing Oreo.
buru898 said:
Are you using the most updated fastboot and adb and sure your computer's variables aren't using an older one also? That was my issue when flashing Oreo.
Click to expand...
Click to collapse
I'm using those that come with Android Studio 2.3.3 updated to latest versions of all components. That's not the problem with slots support - everything flashes without errors.
Slavon-93 said:
Hello everyone. I have a problem.
I'm building AOSP 8.0.0_r11 for Pixel XL and when I flash the result zip I'm getting a bootloop.
How am I building?
1) Select java 1.8
2) cd AOSP_8.0
3) source build/ensetup.sh
4) lunch aosp_marlin-userdebug
5) make -j9 updatepackage
6) wait a couple of hours
7) PROFIT
I know the ROM needs vendor blobs, I have them downloaded, extracted and extracted from .sh files.
How does the bootloop look?
Power On->Message about unlocked bootloader->0.5 second of white screen with Android on it-> reboot->repeat.
How do I flash the ROM?
I tried:
1) fastboot update -w aosp_marlin-img-eng.user.zip
and
2) extracted everything from zip and fastboot flash --slot _a PARTITION IMG_FILE
What am I doing wrong? Did anyone have success in building AOSP for this phone?
Click to expand...
Click to collapse
More than those blobs are necessary. Look at a invisibleks marlin lineageos device tree to get an idea of what files need to extracted and put in vendor.
Make clobber also cleans out configuration files, in case some of them had been created before the drivers/binaries have been extracted. Speaking of binaries again, did you install the Qualcomm ones?
My build environment is a i7 3770, with 8gb ram, and two blues in raid 0. To get my build compiled correctly, I had to disable ninja and I used -j8.
******
Tomorrow, I'll run a update and build Oreo on my machine from a clean directory and I'll get back with times before end after ccache is filled.
npjohnson said:
More than those blobs are necessary. Look at a invisibleks marlin lineageos device tree to get an idea of what files need to extracted and put in vendor.
Click to expand...
Click to collapse
Well, I don't know about Pixel, but when I had some experience in building AOSP for Nexus 5, Nexus 6, Nexus 9, binaries from Google and Qualcomm were a required minimum to get system booted. And if I wanted to get rid of some errors in logcat, I had to add some additional libraries, but the system booted and worked.
noidea24 said:
Speaking of binaries again, did you install the Qualcomm ones?
Click to expand...
Click to collapse
Yes, of course. I went to google binaries section, selected marlin 8.0.0 and downloaded two .sh files - one from Google, and the other from Qualcomm. Then I extracted them and got a vendor forder which has google_devices/marlin and qcom/marlin folders inside.
I'm curious to know how your process to flash the rom zip works? I've been sitting on a rom build for days because I can't get Twrp to work properly. Also, if your worried about your blobs/vendors the repos are starting to show up on GitHub.
cjkacz said:
I'm curious to know how your process to flash the rom zip works? I've been sitting on a rom build for days because I can't get Twrp to work properly. Also, if your worried about your blobs/vendors the repos are starting to show up on GitHub.
Click to expand...
Click to collapse
I'm sorry if I misundestood the question. I don't undestand why you should need TWRP because you just get the sources, get the blobs, compile them and get a zip file which can be flashed with fastboot command. So, no TWRP in this process is needed. I still don't know how all these ROM creators make zips for flashing with TWRP...
So I was able to get AOSP booting using the basic steps and blobs provided from the script. Even was able to activate the always on display
Zavon said:
So I was able to get AOSP booting using the basic steps and blobs provided from the script. Even was able to activate the always on display
Click to expand...
Click to collapse
Can you, please, describe in details these things:
1) What Linux did you use for building?
2) What revision of AOSP 8.0.0 did you download?
3) What version of blobs did you use?
4) Did you just download the 2 blobs .sh files to the root of the sources and execute them?
5) What AOSP configuration did you choose for building? (I mean aosp_marlin-userdebug or aosp_marlin_svelte-userdebug or aosp-sailfish-userdebug)
6) What command did you use for building?
7) Did you use ccache?
8) Did you flash Google Factory image of Oreo before flashing AOSP?
9) What command did you use to flash?
Slavon-93 said:
Can you, please, describe in details these things:
1) What Linux did you use for building?
2) What revision of AOSP 8.0.0 did you download?
3) What version of blobs did you use?
4) Did you just download the 2 blobs .sh files to the root of the sources and execute them?
5) What AOSP configuration did you choose for building? (I mean aosp_marlin-userdebug or aosp_marlin_svelte-userdebug or aosp-sailfish-userdebug)
6) What command did you use for building?
7) Did you use ccache?
8) Did you flash Google Factory image of Oreo before flashing AOSP?
9) What command did you use to flash?
Click to expand...
Click to collapse
I'm using a base ubuntu vm I built with 2 cores and 8gb ram. I used r11 if memory serves correct. I used the scripts from google and extracted from the factory image. The configuration I used is 21 (marlin-userdebug). I just used make -j8. Could careless about an update zip. And the factory image was on before I flashed using fastboot.
Side note, I also have ElementalX and SuperSU installed. suhide was giving me issues and I just have to figure out the Gapps (I'm a cop so time is hard to come by). I also enabled always on display but just remembered to enable the burnin protection

Unable to build kernel from source, what i'm missing?

Hello to all!
I'm an heavy oneplus user, currently with Nord, but i'm try to use my old but Gold Oneplus 3 to run Klipper+Moonraker+Fluidd.
Klipper side everything is perfect, still remains one big issue: there is no kernel compiled for OP3 which has USB_SERIAL_CH341 driver enabled.
I'm trying to build but without success. Here is what i've done under Linux Mint latest version.
First of all i've installed a lot of packages, i cant remember all because i used various guides since initially i was not able neither of finish compilation.
Then i've downloaded:
kernel source: https://github.com/lin16-microg/android_kernel_oneplus_msm8996/tree/lin-16.0-mse2
from this ROM thread, which is the rom im still using: https://forum.xda-developers.com/t/...ened-lineageos-16-0-for-oneplus-3-3t.4034869/
initially i've tried to use EVAgcc toolchain, but it was impossible to finish to build. Then i switched to AOSP toolchains:
32bit: https://android.googlesource.com/pl...inux-androideabi-4.9/+/refs/heads/pie-release
64bit: https://android.googlesource.com/pl...64-linux-android-4.9/+/refs/heads/pie-release
With Them i was able to compile from source, but before doing i modified the file called "lineageos_oneplus3_defconfig" by adding "USB_SERIAL_CH341=y" just under the "USB_SERIAL=y" in order to have the serial driver compiled and loader (if i have understood right?).
to build i've used from inside kernel source cloned directory:
>make clean
>make mrproper
>ARCH=arm64 SUBARCH=arm64 CROSS_COMPILE=googletoolpath/bin/aarch64-stuffs- CROSS_COMPILE_ARM32=googletoolpath/bin/arm-stuffs- make O=out lineageos_oneplus3_defconfig
>ARCH=arm64 SUBARCH=arm64 CROSS_COMPILE=googletoolpath/bin/aarch64-stuffs- CROSS_COMPILE_ARM32=googletoolpath/bin/arm-stuffs- make O=out Image -j2
in this way i've obtained an Image (not a zimage since with zimage returned error).
Then i unpacked the stock boot.img with Android Image Kitchen, substituted boot.img-kernel file (which is an archive..?) with the compiled image renamed.
Finally i repacked everything.
Tried to flash the repacked boot img but no boot, the phone returns to fastboot screen.
I've noticed that my newboot.img is around 25mb insted of around 12mb like the stock one present in the Rom.zip
Probably the error resides in how i've managed to unpack and repack the kernel image..
Do someone see some heavy error which can cause the problem? What can i try?
From a side, as automation engineer, i want to learn and try to do it by myself, but on the other side, if someone is able to compile it for me with serial CH341 driver enabled a beer is assured.
Thanks all to have read up to now and for any advice
not sure that's important but you forgot to gzip kernel before repacking. I recommend to compile with configuration of running kernel from device /proc/config.gz first.
alecxs said:
not sure that's important but you forgot to gzip kernel before repacking. I recommend to compile with configuration of running kernel from device /proc/config.gz first.
Click to expand...
Click to collapse
I've to try because it is not gzipped by default, the problem is that I don't found all in one scripts or config file as the one mentioned by you. I would never thought that rebuild a kernel were so tricky.

Categories

Resources