roll your own kernel package - Samsung Galaxy S (4G Model)

I grabbed the initrd and kernel source from antonx's repos and tried building a kernel. It didn't work. It didn't really look like it was going to work from the build script because I didn't see the init being compressed and combined with the kernel and if I remember right that's how it's done. I know i've seen directions in some forum before but I can't find it now.
Help anyone?

Related

[Q] Kernel source compiling for Xoom.

Hi I looked for sometime for answers but could not find anything relevant.
Looking to get the ftdi VCP drivers to install on Xoom. Which means I either have to compile a kernel or add them as a module. I can not for the life of me find the correct source tree.
I downloaded kernel 2.6.36.3 from google which matches my kernel version.
My kernel version on the tablet is 2.6.36.3-gb899258 .
When I cross compile the module and try to do an insmod its complaining about the magic version is different which leads me to believe that I have the wrong kernel.
Where can I get the right stock kernel?
If i can not find it there is another option to download the config.gz from the device and recompile another version of the kernel with native support for the ftdi drivers.. How do i just install just the kernel on the device? Is it a uImage bzImage and how do I just flash that?
cd
Thanks
edit:
scrap that ...
sorry, not really helpful in your case
I'm assuming you got your source from here? This is the link from the Android website:
git clone https://android.googlesource.com/kernel/tegra.git
If you decide to go the route of compiling another kernel source, the easiest way (and a good way to keep snapshots of various configs) would be to use Koush's AnyKernel to flash the kernel. I don't know anything about what you're trying to do but I hope that helps some.
Yep the code comes from there.....
I finally got it to work , I downloaded the stock kernel from google then when I make the modules I had to modify the Makefile to get it to match the kernel versions.
It seems to work for now...
Thanks for your help

[Q] Can't seem to build a custom kernel

