Need help unpacking and repacking boot.img - G 2014 Q&A, Help & Troubleshooting

Hey guys I'm working on a bigger problem but part of it is that I need to unpack and repack the boot.img.
I've tried it with abootimg and unmkbootimg, but in both cases the phone won't boot anymore after flashing the new boot.img, even if I've made absolutely no changes.
I'm on 6.0 (BR).
Would really appreciate it if anyone could help me out!

90180360 said:
Hey guys I'm working on a bigger problem but part of it is that I need to unpack and repack the boot.img.
I've tried it with abootimg and unmkbootimg, but in both cases the phone won't boot anymore after flashing the new boot.img, even if I've made absolutely no changes.
I'm on 6.0 (BR).
Would really appreciate it if anyone could help me out!
Click to expand...
Click to collapse
https://github.com/xiaolu/mkbootimg_tools if you are on Linux.

LuK1337 said:
https://github.com/xiaolu/mkbootimg_tools if you are on Linux.
Click to expand...
Click to collapse
Thanks a lot man!
Simply unpacking the boot.img, repacking and flashing works now!
What I noticed that while it provides me with both the compressed and decompressed ramdisk, it uses the compressed ramdisk when repacking. As I'd like to make changes to the ramdisk, what tools should I use compress?

90180360 said:
Thanks a lot man!
Simply unpacking the boot.img, repacking and flashing works now!
What I noticed that while it provides me with both the compressed and decompressed ramdisk, it uses the compressed ramdisk when repacking. As I'd like to make changes to the ramdisk, what tools should I use compress?
Click to expand...
Click to collapse
Just modify the extracted one, it'll compress it again and use it for boot.img creation.

LuK1337 said:
Just modify the extracted one, it'll compress it again and use it for boot.img creation.
Click to expand...
Click to collapse
Thanks man, you're a legend!
So what I'm actually trying to do is add a module to the kernel. What I did now is add its hash to module_hashes, which fixed the permissions issue.
Unfortunately, when I try to add it now, I get
Code:
[email protected]_udstv:/sdcard # insmod xt_HL.ko
insmod: failed to load xt_HL.ko: Exec format error
dmesg reveals
Code:
xt_HL: disagrees about version of symbol module_layout
As said, I'm on 6.0 stock (BR). To compile the module, I used the 5.0.2 source using "msm8226_defconfig".
It was probably very naive of me to think that this could actually work? I'm sorry this is all very new to me.

90180360 said:
Thanks man, you're a legend!
So what I'm actually trying to do is add a module to the kernel. What I did now is add its hash to module_hashes, which fixed the permissions issue.
Unfortunately, when I try to add it now, I get
Code:
[email protected]_udstv:/sdcard # insmod xt_HL.ko
insmod: failed to load xt_HL.ko: Exec format error
dmesg reveals
Code:
xt_HL: disagrees about version of symbol module_layout
As said, I'm on 6.0 stock (BR). To compile the module, I used the 5.0.2 source using "msm8226_defconfig".
It was probably very naive of me to think that this could actually work? I'm sorry this is all very new to me.
Click to expand...
Click to collapse
Rebuilt zImage and rest of modules and it /should/ work.
btw: http://unix.stackexchange.com/quest...sagrees-about-version-of-symbol-module-layout

