Building Kernel - Galaxy Ace S5830 General

Hi,
i downloaded from opensource.samsung.c_om source code of S5830 firmware, compiled the kernel and i cannot flash it to the phone, after compilig there is two different files zImage has 2,9MB and Image has 6.8MB, i use CWM and function flash kernel, but after flashing it Phone doesnt boot, what iam doing wrong?
Or what kind of source i may use for gingerbread 2.3.3??
For compiling i use: Ubuntu distribution.

Use adb for the 6MB one and use CWM Manager for the 2MB one .
Sent from my GT-S5830 using XDA App

Yes, but if i flash "2MB" kernel with CWM using function flash kernel, phone has a boot loop and never don't boot.

u need to use the zimage file.. unpack samsungs default kernel to get ramdisk, and repack the ramdisk with the zimage file. but ur kernel need to have local version matching the module in the ramdisk, or it wouldnt boot.

How i can do it? Im doing it first time

because u already successfully compiled a kernel, i assume u know linux workaround.
first read
http://forum.xda-developers.com/showthread.php?t=1173427 to unpack the samsung default kernel.
then cd into the module dir which is ramdisk/lib/modules and issue this command
Code:
strings fsr.ko | grep vermagic
and it shoud give some output eg
Code:
vermagic=2.6.35.7-perf-CL382966 preempt mod_unload ARMv6
take note of the local numbers, in my case above its "-perf-CL382966".
then u need to edit the kernel config file, which is arch/arm/configs/cooper_rev03_defconfig. search for this string
Code:
CONFIG_LOCALVERSION="-perf"
and edit it so it matched the local version of the module from the ramdisk eg
Code:
CONFIG_LOCALVERSION="-perf-CL382966"
now compile ur kernel. take the result zImage file and repack it back with the ramdisk u unpack earlier.

Oh, thanx a lot, now i compiling new kernel, but after i unpack my old boot.img and watch into ramdisk, there is no file called zImage :/

if u read carefully the link i gave u earlier, u should know that its the boot.img-kernel file. replace it with ur compiled zimage file.

I do exactly what u wrote, than i flash boot.img with odin as "PDA" but phone has in the boot loop again
File: http://www.earth-project.ic.cz/CODE.tar

what did u edit in the kernel? first u should try to compile plain default without any editing to make sure it even boot.
and u need to compile using the defconfig u edited
Code:
make cooper_rev03_defconfig
make
or just
Code:
./make_kernel_GT-S5830.sh

I did't edit anything, i compile only source what i DL from samsung source, but old bootimg have 6,1MB and my 5,9, is that problem?

size is not a problem at all. the size of my highly optimize kernel after compile is just 2.3mb, after repack with ramdisk is just 5.3mb. it boot just fine. maybe u download wrong source? use froyo kernel source for froyo rom, and gb kernel source for gb rom. dont mismatched.

I use: GT-S5830_S5570_EUR_OpenSource.zip from: https://opensource.samsung.com/
For: S5830XEKPH Firmware - Gingerbread 2.3.3.
I would really like, if you can tell me what kind of software and kernel source i may use.

see, thats the problem. ur compiling froyo kernel for gb rom.
use the GT-S5570_S5670_S5830_Opensource_GB.zip or GT-S5830_Opensource_GB.zip. both for gb. personally i use the second one. and toolchain use Sourcery G++ Lite 2011.03-42 for ARM EABI

THX!! I will test it! )

Ok, that is better but not too much, now iam stucked on the screen with text "GALAXY ACE" "GT-S58930" .... i wait for aprox. 30 minutes and nothing happen. :/

Killercek said:
Ok, that is better but not too much, now iam stucked on the screen with text "GALAXY ACE" "GT-S58930" .... i wait for aprox. 30 minutes and nothing happen. :/
Click to expand...
Click to collapse
u didnt edit anything rite? if u just compile the stock kernel source with just modifying local version in config file, it should boot.
maybe u should install qtadb and look at the logcat while it boot, and if it stuck, look for the last line in logcat.