I am trying to compile a custom kernel,
I succeed to build one but I can't boot him, when I load the kernel I go in to boot loop
I haven't made any real changes to this kernel I really just downloaded the source and compile it
The version match its a GB kernel 2.6.35.7 I disabled the lag fix, still it goes to boot loop.
any ideas?
What source code did you try to use to build this kernel? Links would be awesome.
Well I tried this two
Code:
github.com/Krylon360/SGS4G_Kernel_GB
opensource.samsung.com/index.jsp (SGH-T959V-TMB_GB_Opensource.zip)
I did
make clean && make mrproper
make vibrantplus_rev00_defconfig
make -j8
and then I loaded the kernel via heimdall
Building the stock kernel
I have run in to a similar problem. One issue I had to get past is the stock rom source does not have have the initramfs included. It is needed so the kernel can boot into a file system before it can start loading loadable modules and mount the rom filesystem.
I have been able to get an initramfs by extracting it from the original rom, The issue I have is it is loading all modules, but the rom devices will not mount as the /dev directory is empty and the mount needs them to mount the file systems.
This may be off topic for this forum. If you want to PM me, I'm willing to let you know what I have found out.
Tom
You should keep discussing it here since it does pertain to the phone and it'll be useful for future reference
Sent from my SGH-T959V using XDA App
Agree with FB.
I have ran into the same problem. I was unable to find a way to get it beyond boot loop so I scratched the project. I am definitely curious on how to get this working.
FBis251 said:
You should keep discussing it here since it does pertain to the phone and it'll be useful for future reference
Sent from my SGH-T959V using XDA App
Click to expand...
Click to collapse
DISCLAIMER
I am NOT a kernel developer, just a programmer that has done linux programming before, and is trying to understand and build the kernel.
I will share what I have found out through my attempts to build the stock rom as delivered from Samsung.
I have searched XDA and Googled the web in search of the answers I need with some success as well as dead ends. I am not looking to have the answers handed to me on a silver plate, but a few hints or links to point me in the right direction is helpful.
To start:
Recommended Hardware needed:
Search the XDA for AdamOutler threads on building the serial interface via the USB. Highly recommended reading as it helps to see what the kernel is doing when it is in the bootloop. All the important parts was purchased from his recommended supplier(s). Thanks AdamOutler for the information!
What I know about the samsung kernel source as delivered:
1) if you follow the readme in the kernel, it will build cleanly. However, it will NOT run, it will bootloop!!
2) If you intend to only build the stock kernel, I recommend making sure you are starting with a stock build installed on the phone. I suggest the same release version you are trying to build.
3) After you build the kernel and load it ( the zImage file is loaded via Heimdall ) the first problem I ran into was the initramfs. It is not included in the source and must be created from scratch or obtained from another kernel.
4) Once the initramfs is being built and included in the kernel, the next problem is the driver modules that are included, have to have the same version as the kernel. You will need to figure out the version by the kernel debug messages on the serial/usb interface mentioned above. Once the versions match, the kernel will load them.
This is where I am stopped... once the drivers are loaded, the init scripts mount the file systems. This does not happen with my kernel. I am still investigating this. I think it has to do with the /dev files for the mount points not being created/missing. I have not found the piece of info yet points me to the solution. Most of the links I have found pertain to linux on an x86/64 platform. I have found little on embedded linux and how it works.
That is all I have in a nutshell. Feel free to comment and ask questions. Remember to search! Use different forms of your search terms, use different working. I like to use the 'yippy.com' search engine as it places the results in categories.
Good luck!
Tom
logan123 said:
Well I tried this two
Code:
github.com/Krylon360/SGS4G_Kernel_GB
opensource.samsung.com/index.jsp (SGH-T959V-TMB_GB_Opensource.zip)
I did
make clean && make mrproper
make vibrantplus_rev00_defconfig
make -j8
and then I loaded the kernel via heimdall
Click to expand...
Click to collapse
Krylon's tree is stock, no changes.
It has all the problems I fixed in my tree.
I have a lot of uncommitted changes, but you can find my work at: https://github.com/bhundven/
Regardless of me being on xda or not, I am still working on sgs4g.
bhundven said:
Krylon's tree is stock, no changes.
It has all the problems I fixed in my tree.
I have a lot of uncommitted changes, but you can find my work at: https://github.com/bhundven/
Regardless of me being on xda or not, I am still working on sgs4g.
Click to expand...
Click to collapse
Aww hell bhundven! Refreshing to see you stop by!
Thank you everyone
mccabet, You actually saved me some time because those were my next two step
I was looking for the initramfs and I didn't find it...
Could you please share your?
I do not have my initramfs file available to me at work. So here is the info I used to get my copy. You will need an original rom release ( I used the heimdall one-click from bhundven ) to extract the zImage file from.
Here is the link to info on how extract your own initramfs from a kernel image (zImage):
http://forum.xda-developers.com/wiki/index.php?title=Extract_initramfs_from_zImage
I used the improved script mentioned at the bottom of the page from:
https://github.com/mistadman/Extract-Kernel-Initramfs
After getting your initramfs, you will need to modify your vibrantplus_rev00_defconfig file and change the following parameter to point to your initramfs you extracted:
CONFIG_INITRAMFS_SOURCE="/path/to/initramfs"
Hope that helps.
Tom
Ok it seems like I was able to boot the kernel, no more boot loops thank to the initramfs but
The system isn't loading, it get stuck on the "Galaxy S 4G" page.
and when I load recovery it gives me lots of error so as
E:Can't mount /cache/recovery/log
E:failed to mount /cache (No such file or directory)
it goes on and on but its all the same...
logan123 said:
Ok it seems like I was able to boot the kernel, no more boot loops thank to the initramfs but
The system isn't loading, it get stuck on the "Galaxy S 4G" page.
and when I load recovery it gives me lots of error so as
E:Can't mount /cache/recovery/log
E:failed to mount /cache (No such file or directory)
it goes on and on but its all the same...
Click to expand...
Click to collapse
I may be off-base, but do you know if /cache and the other file systems were the Samsung rfs filesystem or the ext4 filesystem? Standard recovery can't mount ext4 & if your kernel doesn't support it, then it won't be able to mount them, either.
I thought so too so I removed the lag-fix and return to rfs
but this is neither because apparently there are no stl devices :\
I pulled out the recovery log
Code:
http://pastebin.com/hDCNbdne
Code:
failed to mount '/dev/block/stl11' '/cache'(rfs) -> No such device
Now I feel like an idiot because I can't seem to find what is it in the kernel config
moreover I tired to pull a config from a working kernel and I basically got the same errors
Any ideas?
Well the solution is simple, apparently version magic didn't load the kernel modules
for rfs_fat and fsr_stl...(you get the point)
now I can't to find way to compile them it seems as if someone removed them from the kernel tree and I can't load them either
I tired several modules from different kernel well all result in failure.
so any ideas?
logan123 said:
Well the solution is simple, apparently version magic didn't load the kernel modules
for rfs_fat and fsr_stl...(you get the point)
now I can't to find way to compile them it seems as if someone removed them from the kernel tree and I can't load them either
I tired several modules from different kernel well all result in failure.
so any ideas?
Click to expand...
Click to collapse
I wish had some, man. I've never compiled a kernel for Android. At least, not yet. However the moduel code should be somewhere in the kernel tree. I believe Android is a layer on top of the Linux kernel so the source may be there.
I'm still reading about and learning the platform side of Android. Hopefully one of the devs around can provide some solid guidance.
Ok no offence but this kernel is worthless
even if I load the modules into the kernel I get a errors because of the unknown symbols
bahh any ideas anyone?
stephen_w said:
I wish had some, man. I've never compiled a kernel for Android. At least, not yet. However the moduel code should be somewhere in the kernel tree. I believe Android is a layer on top of the Linux kernel so the source may be there.
I'm still reading about and learning the platform side of Android. Hopefully one of the devs around can provide some solid guidance.
Click to expand...
Click to collapse
That is as far as I have gotten. The drivers for the RFS ( drivers/tfsr ) are not loading and therefore the /dev mount points do not exist. The default build config flags ( CONFIG_RFS_FSR=m and CONFIG_RFS_FSR_STL=m ) are to build the module as a loadable module. I have tried to build the module with no success. Still investigating when I have the time. I was even thinking of looking at the Epic 4G MTD build and trying that. The problem there is if I can not solve this problem, I probably solve it by trying the MTD conversion. ( Except to brick it.)
if one of you kernel devs gets a bootable MTD kernel hit me up... I got a rom that needs some mtd loving
RaverX3X said:
if one of you kernel devs gets a bootable MTD kernel hit me up... I got a rom that needs some mtd loving
Click to expand...
Click to collapse
I do not claim to be a kernel developer. I am trying to understand and build the base kernel. If you can help me get past this, that would be great! I need to take baby steps before I can start walking. Once I get the build to work and boot completely, I'm game to go further, but have to get to a working base before we can continue. I understand the more experienced developers don't want to be bothered. I understand they have other jobs, and families. So do I. They became as great as they are, through hard work, experience and asking the right people the right questions. Asking the right question also applies to Google. The query only returns the matches to your query. Change a few words, get different results.
I'm not looking for someone to hold my hand, I want to learn by doing, not having it done for me. Just point be to the bread crumb trail, and I will follow.
Right now, I am at a stand still until I figure out why it is not loading the tfsr module. If that is even the problem.
If I make any progress, I'll post it here for all. If I am wrong, please correct me so we all don't go down the wrong path.
Thank you for listening.
Tom