I'm sorry that I have to bother you again.
LuK1337 said:
Rebuilt zImage and rest of modules and it /should/ work.
Click to expand...
Click to collapse
I compiled my new module together with the kernel and the other modules. When I replace the kernel file of the unpacked boot.img and then repackage and flash, I get thrown into recovery when trying to boot.
Did I misunderstand or is this what you were suggesting?
LuK1337 said:
btw: http://unix.stackexchange.com/quest...sagrees-about-version-of-symbol-module-layout
Click to expand...
Click to collapse
If I understand correctly, I should try to extract the Module.symvers file from the kernel and then use this to compile the new module? I've tried following this article.
When using extract-symvers, I get the following error:
Code:
$ python2 ./extract-symvers.py -B 0x00008000 kernel
Traceback (most recent call last):
File "./extract-symvers.py", line 139, in <module>
main()
File "./extract-symvers.py", line 135, in main
for s, crc, t in kernel.symbols():
File "./extract-symvers.py", line 101, in symbols
symsearch = self.scan_symsearch()
File "./extract-symvers.py", line 89, in scan_symsearch
unused = self.read_uint(off)
File "./extract-symvers.py", line 61, in read_uint
return struct.unpack(self.endian + 'I', self.kernel[offset:offset + 4])[0]
struct.error: unpack requires a string argument of length 4
This is the content of img_info:
Code:
kernel=kernel
ramdisk=ramdisk
dt=dt.img
page_size=2048
kernel_size=6902872
ramdisk_size=947793
dtb_size=1751040
base_addr=0x00000000
kernel_offset=0x00008000
ramdisk_offset=0x01000000
tags_offset=0x00000100
cmd_line='console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x37 vmalloc=400M utags.blkdev=/dev/block/platform/msm_sdcc.1/by-name/utags movablecore=160M'
board=""
format=gzip

90180360 said:
I'm sorry that I have to bother you again.
I compiled my new module together with the kernel and the other modules. When I replace the kernel file of the unpacked boot.img and then repackage and flash, I get thrown into recovery when trying to boot.
Did I misunderstand or is this what you were suggesting?
If I understand correctly, I should try to extract the Module.symvers file from the kernel and then use this to compile the new module? I've tried following this article.
When using extract-symvers, I get the following error:
Code:
$ python2 ./extract-symvers.py -B 0x00008000 kernel
Traceback (most recent call last):
File "./extract-symvers.py", line 139, in <module>
main()
File "./extract-symvers.py", line 135, in main
for s, crc, t in kernel.symbols():
File "./extract-symvers.py", line 101, in symbols
symsearch = self.scan_symsearch()
File "./extract-symvers.py", line 89, in scan_symsearch
unused = self.read_uint(off)
File "./extract-symvers.py", line 61, in read_uint
return struct.unpack(self.endian + 'I', self.kernel[offset:offset + 4])[0]
struct.error: unpack requires a string argument of length 4
This is the content of img_info:
Code:
kernel=kernel
ramdisk=ramdisk
dt=dt.img
page_size=2048
kernel_size=6902872
ramdisk_size=947793
dtb_size=1751040
base_addr=0x00000000
kernel_offset=0x00008000
ramdisk_offset=0x01000000
tags_offset=0x00000100
cmd_line='console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x37 vmalloc=400M utags.blkdev=/dev/block/platform/msm_sdcc.1/by-name/utags movablecore=160M'
board=""
format=gzip
Click to expand...
Click to collapse
Which file are you replacing zImage with?
Sent from my Moto G 2014 LTE using Tapatalk

LuK1337 said:
Which file are you replacing zImage with?
Click to expand...
Click to collapse
When unpacking boot.img, I get a "kernel" file. I replaced this with the "zImage" file which I compiled.

90180360 said:
When unpacking boot.img, I get a "kernel" file. I replaced this with the "zImage" file which I compiled.
Click to expand...
Click to collapse
Try arch/arm/boot/compressed/vmlinux.

LuK1337 said:
Try arch/arm/boot/compressed/vmlinux.
Click to expand...
Click to collapse
If I use this file as kernel, it kicks me right back to the bootloader when I try to boot after flashing the new boot.img.

BTW, I've also tried to manually decompress the kernel by stripping everything before "1f 8b 08" (gzip file signature), but unfortunately this didn't provide a valid archive file.

Alternatively, does anyone know which ROMs have the xt_HL.ko module ("TTL" target support) enabled?

Would it be easier to add this module if I was running CyanogenMod or could it even be officially added?

90180360 said:
Would it be easier to add this module if I was running CyanogenMod or could it even be officially added?
Click to expand...
Click to collapse
CM has disabled modules so you'd have to =y it. I doubt we'll enable it officially..
Sent from my Moto G 2014 LTE using Tapatalk

Related

Building CM Kernel Discussion

