[Q] [Kernel] initramfs & j4fs - Galaxy Note GT-N7000 Q&A, Help & Troubleshooting

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

how to update Kernel ?

Anyone ?

Related

CM9 boot.img source

Hi,
Could anybody tell me which are the bare minimum sources needed to compile a working cyoanogenmod 9 kernel boot.img?
I'm currently trying to compile one on my own but I can't afford to download the whole CM9 source due to the internet contract i have.
Thanks
Nobody? Ok then... May someone please copy and paste their makefile inside the root directory of his Android tree? (the one from wich they issue the command "make -j4 out/target/product/galaxysmtd/boot.img").
Maybe you could try cloning the android_build project and the teamhacksung buildscript project as well. Then adjust the buildscripts to point to the correct toolchain directory...
Boot.img contains the kernel. Therefore you need the kernel sources since at cm9 the kernel is build while compiling cm. You can find that sources at github (in project kernel_samsung_aries or something). You need to put this directory to your root directory of your android build system (there you have the device dir, frameworks, vendor etc). Rename it into kernel/samsung/aries. Then you should be able to build. It has worked like this for i9001, and it should also for i9000
You could also look at the kernel source of semaphore/devil. They use their own build script which does not require the full cm9 source, but only the kernel source. I made an adapted version of their scripts to build my own kernel...
Verstuurd van mijn GT-I9000
I think he already has:
__Pol__ said:
Nobody? "make -j4 out/target/product/galaxysmtd/boot.img"
Click to expand...
Click to collapse
Thanks everybody!
Sorry if the first two posts misled you.
I already have the kernel source. What I need are some instructions in order to build the boot.img from them. I can't download the whole source branch because I'm on a data diet .
Also a copy paste of the main make file is accepted.
I think this could help you:
http://forum.xda-developers.com/showthread.php?p=28096022
It's again for i9001 (sorry, but I own one ), but should also work
I think this could help you:
http://forum.xda-developers.com/show...php?p=28096022
It's again for i9001 (sorry, but I own one ), but should also work
Click to expand...
Click to collapse
Thanks. I've already tried the split_bootimg.pl but it did not work. According to sbuild.sh from semaphore kernel what i need to do is just "cp bzImage boot.img". I had already done it before but my phone did not boot up. It showed the bootloader logo but then nothing so something is wrong with the initramfs. Is the one included with the kernel sources correct or am I missing something?
So you can build the kernel? And just copying the kernel image to boot.img won't work. As you can see in the splitted boot.img from arco or anyone else, there are some other things needed.
I think you need to split it, replace the kernel image (zImage I thinl) and put all files again together (including the other files from the working boot.img).
No warranty on that, but that's what I understood
hahnjo said:
So you can build the kernel? And just copying the kernel image to boot.img won't work. As you can see in the splitted boot.img from arco or anyone else, there are some other things needed.
I think you need to split it, replace the kernel image (zImage I thinl) and put all files again together (including the other files from the working boot.img).
No warranty on that, but that's what I understood
Click to expand...
Click to collapse
Actually I can't split the boot.img because split_bootimg.pl does not work. The problem is in the initramfs and that is why I was asking for some advice about the sources needed. The auto-generated initramfs does not work.
__Pol__ said:
Actually I can't split the boot.img because split_bootimg.pl does not work. The problem is in the initramfs and that is why I was asking for some advice about the sources needed. The auto-generated initramfs does not work.
Click to expand...
Click to collapse
When I tried it, it worked... Are you sure that you have Pearl installed. Which OS do you use?
How do you generate initramfs?
I'm running Debian wheezy, pearl is installed. The script says it has not found android magic. The initramfs is automatically generated by the kernel source. I fear some files are missing here: https://github.com/CyanogenMod/android_kernel_samsung_aries
Do I need to get *bootimg from here?
https://github.com/CyanogenMod/android_device_samsung_aries-common
If yes how do I use these 2 scripts?
Sorry they're not two scripts but a script and a make file. From where does that makefile obtain the variables?
For splitting, did you use a running boot.img, e.g. from CM9 for your device?
You have two possibilities for building a running boot.img:
1) It is builded if you compile CM or AOSP or another ROM from Source (therefore you would need the complete sources)
2) You only build the Kernel and put it in an existing boot.img (for your phone of course) by just replacing the kernel.
For second you need to split an existing boot.img
Hi
Sent from my GT-S5830 using xda app-developers app
hahnjo said:
For splitting, did you use a running boot.img, e.g. from CM9 for your device?
You have two possibilities for building a running boot.img:
1) It is builded if you compile CM or AOSP or another ROM from Source (therefore you would need the complete sources)
2) You only build the Kernel and put it in an existing boot.img (for your phone of course) by just replacing the kernel.
For second you need to split an existing boot.img
Click to expand...
Click to collapse
Well, actually there's a third method. I need the initramfs source, the kernel source and the recovery source. After building I need to pack them together. Until yesterday I had only the sources for kernel and initramfs (?). Now I'll head for some sources for the recovery but I still need the main makefile (inside the Android directory) to know what commands I have to issue.
Sorry guys if I stil can't explain my problem to you. I really appreciate your patience and your helpful tips though.
You could look at devil/semaphore, as they use a complete initramfs, including recovery (both have a slightly different implementation).
Verstuurd van mijn GT-I9000
kasper_h said:
You could look at devil/semaphore, as they use a complete initramfs, including recovery (both have a slightly different implementation).
Verstuurd van mijn GT-I9000
Click to expand...
Click to collapse
Yep! I had a look there and I understood I was missing the recovery. Semaphore uses a custom amde initramfs and recovery whith load of scripts I don't need. I downloaded the CWM source from cyanogenmod git. There is only an Android.mk that obviously won't work. The question still remains: has anybody here downloaded the whole cyanogenmod source? If yes, may they post the makefile here please?
I have the whole CM sources, CM7 and CM9. Atm I can't access them because I'm on travel. I will return next week, maybe then.
Though, I think that it is impossible to extract the needed Makefiles. The Main-Makefile includes another makefile, but from then on several files are included which include again files. I stopped trying to understand it after the first 3 files...