Got kexec-mod, kexec-tools working, atags in progress - Should Also Work With DroidX

I realize people gave up slightly on the whole kexec thing over radio worries, but I now have the module compiling and inserting without error into the Droid2/DroidX gingerbread kernel. Next comes cross compiling the kexec-tools for userspace, to allow us to attempt inserting a different kernel.
To build, you'll need a compiled DroidX kernel from source, as well as the android NDK.
To build, make sure you have downloaded the DroidX GB kernel source and compiled it. There are guides everywhere on how to build Android kernels. Just make sure you use the proper cross compiler.
http://sourceforge.n....l.tgz/download
When you build, make sure to use
Code:
make mapphone_defconfig
Once the kernel is built, clone my repo and edit envsetup.sh to reflect the correct paths to your kernel source directory and the android NDK.
https://github.com/i...kexec-mod-d2-dx
Then, source it:
Code:
source envsetup.sh
Then, just run
Code:
make
and cross your fingers. You should then have a fresh kexec_load.ko file!
To see if it loads, you'll need to copy it to your sdcard, and then on the phone, using a console, do the following:
Code:
su (click allow)
insmod /sdcard/path/to/kexec_load.ko
If you don't get any errors, it inserted! Now, of course, to actually use it, we'd need the kexec-tools built, which I haven't gotten ready yet...but they're coming! To remove the module (no reason to leave it in memory for now):
Code:
rmmod kexec_load
Happy hacking, and help is always appreciated!
This looks great! If you need any help just ask
Thanks! I probably could actually use some. I'm looking at eternity project's git repos now, and am trying to figure out how they managed to get atags working, with the whole procfs thing...still scratching my head there.
I'm looking at eternity project's git repos now, and am trying to figure out how they managed to get atags working, with the whole procfs thing...still scratching my head there, though I do have an atags module working, except it doesn't do anything without atags in the procfs (http://lists.infradead.org/pipermail/kexec/2011-January/004795.html).
kexec-tools:
https://github.com/i...xec-tools-dx-d2
To build, see the README.
Then, copy the binaries from /build/sbin/* to your device, and the move them to the /system/bin directory, and chmod them 770 to make them executable.
mod-atags:
https://github.com/i...mod-atags-d2-dx
Now, if I/we can just get atags and procfs stuff taken care of, we'll be able to go to the next step. I already have atags compiling as a module, but it won't stay inserted because we have no atags in the procfs. Note I can't just trace through code like this and know what everything is doing, but I know enough to hack at it and be dangerous
I know this is kind of off topic, but would this help us people with Motorola Atrix 2? Does it use the same radio?
calebcoverdale said:
I know this is kind of off topic, but would this help us people with Motorola Atrix 2? Does it use the same radio?
Click to expand...
Click to collapse
No idea. I haven't even gotten the kernel to change yet, so I haven't gotten to mess with radio yet. The method itself should/would work though, but radio will require reverse engineering...perhaps find a similar phone with an open bootloader and disassemble and attempt to clone it's modules.
The latest change I made may or may not work, it was an attempt to remove atags from the kexec module based on an old patch I found, which added the functionality. This at leaset made kexec -l zImage work, but when I run kexec -e, the kexec binary complains about atags not being there...hrmmmph.
I may have to revert it (and will if we can get atags somehow) ...but if we can get the kexec bin to ignore /proc/atags or just find a way to rip them out of the running kernel, we'll be in business.
The commit: https://github.com/ilikenwf/kexec-mod-d2-dx/commit/12dffe0ea286be0fe9ab0303a5a35ed92be4ee2c
I'm also looking into 2ndboot.
I like where this is going! Keep working!
Sent from my DROID2 using xda premium
Okies, so, I emailed aliasxerog (original kexec-mod writer), and I hope he'll get back to me. Even though his twitter says he's a "former android developer," maybe he'll be willing to give me some hints so I can pick up where he left off.
I also got the froyo version of the module building properly based on his module, yet again, (all after SBF'ing my phone back down to motoblur froyo - yech!) but neither currently work... (note there's a gingerbread and a froyo branch on my repo): https://github.com/i...kexec-mod-d2-dx
The froyo one throws the following error, which stops me dead in the water:
Code:
Could not find a free area of memory of 3007dc bytes...
The gingerbread one loads the kernel into memory but won't execute it due to our not having atags.
We've moved our git repos to an organization for easier collaboration:
https://github.com/organizations/D2-DX-Customboot
links are imcomplete.
use URL lable pls.
Cross compiler version ?
hello,
Sorry but I am not able to use the sourceforge link that you provided to download kernel source .. Also please share what cross compiler version is to be used....
Thanks in advance.

[Q]Compiling from source for SGS4G

Hey guys i need a little guidance. I'm trying to compile a SGS4G version of the CM10.1 ROM ive been building for the grouper and running in to some issues. For now Im using airfluip1's Kernel and device tree with source from CM and my Github. To narrow down the issues I swiched back to the stock 4.6 toolchain till i can get this working. It builds fine with no errors but comparing it to airfluip1's roms zip file i only have the boot.img, system folder, and META-INF folder. When i add the missing files like ex: updater.sh, modem.bin, bml_over_mtd.sh...etc wont go past the splash screen and dosent even make it to the bootanimation :crying: and i end up loseing CWM. if i switch my boot.img out with airfluip1's it fixes everything, boots right up, CWM is working properly, and the ROM is fine other than the Known CM10.1 bugs like multiple text, network issues. I never compiled a ROM that had the recovery with the boot.img and don't know if there's someting special you have to do with it to get it to work. any help is appreciated thanks guys
It might be that the latest kernel commits cause the rom not to boot. If you look up a guide on how to do a git reset in the kernel directory you might be able to compile a bootimage that works fine.
The kernel source is under
kernel/samsung/galaxys4gmtd
If you do a git log in that directory you will see the commit history with the hashes for each commit. If you do
git reset --hard sha1_hash
You can go back to a previously working commit, which might be trial and error
To speed up your testing process, instead of compiling the whole rom again you can try doing a
mka bootimage
Instead of
mka bacon
As far as the missing files, I don't have any input on that.
I'm finally back with my build rig and I finished syncing cm10.1 last night so I'll be trying to get some builds going tonight too.
FBis251 said:
It might be that the latest kernel commits cause the rom not to boot. If you look up a guide on how to do a git reset in the kernel directory you might be able to compile a bootimage that works fine.
The kernel source is under
kernel/samsung/galaxys4gmtd
If you do a git log in that directory you will see the commit history with the hashes for each commit. If you do
git reset --hard sha1_hash
You can go back to a previously working commit, which might be trial and error
To speed up your testing process, instead of compiling the whole rom again you can try doing a
mka bootimage
Instead of
mka bacon
As far as the missing files, I don't have any input on that.
I'm finally back with my build rig and I finished syncing cm10.1 last night so I'll be trying to get some builds going tonight too.
Click to expand...
Click to collapse
Thanks for the reply ... I've been having this issue for almost a week.. I might have set it up wrong I've been just doing brunch galaxys4gmtd to start the build. I'll have to look into mka. Should the kernel source be in kernel/samsung/galaxys4gmtd? In his device/samsung/galaxys4gmtd/BoardConfig.mk its targeting the kernel source to kernel/samsung/aries so that where I put it
EDIT: Was just set up weird by me...had to re add the vendersetup.sh back that he deleted from the device tree, did a lunch full_galaxys4gmtd-userdebug, then brunch galaxys4gmtd, and it compiled fine with the files I was missing and the kernel booted :beer:
Sent from my Nexus7 using Tapatalk HD
DJLamontagneIII said:
Thanks for the reply ... I've been having this issue for almost a week.. I might have set it up wrong I've been just doing brunch galaxys4gmtd to start the build. I'll have to look into mka. Should the kernel source be in kernel/samsung/galaxys4gmtd? In his device/samsung/galaxys4gmtd/BoardConfig.mk its targeting the kernel source to kernel/samsung/aries so that where I put it
EDIT: Was just set up weird by me...had to re add the vendersetup.sh back that he deleted from the device tree, did a lunch full_galaxys4gmtd-userdebug, then brunch galaxys4gmtd, and it compiled fine with the files I was missing and the kernel booted :beer:
Sent from my Nexus7 using Tapatalk HD
Click to expand...
Click to collapse
Awesome, I'm glad you got it working. . I haven't tried an aries build yet, but yes BoardConfig.mk is correct. You should try doing:
lunch cm_galaxys4gmtd-userdebug
mka bacon
I'm not sure, but the full_ prefix might be preventing the files that help flash the rom to be included with the zip file.
good job.
Also, yes kernel should be in kernel/samsung/aries.
EDIT: it is a smart decision not to use my airfluip1 stuff, and rather those from teamuserdebug.
Why, well, my latest kernel tree was only used to pull request to anak1n, so it is not even the kernel with my changes. So FFC/Compass/latests fixes won't be there.
Also, you might be using the common aries common from cyanogenmod... FFC from device tree side will be borked, and Aries Parts won't work.
Please use teamuserdebugs repos.
---------- Post added at 10:10 PM ---------- Previous post was at 10:05 PM ----------
FBis251 said:
Awesome, I'm glad you got it working. . I haven't tried an aries build yet, but yes BoardConfig.mk is correct. You should try doing:
lunch cm_galaxys4gmtd-userdebug
mka bacon
I'm not sure, but the full_ prefix might be preventing the files that help flash the rom to be included with the zip file.
Click to expand...
Click to collapse
Or brunch cm_galaxys4gmtd-eng
which runs both commands, and the eng builds are better since you have a debuggable kernel.
Thanks for the tip i used team userdebug's repos and roms been running great haven't had time to mess with the updated toolchains yet but il have something up to play with in a day or two
Sent from my SGH-T959V using Tapatalk 4 Beta

[Completed] [Q] Trouble With Nexus 5 Kernel zImage

Haii guys!
So, i'm young "kernel developer".. I am actually not a coder, i just try to learn by making kernels and if they are stable enough i test them. So, till now i was working with Mako source - i had phone lg optimus g which i really close to mako and i based everything on Mako source.
Now i bought a new phone, Nexus 5. I am really satisfied by this phone on stock, but even more on custom ROM & Kernel.. But hey, it's me, i'm curious and i have to try to make stuff myself, so i choose to make my own kernel for Nexus 5.. More to learn than anything.
So, i started.. I forked this to my github and do some basic changes for me.. Just to start. I added graphite support and option to build with Linaro 4.9.4.. And i started to build. And it had some errors, so i also fixed them - fs/namespace.c error with 4.9 toolchains, so, i fixed it and it built with no trouble.
So, i was coming from world of Mako and took zImage, made a flashable zip with AnyKernel and flashed it.. And i was stuck at google logo with unlock icon. I restored twrp backup of previous kernel and started over and it booted normally...
Then i did some research and found out that i should use zImage-dtb because Nexus 5 uses something named device tree blob.. So, i did everything from scratch.
I forked same source as before, and did my changes over it.. Renamed kernel, added kernel build script, made my slightly modified defconfig, this time i used toolchain LinaroMod 4.9 from here and some other stuff.. I built with no trouble, used zImage-dtb as zImage in flashable zip as i saw in other kernels and flashed.. I was sure it will boot this time, none of those modifications was supposed to break anything.. But again, I am stuck at Google logo.
Have any of you guys any idea where i missed? Maybe wrong source? Wrong toolchain?
Here are some maybe useful links:
My source: https://github.com/Matthew-333/BlueMoon
My Changes: https://github.com/Matthew-333/BlueMoon/commits/master
Toolchain: https://github.com/hyper-toolchains/LinaroMod-arm-eabi-4.9
AnyKernel Template: https://github.com/koush/AnyKernel
I am using xUbuntu 15.04 64 bit..
Thank you if anybody manage to help me with this...
Matthew_333 said:
Haii guys!
So, i'm young "kernel developer".. I am actually not a coder, i just try to learn by making kernels and if they are stable enough i test them. So, till now i was working with Mako source - i had phone lg optimus g which i really close to mako and i based everything on Mako source.
Now i bought a new phone, Nexus 5. I am really satisfied by this phone on stock, but even more on custom ROM & Kernel.. But hey, it's me, i'm curious and i have to try to make stuff myself, so i choose to make my own kernel for Nexus 5.. More to learn than anything.
So, i started.. I forked this to my github and do some basic changes for me.. Just to start. I added graphite support and option to build with Linaro 4.9.4.. And i started to build. And it had some errors, so i also fixed them - fs/namespace.c error with 4.9 toolchains, so, i fixed it and it built with no trouble.
So, i was coming from world of Mako and took zImage, made a flashable zip with AnyKernel and flashed it.. And i was stuck at google logo with unlock icon. I restored twrp backup of previous kernel and started over and it booted normally...
Then i did some research and found out that i should use zImage-dtb because Nexus 5 uses something named device tree blob.. So, i did everything from scratch.
I forked same source as before, and did my changes over it.. Renamed kernel, added kernel build script, made my slightly modified defconfig, this time i used toolchain LinaroMod 4.9 from here and some other stuff.. I built with no trouble, used zImage-dtb as zImage in flashable zip as i saw in other kernels and flashed.. I was sure it will boot this time, none of those modifications was supposed to break anything.. But again, I am stuck at Google logo.
Have any of you guys any idea where i missed? Maybe wrong source? Wrong toolchain?
Here are some maybe useful links:
My source: https://github.com/Matthew-333/BlueMoon
My Changes: https://github.com/Matthew-333/BlueMoon/commits/master
Toolchain: https://github.com/hyper-toolchains/LinaroMod-arm-eabi-4.9
AnyKernel Template: https://github.com/koush/AnyKernel
I am using xUbuntu 15.04 64 bit..
Thank you if anybody manage to help me with this...
Click to expand...
Click to collapse
Hi, thanks for using XDA assist!
Please have a look here for some useful information:
http://forum.xda-developers.com/android/software/ultimate-guide-compile-android-kernel-t2871276
Good luck!

Categories

Resources