Hey guys,
Currently I'm planning to learn a thing or two about building Kernel...
As per Knzo's posting at G+ here are the steps:
Manuel Saraiva - Oct 11, 2011 - Limited (locked)
Since I'm receiving so many requests on how to build and tune CM's kernel for Optimus Black, here's a short tutorial:
0. You'll need: a linux distro like ubuntu, some packages (check CM's wiki on how to build a kernel for a list of them) and some GB of free space.
1. Go to github.com/cyanogenmod/lge-kernel-sniper, download and extract.
2. You'll need a .config file to build. Either pull it from /proc/ (check CM's wiki on how to build a kernel for the full command) or build it from CM's defconfig (located in arch/arm/config).
3. Download a toolchain of your choice. CodeSourcery is fine. I personally use Linaro though.
4. Edit Makefile and change the ARCH flag to arm and the CROSS_COMPILER flag to your toolchain's bin folder, ending on arm-linux-eabi- or whatever.
5. Do the desired modifications.
6. Build. You'll get a zImage and the modules (.ko).
7. Since Koush's AnyKernel doesn't work on Black (afaik), just unpack a boot.img (obtained from a nandroid or something) using unpackbootimg tool or a kitchen like dsixda. Then replace the zImage, repack.
8. Now create a flashable package with the boot.img and the modules in /system/lib/modules.
Click to expand...
Click to collapse
Anyone tried it? If yes, please share your knowledge so we can learn together....
Currently i'm stack at Linaro setup, it has too much dependency and i'm failed to instal qemu-arm-static...
I tried to run ./configure but there is error
Error: zlib check failed
Make sure to have the zlib libs and headers installed.
Click to expand...
Click to collapse
I've tried to intall zlib, but still no luck......
Regardig to Linaro, you don't have to install anything.
Once all installed (previous to toolchain), you only have to download linaro (in my case linaro 4.5 to match gcc version) in .zip version (not binary to install) and decompress it into a certain folder. Then, you have to add linaro's folder to path and set CCOMPILER to new linaro's bin folder (+ the sufix of the files contained into it).
Regards.
hi, help me
after comand make ARCH=arm CROSS_COMPILE=$CCOMPILER -j`grep 'processor' /proc/cpuinfo | wc -l`
i have
mm/page-writeback.c: In function 'write_cache_pages':
mm/page-writeback.c:822: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[1]: *** [mm/page-writeback.o] Ошибка 1
make: *** [mm] Ошибка 2
make: *** Ожидание завершения заданий...
what is it?
Huexxx said:
Regardig to Linaro, you don't have to install anything.
Once all installed (previous to toolchain), you only have to download linaro (in my case linaro 4.5 to match gcc version) in .zip version (not binary to install) and decompress it into a certain folder. Then, you have to add linaro's folder to path and set CCOMPILER to new linaro's bin folder (+ the sufix of the files contained into it).
Regards.
Click to expand...
Click to collapse
I cannot get .config from /proc/ to build the kernel... where is it supposed to be?
At /proc/ you can found config.gz, but if you rename it to .config, you get it!
Huexxx said:
At /proc/ you can found config.gz, but if you rename it to .config, you get it!
Click to expand...
Click to collapse
I even cannot find config.gz from /proc/.. I am using Nova Rom anyway.. or should I use CM to get it?
Sent from my LG-P970 using XDA App
You need config.gz from a running kernel like the one you want to compile.
Then, if you want to compile CM7, you need config.gz from /proc/ of a OB with CM7 running.
If you don't have a OC with CM7, why do you want to compile that kernel?
Regards.
Huexxx said:
You need config.gz from a running kernel like the one you want to compile.
Then, if you want to compile CM7, you need config.gz from /proc/ of a OB with CM7 running.
If you don't have a OC with CM7, why do you want to compile that kernel?
Regards.
Click to expand...
Click to collapse
I see, thanks for the explaination Huexxx...
Right know I'm still on the stage of learning, it's still far away from dev-ing. And also OB is my only phone, so I can't experiment too much on it...
But I had boot.img from CM7 SK7-2 nand backup in my phone and I tried to extract the .config from it using script as told in CM wiki page:
Retrieve a working kernel config from the device, and unzip it:
adb pull /proc/config.gz /home/user_name/android/kernel/cm-kernel/config.gz
cat config.gz | gunzip > .config
Alternatively, you can pull the .config from the newest boot.img
scripts/extract-ikconfig boot.img > .config
Click to expand...
Click to collapse
But i got error:
scripts/extract-ikconfig boot.img > .config
bash: .config: Is a directory
Click to expand...
Click to collapse
Only two things:
- The boot.img from SK7-2 doesn't have config info.
- Where you are attemting to extract the file, seems to have a .config folder... Try with another name (config.gz for example) and then rename it...
Why not ask for a config.gz from anybody?
Huexxx said:
Only two things:
- The boot.img from SK7-2 doesn't have config info.
- Where you are attemting to extract the file, seems to have a .config folder... Try with another name (config.gz for example) and then rename it...
Why not ask for a config.gz from anybody?
Click to expand...
Click to collapse
I can't find config.gz neither...
I'll appreciate if someone provide me the file....
hi guys,i decide to join in
donwloading toolchain,very slow speed here