MultiROM - PAC and SlimB - order, kernel, others...

Hello There.
First of all, is it possible to install both PAC-man 4.3 ROM and SlimBeam 4.3 using MultROM?
If Yes, how to do this correctly/what am I doing wrong?
I have TWRP 2.6.0.0 and MultROM installed. Tried different combinations and nothing work.
I'm not much into this stuff, so as far as I could go I have investigate the issue of kernels and kexec, but as I said, my knowledge stopped on knowing that there is such thing, and secondary ROM can be installed with different, separated kernel.
Thanks for interest.
I thought that it would be helpful if I write what combination/order of instalation gives what result, so here it goes:
1. Installing SlimBeam, and then PAC: E: Error executing update binary in zip 'tmp/mr_update.zip'
2. Installing PAC, and then SlimBeam: Installation complited correctly, secondary system(SlimB) loading forever with PAC boot animation - probbably because of kernel?
3. Installing PAC and then SlimBeam with seperated cernel: (In Multiroom when booting SlimB) Error Kexec-hardboot support required to boot this ROM...
In this case I'm guessing that patching this kernel could help, but it's superadvanced for me
noone1101 said:
Hello There.
First of all, is it possible to install both PAC-man 4.3 ROM and SlimBeam 4.3 using MultROM?
If Yes, how to do this correctly/what am I doing wrong?
I have TWRP 2.6.0.0 and MultROM installed. Tried different combinations and nothing work.
I'm not much into this stuff, so as far as I could go I have investigate the issue of kernels and kexec, but as I said, my knowledge stopped on knowing that there is such thing, and secondary ROM can be installed with different, separated kernel.
Thanks for interest.
I thought that it would be helpful if I write what combination/order of instalation gives what result, so here it goes:
1. Installing SlimBeam, and then PAC: E: Error executing update binary in zip 'tmp/mr_update.zip'
2. Installing PAC, and then SlimBeam: Installation complited correctly, secondary system(SlimB) loading forever with PAC boot animation - probbably because of kernel?
3. Installing PAC and then SlimBeam with seperated cernel: (In Multiroom when booting SlimB) Error Kexec-hardboot support required to boot this ROM...
In this case I'm guessing that patching this kernel could help, but it's superadvanced for me
Click to expand...
Click to collapse
The kernel of your primary ROM needs to support kexec. I don't think this is true for the pac nor the slim kernel. You will have to flash a custom kernel on your primary ROM.
Dexxon said:
The kernel of your primary ROM needs to support kexec. I don't think this is true for the pac nor the slim kernel. You will have to flash a custom kernel on your primary ROM.
Click to expand...
Click to collapse
Exactly.
Idk either how it looks like with pac as secondary, because of such mentioned problems.
I am on a good way to finding right kernel for that and trying to flash it, and test if it works.
Ty for reply.
noone1101 said:
Exactly.
Idk either how it looks like with pac as secondary, because of such mentioned problems.
I am on a good way to finding right kernel for that and trying to flash it, and test if it works.
Ty for reply.
Click to expand...
Click to collapse
Your Problems consists of 3 things:
1. U need a kernel with Kexec-Support for the primary Rom to be able to boot secondary rom with other kernel. If u use same kernel for both rom, u dont need a kernel with Kexec-Support
2. To flash the kernel for secondary rom, u need a repacked kernel with ramdisk from destination rom, anykernel wont work, cause u cant flash it on secondary. It writes with "dd" direct to partition and this is wrong way for secondary Rom. So u have to choose a repacked kernel for secondary...
3. The script in most install.zips for 4.3 roms contains symlinks written over more than one line. These scripts wont work with multirom installer (TWRP MultiRom), so u have to modify script, extract from zip, write all symlinks and all other commands (which are broken into more than 1 line) in 1 line and copy back into zip. Install will work now (modification is for "Error executing update binary in zip 'tmp/mr_update.zip').
Bogeyof said:
Your Problems consists of 3 things:
1. U need a kernel with Kexec-Support for the primary Rom to be able to boot secondary rom with other kernel. If u use same kernel for both rom, u dont need a kernel with Kexec-Support
2. To flash the kernel for secondary rom, u need a repacked kernel with ramdisk from destination rom, anykernel wont work, cause u cant flash it on secondary. It writes with "dd" direct to partition and this is wrong way for secondary Rom. So u have to choose a repacked kernel for secondary...
3. The script in most install.zips for 4.3 roms contains symlinks written over more than one line. These scripts wont work with multirom installer (TWRP MultiRom), so u have to modify script, extract from zip, write all symlinks and all other commands (which are broken into more than 1 line) in 1 line and copy back into zip. Install will work now (modification is for "Error executing update binary in zip 'tmp/mr_update.zip').
Click to expand...
Click to collapse
the alternative to problem 3 is to install a rom, do a backup, install the rom you want and restore a backup as second rom. thats how i did it, noob-way

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

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

Permissive for sm-n7505

Hello, how are you all doing?
So I have tried dozens of ways to set my SELinux to permissive on my Samsung Note 3 Neo SM-N7505 (lollipop 5.1.1) but no success..I have tried:
1-Using apps, no success
2-Unpacking boot.img and editing kernel cmdline, no success (probably because my bootloader is locked not sure)
3-Using setenforce and other commands, no success
4-Using init.d support, no success
HELP ME OUT GUYS!..I really need to change my selinux
Thanks
Anyone?
The SELinux bootparam is disabled in kernel config by default.
I build an forced permissive Kernel for you:https://www.amazon.de/clouddrive/sh...TX3ciUcR3FPbUoaVZb?ref_=cd_ph_share_link_copy
Sources: https://github.com/davidmueller13/kernel_SM-N7505
Just unpack boot.img, replace zImage and repack.
I don't know if it's working without problems, because i dont't own the device and can't test it.
Thank you so much for replying and making the kernel! I really appreciate your hardwork even if it didn't work
I know how to extract boot.img but how do i replace the zlmage and then repack it again ..Please guide me (IN DETAILS LOL!)
Thanks
So I unpacked my boot.img and all I see is ramdisk and kernel..no zImage..where is it?
Why does your zImage has a .bin extension and not .img?
Is the Kernel file in my boot.img the zImage?..if so, should I delete it and replace it with your zImage ( rename it to kernel)?
Thanks
Depending on your Unpacking Tool, the zImage can be named differently. So just rename it to kernel and repack.
Should I change the extension of your zImage?..it is .bin not .img
It should have the same name and extension as the zImage in the unpacked boot.img, otherwise the your unpack tool will not find it.
But i actually didn't gave and see any extension at the file name of my uploaded file.
If you want, your can send me your boot image and i will repack it for you.
Does it contain private informations like my photos lol?
HelpMe101007 said:
Does it contain private informations like my photos lol?
Click to expand...
Click to collapse
No, of course not.It includes only the kernel, the initrd (Ramdisk), on many devices an device tree image and some information like commandline, pagesize etc.
Your User-Apps, App data etc. are on the data Partition (your photos are most likely at data/media).
Here is my boot.img. All I want is SELinux to be permissive nothing else.
And I would really appreciate it if you can make the new boot.img in tar.md5 so I can flash it easily with Odin.
Thanks !
https://www.amazon.de/clouddrive/sh...rRxVAbaPRKIc81SK9H?ref_=cd_ph_share_link_copy
Caused bootloop
Try this first (it's SELinux Enforcing):https://www.amazon.de/clouddrive/sh...kV4YVLHXJq5ewLL5Lb?ref_=cd_ph_share_link_copy
If it works, try this:https://www.amazon.de/clouddrive/sh...bHN6WQ2p0fpGLU0sOd?ref_=cd_ph_share_link_copy
If the first is working, but the second not, we try it with selinux bootparam enabled.
What kind of bootloop. Does the device pass the Splashscreen (Model Number) and show bootanimation?
No it doesnt pass the splash screen
First one is not working
HelpMe101007 said:
First one is not working
Click to expand...
Click to collapse
that's really strange, because it's just straight compiled from Samsungs Kernel Sources with linaro 4.8 (passes without errors) in contrast to the first try with a lot of fixes for compiling with 4.9.
Please try this last one, it's just repacked, so wen can see, if there is the problem:https://www.amazon.de/clouddrive/sh...fC3hJtzBPimxd4OQmW?ref_=cd_ph_share_link_copy
It's really unlikely, but not impossible, that Samsung released broken kernel Sources.
(I also noticed some file size difference of nearly 10 KB).
Maybe the way I am flashing is wrong?..I put your tar in AP in Odin then flash it, correct?
Your untouchedboot caused bootloop as well but a weird one.My phone did make it to the Home screen but then immediately rebooted and kept rebooting at the boot animation ( it passed the splash screen)

build custom kernel without magisk

I am building custom kernel (boot.img included ramdisk) to lg g8s,
As I see in the internet, the only way to do root is to use "magisk manager" and patch the boot.img (online).
I did review to Magisk patch, and changes are expressed in the "init" file (in the ramdisk) and adding big big blob to the kernel and I ask why ?
Anyway, I wanted to ask if it's possible to add root user to the android kernel with kernel build flags or any other legitimate way ?
Thanks,
Edit:
I see Magisk change the previous kernel to load /init patched file in purpose to run as root,
Generally, initramfs does no mounted as rootfs (the system partition mounted to rootfs "/"),
Anyone know which kernel flags need to be change to do mount to rootfs ?
Thanks,

Categories

Resources