I see only that:
20:53:55.859 exec '/system/bin/sh' failed: No such file or directory 2 2) -
Oh, iam on windows i don't have linux computer here, iam compiling on my server and i cannot connect phone on it

that error indicate that the module in ramdisk mismatch with the kernel local version. check again if the module local version matched with the kernel local version in the defconfig file.

THX it working!

Related

[Q] Repacked boot.img gives bootloop, how to do it correctly?

I am building my own ROM now, and I am checking to do my own unsecure stock kernel.
I found the tools that unpack a kernel boot.img file and edit the properties file to make it unsecure, but after repacking the kernel and trying it, device went into a boot loop.
what is needed to repack it?
the tools i found were these here, mainly some perl or shell scripts that does the mkbootimg thing a bit automatically, but I also tried manually.
I did not compile mkbootimg, I used a ready made linux binary, which seem a bit old because it does not contain the --pagesize parameter, and that's the only missing thing from the original, does this cause bootloop?
the ramdisk should be ok, but packing it back with zImage is not....
Fixed
I used Linux tools and they failed, but I found the Android Image Kitchen for windows (cygwin) and strangely they worked, the produced boot.img works as expected !!!

[Q] [Module] Build and load module on GS3

Hello,
I tried to do a simple task which raise several problem and it start to drive me crazy, so here I am, asking for help. The subject may have been already mentioned, but can't find an issue with the galaxy s3.
I work with ubuntu 12.04 and Odin on win7. My GS3 has XXELL4 baseband, and 3.0.31-742798 kernel version.
I need to load and run a custom module (let's say a "hello world" one for begin) on the galaxy S3.
I compiled it through a Makefile with the toolchain from the ndk package (
Code:
path_to_ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
and the source code from the samsung web site (GT-I9300_JB_Opensource_Update8.zip).
Obviously, when i tried to insmod my module, I've got some compatibility error like
Code:
Exec format error
.
The fact is that the kernel from website is not the same as the phone one.
So I tried to put the kernel from the website on the phone
I compiled it with the same toolchain and I received a zImage file in result. But what to do with this file ? I extracted a boot.img from the phone with Odin and split it (with perl script stuff) to use the extracted files with my compiled zImage for reconstruct a new boot.img. But since fastboot is not available on GS3 (or I miss something) I can't simply
Code:
$ fastboot flash boot boot.img
, and need to use Odin again. So I replace the boot.img from odin's backup folder on my PC with my boot.img. But the nandroid.md5 file raise an error. Am I doing it wrong or too complicated ? If I can correct the md5 error, is that my module will work ?
I also tried to compil my module directly with the kernel from the phone but didn't manage to extract the kernel files to do it. Stuck with a boot.img. Same with the stock kernel from http://forum.xda-developers.com/showthread.php?t=1646610
I made a lot of research but don't find any concrete solutions to my simple task. Maybe I miss something or looking too deep.
Is there a more simple way to run a custom module on the GS3 ?
sorry for my english
Hello and welcome to xda!
You do not have to use odin to flash your kernel, you can do it via custom recovery too.
Just get an simple cwm package of another kernel for s3 and replace the boot.img in the zip.
I attached a simple empty cwm package, just drag your boot.img to the root of the zip with winrar or something.
hsrars-d said:
Hello and welcome to xda!
You do not have to use odin to flash your kernel, you can do it via custom recovery too.
Just get an simple cwm package of another kernel for s3 and replace the boot.img in the zip.
I attached a simple empty cwm package, just drag your boot.img to the root of the zip with winrar or something.
Click to expand...
Click to collapse
Thanks
I've got also a md5 error when i tried to restore with cwm, since I have no md5 file in my folder. Do I need to generate one ? how ?
EDIT: so a generate a md5 file with md5sum, but still have the Exec format error when i try to insmod my module.
ok, im not good with kernel stuff/modules so i cant help you any further...
try to find someone that has experience with kernel modules
edit: found something with google, not exactly for s3 but the error is pretty common:
http://www.linuxquestions.org/questions/linux-kernel-70/insmod-error-version-magic-4175424366/
http://forum.xda-developers.com/showthread.php?t=444338&page=1
http://stackoverflow.com/questions/...for-android-unknown-relocation-27-when-insmod
Why are you posting in this section?
Glebun said:
Why are you posting in this section?
Click to expand...
Click to collapse
well ... I don't yet have access to other section. But If someone could move the thread in a more appropriate one I'll thanks him.
Yes, you do. Questions go in the Q&A section, obviously

[Q] [Module] Build and load module on GS3

Hello,
I tried to do a simple task which raise several problem and it start to drive me crazy, so here I am, asking for help. The subject may have been already mentioned, but can't find an issue with the galaxy s3.
I work with ubuntu 12.04 and Odin on win7. My GS3 has XXELL4 baseband, and 3.0.31-742798 kernel version.
I need to load and run a custom module (let's say a "hello world" one for begin) on the galaxy S3.
I compiled it through a Makefile with the toolchain from the ndk package (
Code:
path_to_ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
and the source code from the samsung web site (GT-I9300_JB_Opensource_Update8.zip).
Obviously, when i tried to insmod my module, I've got some compatibility error like
Code:
Exec format error
.
The fact is that the kernel from website is not the same as the phone one.
So I tried to put the kernel from the website on the phone
I compiled it with the same toolchain and I received a zImage file in result. But what to do with this file ? I extracted a boot.img from the phone with Odin and split it (with perl script stuff) to use the extracted files with my compiled zImage for reconstruct a new boot.img. But since fastboot is not available on GS3 (or I miss something) I can't simply
Code:
$ fastboot flash boot boot.img
, and need to use Odin again. So I replace the boot.img from odin's backup folder on my PC with my boot.img. But the nandroid.md5 file raise an error. I deleted the dd5 file and regenerate one with md5sum. Still have the Exec format error when insmod. Am I doing it wrong or too complicated ? If I can correct the md5 error, is that my module will work ?
I also tried to compil my module directly with the kernel from the phone but didn't manage to extract the kernel files to do it. Stuck with a boot.img. Same with the stock kernel from http://forum.xda-developers.com/showthread.php?t=1646610
I made a lot of research but don't find any concrete solutions to my simple task. Maybe I miss something or looking too deep.
Is there a more simple way to run a custom module on the GS3 ? How do I find a loadable and targetable kernel for my module ?
sorry for my english

[Q] Rockchip kernel image file - how to build?

I have a working Kernel - http://forum.xda-developers.com/attachment.php?attachmentid=1743802&d=1361298599
but I need prepare a new one - compilation it is no problem, but how to prepare img file for taht?.
I heard that this is a Rockchip kernel image file - so I am a looking for information how to build this kind of kernel?
Procesor is RK3066.
mafamafa said:
I have a working Kernel - http://forum.xda-developers.com/attachment.php?attachmentid=1743802&d=1361298599
but I need prepare a new one - compilation it is no problem, but how to prepare img file for taht?.
I heard that this is a Rockchip kernel image file - so I am a looking for information how to build this kind of kernel?
Procesor is RK3066.
Click to expand...
Click to collapse
If that is a zImage, then you need to pack it into boot.img in order to flash.
There are many boot.img tools out there which can help you. But the thing is you will be needing your device's original boot.img (Which can be extracted from your device depending upon the partition) which contains the Ramdisk in order to be successful.
coolsandie said:
If that is a zImage, then you need to pack it into boot.img in order to flash.
There are many boot.img tools out there which can help you. But the thing is you will be needing your device's original boot.img (Which can be extracted from your device depending upon the partition) which contains the Ramdisk in order to be successful.
Click to expand...
Click to collapse
In fact it is a regular (no gziped) image not a zImage. The file after unpacking from RK3066 format starts with bytes d3 f0 21 (to unpack I'm using rkutils ).
But I don't understand why we need to make boot.img with this file and only after that, upload boot.img to the device. Normally it should be possible just to upload kernel.img to the partition where kernel is stored, no?
After kernel from the link above is uploaded to this partition, the device boots up without problem. But when we compile new kernel and upload it (after converting with rk-tools ) it is not even possible to boot the device.
Any idea what's going on? Is compiling a kernel, then converting to rk3066 format is enough ?
flowher said:
In fact it is a regular (no gziped) image not a zImage. The file after unpacking from RK3066 format starts with bytes d3 f0 21 (to unpack I'm using rkutils ).
But I don't understand why we need to make boot.img with this file and only after that, upload boot.img to the device. Normally it should be possible just to upload kernel.img to the partition where kernel is stored, no?
After kernel from the link above is uploaded to this partition, the device boots up without problem. But when we compile new kernel and upload it (after converting with rk-tools ) it is not even possible to boot the device.
Any idea what's going on? Is compiling a kernel, then converting to rk3066 format is enough ?
Click to expand...
Click to collapse
Ok, I just had a look at your link and yes, it contains the kernel.img file. So it should be the kernel image file which needs to be flashed. What you actually needed to do is, unpack that kernel image using the tools of your choice and you'll get the ramdisk, zImage etc when unpacking. If you have compiled kernel from Sources, then you need to replace the zImage with yours (Found in arch/arm/boot) if your compilation was successful without errors and repack it to form the kernel.img.
But that doesn't mean it should boot compulsorily, it may not boot depending upon various weird reasons. You may have to fix it by yourself. Nearest bet is using your device's config file (Found in /proc/config.gz) and use that to compile your kernel. You can find all infos regarding what I've mentioned in this thread:
http://forum.xda-developers.com/showthread.php?t=1748297

Steps for building kernel E2303 M4 Aqua

Good morning. I'm trying to build the kernel for the M4 aqua, but although sony didn't include it in the guides for doing so, I can see the files inside the tulip in sony's github repository. Then, I guess that it's possible to build a kernel from sony's sources. If anyone did so, could please post and briefly describe the steps? More concretely, the line with the arguments for mkbootimg (or the necessary tool). Thanks in advance
alguien24 said:
Good morning. I'm trying to build the kernel for the M4 aqua, but although sony didn't include it in the guides for doing so, I can see the files inside the tulip in sony's github repository. Then, I guess that it's possible to build a kernel from sony's sources. If anyone did so, could please post and briefly describe the steps? More concretely, the line with the arguments for mkbootimg (or the necessary tool). Thanks in advance
Click to expand...
Click to collapse
You can use the same instruction as How to build AOSP Marshmallow for unlocked Xperia devices to download the source.
attached is the sony.xml file you can use to limit to download only tulip builds.
then you can use the follow in commands
$# cd android
android $# export CROSS_COMPILE=/android/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
add the full path to the above CROSS_COMPILE=/mnt/../../../android/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
android $# cd kernel/sony/msm/
android/kernel/sony/msm $# make ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE aosp_kanuti_tulip_defconfig
android/kernel/sony/msm $# make ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE -j1
if make is successful, copy the kernel from arch\arm64\boot folder and past into device/sony/common-kernel
and build your full aosp or only boot.img with android$# make -j1 bootimage
RohitBopnna said:
You can use the same instruction as How to build AOSP Marshmallow for unlocked Xperia devices to download the source.
attached is the sony.xml file you can use to limit to download only tulip builds.
then you can use the follow in commands
$# cd android
android $# export CROSS_COMPILE=/android/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
add the full path to the above CROSS_COMPILE=/mnt/../../../android/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
android $# cd kernel/sony/msm/
android/kernel/sony/msm $# make ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE aosp_kanuti_tulip_defconfig
android/kernel/sony/msm $# make ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE -j1
if make is successful, copy the kernel from arch\arm64\boot folder and past into device/sony/common-kernel
and build your full aosp or only boot.img with android$# make -j1 bootimage
Click to expand...
Click to collapse
Thanks a lot for the answer! Today, I had my computer setup with everything needed, with sony's guide. I've only made one modification. Inside the kanuti folder (~/android/device/sony/kanuti/rootdir) there's a file called fstab.kanuti. I changed the /data mountpoint to the second partition in the sdcard (in order to get more internal space, if I make it work someday I will post it inmediately ).Then, after carefully following the steps you gave me, I finally got the boot.img. Flashed it with fastboot flash boot boot.img, but when I powered the phone on, after half a second it shut down. Tried more than once with the same result. I flashed again the original kernel, and it came back to live with no more problems. Do you (or anyone) know where the problem could be? I also saw that the boot.img file weighs 9 MB, while the original kernel.elf extracted from the ftf takes 20 MB of space. Is this usual?
alguien24 said:
Thanks a lot for the answer! Today, I had my computer setup with everything needed, with sony's guide. I've only made one modification. Inside the kanuti folder (~/android/device/sony/kanuti/rootdir) there's a file called fstab.kanuti. I changed the /data mountpoint to the second partition in the sdcard (in order to get more internal space, if I make it work someday I will post it inmediately ).Then, after carefully following the steps you gave me, I finally got the boot.img. Flashed it with fastboot flash boot boot.img, but when I powered the phone on, after half a second it shut down. Tried more than once with the same result. I flashed again the original kernel, and it came back to live with no more problems. Do you (or anyone) know where the problem could be? I also saw that the boot.img file weighs 9 MB, while the original kernel.elf extracted from the ftf takes 20 MB of space. Is this usual?
Click to expand...
Click to collapse
the latest kernel that sony has implemented image.gz-dtb is a compressed kernel with the DTB combined, and this needs bootloader level gzip feature to unzip the kernel and load, which is not present today in our bootloaders. After building your kernel, Use the uncompressed kernel (image file and dtb) to build your boot image with old way, you may have to make changes in you boot build to indicate uncompressed kernel.
RohitBopnna said:
the latest kernel that sony has implemented image.gz-dtb is a compressed kernel with the DTB combined, and this needs bootloader level gzip feature to unzip the kernel and load, which is not present today in our bootloaders. After building your kernel, Use the uncompressed kernel (image file and dtb) to build your boot image with old way, you may have to make changes in you boot build to indicate uncompressed kernel.
Click to expand...
Click to collapse
I'm not really experienced in building kernels, I'm trying to learn a bit with this stuff I'm doing... And this phone hasn't got a lot of information yet. Could you please tell me what you mean with building it the old way?
LOL
You are in the stock rom, aren't you?
So, why would you try building an aosp kernel (which is f**ked up) in your stock rom?
You have to build from kernel-copyleft
There is also a tutorial from sony developer world
http://developer.sonymobile.com/kno...h-a-linux-kernel-from-sony-copyleft-archives/
I think you have to find the right defconfig and change arm to arm64 and aarch64 when necessary
RohitBopnna said:
the latest kernel that sony has implemented image.gz-dtb is a compressed kernel with the DTB combined, and this needs bootloader level gzip feature to unzip the kernel and load, which is not present today in our bootloaders. After building your kernel, Use the uncompressed kernel (image file and dtb) to build your boot image with old way, you may have to make changes in you boot build to indicate uncompressed kernel.
Click to expand...
Click to collapse
Now I got what you explained me. I've been looking for information, and I thought that after running make, the dtb file should be in the boot folder, but there I can only find the image file. How can I create the dtb file separately from the dts?
dani020110 said:
LOL
You are in the stock rom, aren't you?
So, why would you try building an aosp kernel (which is f**ked up) in your stock rom?
You have to build from kernel-copyleft
There is also a tutorial from sony developer world
http://developer.sonymobile.com/kno...h-a-linux-kernel-from-sony-copyleft-archives/
I think you have to find the right defconfig and change arm to arm64 and aarch64 when necessary
Click to expand...
Click to collapse
Now I'm not in stock, I've flashed the AOSP rom available in this post: http://forum.xda-developers.com/m4-aqua/development/5-0-aosgp-based-stock-t3262330. So that shouldn't be a problem, right?
aosgp?? a stock rom with aosp style dude,,base on stock not a real aosp
Sent from my E2353 using XDA-Developers mobile app

Categories

Resources