how to build kernel ramdisk

let me explain my problem, i've created a .ftf (kernel for xperia x8) and it is boot up but i missed some files inside the ramdisk, so now i need to repack my new ramdisk folder into ramdisk file and i don't know how to do that .
Read my guide on how to compile and put together a custom kernel for the X8: http://forum.xda-developers.com/showthread.php?t=1923240
The method (whatever it is) you are following is not correct for any Android phone.
Oops. I guess it isn't mentioned there.
Basically what you have to do is open up a Terminal in Ubuntu. Navigate to your ramdisk folder (the one that contains the init.rc, init.usb.rc etc.). Then issue this command:
Code:
find . | cpio -o -H newc | gzip > ../ramdisk
Grab the ramdisk from one directory above your ramdisk folder.
Sorry for the confusion.
sgt. meow said:
Read my guide on how to compile and put together a custom kernel for the X8: http://forum.xda-developers.com/showthread.php?t=1923240
The method (whatever it is) you are following is not correct for any Android phone.
Click to expand...
Click to collapse
i don't understund one thing, when i'm getting the ramdisk file? when compiling the rom?or the kernel?
i've compiled cm10.1 rom and i need to change the bootclasspath
You have to unpack a working kernel with DooMLorD's kernel.sin unpacker. You'll get the ramdisk. Then edit the BOOTCALSSPATH in init.rc.
sgt. meow said:
Read my guide on how to compile and put together a custom kernel for the X8: http://forum.xda-developers.com/showthread.php?t=1923240
The method (whatever it is) you are following is not correct for any Android phone.
Oops. I guess it isn't mentioned there.
Basically what you have to do is open up a Terminal in Ubuntu. Navigate to your ramdisk folder (the one that contains the init.rc, init.usb.rc etc.). Then issue this command:
Code:
find . | cpio -o -H newc | gzip > ../ramdisk
Grab the ramdisk from one directory above your ramdisk folder.
Sorry for the confusion.
Click to expand...
Click to collapse
when i run the i get this error
bash: ../ramdisk: Is a directory
Name the folder that has the ramdisk contents something like "XYZ" and put it in another folder named "ABC". Then issue this command.
So basically the structure would be:
/ABC/XYZ/* /*ramdisk contents have been denoted by * */
And after issuing the command grab the ramdisk from ABC folder.
sgt. meow said:
Name the folder that has the ramdisk contents something like "XYZ" and put it in another folder named "ABC". Then issue this command.
So basically the structure would be:
/ABC/XYZ/* /*ramdisk contents have been denoted by * */
And after issuing the command grab the ramdisk from ABC folder.
Click to expand...
Click to collapse
yeah thank you now it's working but i think something is missing , can you help me in developed kernel for cm10.1 ?
i already compiled the rom but now i'm struggling with the kernel part , i can send you all the files for the ramdisk and if you can put together a working kernel it will be great and i can move on and fix the problems with the rom itself
Look man. I can download the source and help you compile the kernel and the ramdisk. But as Daveee10 has said, even if you get it booting, there are tons of things that need to be backported (which is extremely hard) for it to work properly. So it's almost like choosing a route that you know will lead to a dead-end. But I'll help anyway.
PM me.

How do you unpack and repack boot.img?

NOTE: Unfortunately I've had to remove links from this post because I'm a new user. I'll add them back in once I have enough posts.
I've been trying to edit a file in boot.img from the CyanogenMod 12.1 (huashan) nightlies but I'm experiencing some issues finding the right tools/methods for the job.
Most scripts I've found expect an Android Magic number at the beginning of the file but this simply isn't there. It seems there is no header at all that matches the specification from bootimg.h (missing link) though I did discover the cmdline argument at the end of the file with a hex editor.
After searching and experimenting for hours I found a script here (missing link) which enabled me to extract the kernel and ramdisk images despite the missing header but now I don't know how to repack the files into a boot.img of the same structure.
I've tried the following but it results in a boot.img that is about 40% larger than the orginal (despite me only adding one line of code) and has an entirely different structure (with an Android Magic number, etc.).
Code:
mkbootimg --base 0x00200000 --pagesize 2048 --kernel boot.img-kernel.gz --ramdisk newramdisk.cpio.gz -o newboot.img
I found this resource (TWRP, missing link) which mentions that Xperia devices have special boot images (or something like that, I didn't understand all of it) - this might explain why the boot.img structure is so different - but I can't find any further documentation on this or instructions on how to deal with the format.
The Xperia devices have a recovery-in-boot arrangement. This means that the recovery is booted using the regular kernel / boot image in the device. Team Win has worked with the FreeXperia device maintainers to come up with a way to extract the ramdisk from the FOTAKernel partition and use the ramdisk from that partition instead of the recovery that is included in the boot image of your device. This means that if you install current CM nightlies and flash TWRP to the FOTAKernel partition, you will be able to use TWRP instead of the CWM or CM recovery that normally comes in a CM boot image. Other boot images including stock kernels can be repacked to include this extraction utility to allow you to use TWRP from the FOTAKernel partition. This setup allows you to choose what recovery you want to have installed and allows you to update your recovery more easily. Unfortunately this setup requires that the boot image that you have installed include the ramdisk extraction utility.
Click to expand...
Click to collapse
So now I'm at a loss at how to continue. I would much appreciate any pointers, ideas or help in general.
@infernalpostcard , hopefully this tool made by @Adrian DC will help you out.
https://github.com/AdrianDC/android_huashan_bootimg_editor
Raienryu said:
@infernalpostcard , hopefully this tool made by @Adrian DC will help you out.
https://github.com/AdrianDC/android_huashan_bootimg_editor
Click to expand...
Click to collapse
Thanks. This looks really promising. I'm trying it out now...
EDIT: It worked! This is exactly what I needed. Unfortunately what I was actually trying to achieve (apply a fix to break a boot-loop my phone gets in, due to an encrypted filesystem) didn't work so I'll have to come up with new ideas.

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)

Samsung Galaxy Tab A 7.0 LTE (2016) SM-T285 Lineage OS complete build guide

For SM-T285 users that want to build Lineage OS for their own device I have posted a complete build guide here:
https://github.com/lineage-gtexslte/build_guide
jedld said:
For SM-T285 users that want to build Lineage OS for their own device I have posted a complete build guide here:
https://github.com/lineage-gtexslte/build_guide
Click to expand...
Click to collapse
Thanks for the ROM update!
I started from scratch and when I compiled, I got this error:
fixdep: error opening config file: ../../../../../../kernel/samsung/gtexslte/scripts/genksyms/parse.tab.c: No such file or directory
I have had this error before and had to copy the file from another folder, but I should not have to do this.
So, I copied the file to folder where it was missing.
New error:
target Prebuilt: am (/home/gcrutchr/taba/out/target/product/gtexslte/obj/EXECUTABLES/am_intermediates/am)
Symlink: /home/gcrutchr/taba/out/target/product/gtexslte/system/bin/app_process -> app_process32
clang++: error: unable to execute command: Aborted (core dumped)
clang++: error: linker command failed due to signal (use -v to see invocation)
gcrutchr said:
Thanks for the ROM update!
I started from scratch and when I compiled, I got this error:
fixdep: error opening config file: ../../../../../../kernel/samsung/gtexslte/scripts/genksyms/parse.tab.c: No such file or directory
I have had this error before and had to copy the file from another folder, but I should not have to do this.
So, I copied the file to folder where it was missing.
New error:
target Prebuilt: am (/home/gcrutchr/taba/out/target/product/gtexslte/obj/EXECUTABLES/am_intermediates/am)
Symlink: /home/gcrutchr/taba/out/target/product/gtexslte/system/bin/app_process -> app_process32
clang++: error: unable to execute command: Aborted (core dumped)
clang++: error: linker command failed due to signal (use -v to see invocation)
Click to expand...
Click to collapse
What's your gcc version? might need to use gcc 6
jedld said:
What's your gcc version? might need to use gcc 6
Click to expand...
Click to collapse
gcc version 8.1.1 20180712 (Red Hat 8.1.1-5) (GCC)
gcrutchr said:
gcc version 8.1.1 20180712 (Red Hat 8.1.1-5) (GCC)
Click to expand...
Click to collapse
later versions of gcc may not work with lineage 14.1, I had to downgrade mine, though for another project.
you can do:
Code:
sudo apt-get install gcc-6 g++-6 g++-6-multilib
sudo update-alternatives --install
inform me if this works and I'll update my guide. Might consider making a docker based build if issues like this happen often.
jedld said:
later versions of gcc may not work with lineage 14.1, I had to downgrade mine, though for another project.
you can do:
Code:
sudo apt-get install gcc-6 g++-6 g++-6-multilib
sudo update-alternatives --install
inform me if this works and I'll update my guide. Might consider making a docker based build if issues like this happen often.
Click to expand...
Click to collapse
Actually, I am on Fedora Linux (uses less resources) and have been using gcc 8xx for some time. I compile LineageOS 14.1 for Note 3 (ha3g) and the Note Pro 12.3 (v1a3g) and have no problems. But, I will investigate further.
Ok...so I had issues building the kernel...could not find some include files.
So...I decided to use build_kernel.sh script to to make boot.img. The resultant file is about 1.4 MB smaller, there is no init file in the ramdisk folder and the boot.img-ramdisk.cpio.gz in the split_img folder is about 1/2 the size of your recent boot.img file.
Not sure when to go from here.
Okay, so I followed the instructions - after upgrading Fedora to v29 - but, this time I used Docker. Had to make some script changes for Fedora, but got most everything installed. The "work" directory is empty. I was able to make a working system.img that installed with the built .zip file. The kernel would not boot - hung on the logo screen. I restored the 10/17 boot.img and the system booted up. Now, I will work on the boot.img file. I did notice this time that the boot.img file was about the same size as the 10/17 boot.img file I downloaded. So, that's an improvement. I just finished modifying the build_kernel.sh file. So, I installed the kernel I made and it still hung on the logo screen. So, back to square 1 regarding the kernel.
gcrutchr said:
Okay, so I followed the instructions - after upgrading Fedora to v29 - but, this time I used Docker. Had to make some script changes for Fedora, but got most everything installed. The "work" directory is empty. I was able to make a working system.img that installed with the built .zip file. The kernel would not boot - hung on the logo screen. I restored the 10/17 boot.img and the system booted up. Now, I will work on the boot.img file. I did notice this time that the boot.img file was about the same size as the 10/17 boot.img file I downloaded. So, that's an improvement. I just finished modifying the build_kernel.sh file. So, I installed the kernel I made and it still hung on the logo screen. So, back to square 1 regarding the kernel.
Click to expand...
Click to collapse
Were you able to obtain a logcat with the failed boot? Possible issue is that the external kernel modules did not get compiled
jedld said:
Were you able to obtain a logcat with the failed boot? Possible issue is that the external kernel modules did not get compiled
Click to expand...
Click to collapse
Actually, not sure how I got it to compile. Having problems with docker. Cannot run python or any other dev command. Stuck as root user. So am trying to learn about docker. I do not think I was in docker when it compiled. Will get back to you after I figure this whole mess out.
27 October 2018
After reading the Docker documentation and playing with Docker, I removed it from Fedora. It is just too complicated to use even though it sounds simple. After removing Docker, I did a make clean and a make mrproper in the kernel folder. I ran 'brunch gtexslte'. The compile completed after I copied mkbootimg to the out folder - for some reason it is not getting copied there during the make process. This time the boot.img was over 9mb. It still will not boot. I will get log files today. I will also check to make sure the system files work with the good boot.img.
Question how do I update the system folder to the latest builds of lineage 14.1?
Your repo xml file restricts the source to your repo.
Okay!
Fixed boot.img not booting.
If you unpack boot.img, the file 'boot.img-imgtype' has an invalid image type. In the file, it says 'AOSP-PXA'.
It should say 'AOSP'.
I do not know where this is getting added. I have done a grep and could not find it.
As a side note, I used the build_kernel.sh script to make the kernel.
Question: How do I apply the security updates without manually following the (-) (+) in the diff file?
I am now able to do a complete make and install using the generated .zip file.
Here are the steps:
1. Setup your environment - I am using Fedora, but these instructions will work for any flavor of linux
2. Make sure you have the linaro gcc toolchain (32-bit) installed, and you have modified kernel/samsung/gtexslte/build_kernel.sh
3. Run: build/envsetup.sh, then brunch gtexslte
4. If the brunch stops near the end, copy mkbootimg from system/core/mkbootimg to out/host/linux-x86/bin
......or you can write a shell script to copy the file, as I did, before starting the build
5. After the build completes, cd into kernel/samsung/gtexslte
6. Run make mrproper, to clean the kernel folders
7. Run build_kernel.sh
8. After the kernel (zImage) is built, you need to make the boot.img
9. @jedld has posted how to do this in his build instructions
10. Now that you have a boot.img, you need to modify it.
11. Unpack boot.img
12. In the file 'boot.img-imgtype' , you need to change 'AOSP-PXA' to 'AOSP' - without the quotes
13. Repack boot.img
14. Replace boot.img in the lineage*.zip file with the one you just modified
15. Copy the lineage*.zip to you Tab-A, reboot into recovery and install it.
Here is my script for copying the mkbootimg file into the out folder, BEFORE I run brunch gtexslte:
if [ ! -d "out/host" ]; then
mkdir out/host
mkdir out/host/linux-x86
mkdir out/host/linux-x86/bin
fi
cp system/core/mkbootimg/mkbootimg out/host/linux-x86/bin
@jedld
Update on normal kernel build:
The reason the boot.img - when building via brunch gtexslte - will not boot is a bad zImage. If I replace the zImage from a bootable boot.img, the bad boot.img will boot okay.
Now I need to figure out what the problem is.
you can get the incremental diffs from linux.org
jedld said:
you can get the incremental diffs from linux.org
Click to expand...
Click to collapse
Is this for kernel changes or security patches?
gcrutchr said:
Is this for kernel changes or security patches?
Click to expand...
Click to collapse
My mistake, I meant kernel.org not linux.org. The incremental diffs contain changes to the mainline kernel which can contain security fixes and/or bug fixes. This is different from android specific patches which google releases separately as kernel patches. The kernel started out from the stock sources provided by samsung on 5.1.1 and then I added google's N and Oreo patches on it (patches related to selinux and oreo binder enhancements). I also added incremental diffs from kernel.org, it started out at 3.10.58 and then I applied incremental diffs until I got to 3.10.107. Unfortunately 3.10 is EOL now, upgrading the kernel to the 4.10 series will take a lot of work.
The SM-T285 Lineage OS is excellent. Is it possible to get the FM radio working? I have tried everything but can't get it to work. I would appreciate your help.
akasarf said:
The SM-T285 Lineage OS is excellent. Is it possible to get the FM radio working? I have tried everything but can't get it to work. I would appreciate your help.
Click to expand...
Click to collapse
It's probably not implemented in the kernel.
Just downloaded Radio FM from PlayStore and installed it. It works!!
I meant if there is a working FM radio tuner app that works without the internet on Lineage
gcrutchr said:
It's probably not implemented in the kernel.
Just downloaded Radio FM from PlayStore and installed it. It works!!
Click to expand...
Click to collapse

Categories

Resources