yashsingh1/xdaforums huggingface dataset:
[Android Software Development] Jonatino:
I'm using cyanogenmod 6.0 if that makes every difference. I was bootlooping until I found out you had to bump your img file. After that it works fine.
[Android Software Development] max4wdc:
i have this problem now with android 6.0.1 boot.img from moto x style with v 6.0.0 i had no problem and works prefcet .

Splitting image to "split_img/"...
BOARD_KERNEL_CMDLINE console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom msm_rtb.filter=0x37 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 earlyprintk=msm_hsl_uart,0xf991e000 utags.blkdev=/dev/block/bootdevice/by-name/utags utags.backup=/dev/block/bootdevice/by-name/utagsBackup
BOARD_KERNEL_BASE 00000000
BOARD_NAME
BOARD_PAGE_SIZE 4096
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 01000000
BOARD_TAGS_OFFSET 00000100
BOARD_DT_SIZE 4612096

Unpacking ramdisk to "ramdisk/"...

Compression used: data
Error!
[Android Software Development] osm0sis:
Hmm, bootloader update? Might not be anything I can do if they deviated, but upload the image in question so I can take a look.

Edit: [MENTION=4401346]max4wdc[/MENTION], since you didn't reply I hunted it down in your linked thread, and it unpacks just fine in AIK-mobile and Win32 here (gzip, 8196 blocks). So maybe try downloading AIK again.
[Android Software Development] max4wdc:
thanks , i tested on ubuntu 64bit , anyway when i wanted to unpack and repack boot version 6.0.0 on windows it was okay but it has a problem with repacking because wifi broken after flashing the kernel and then i go to my ubuntu and rework what i did on windows and it has no problem at all , so because of this i only tested on linux .

i will do it on windows someday , thank you :fingers-crossed:

edit : yep i download boot img again and it's work , i blame bad firefox on ubuntu :D IDM on windows did it fine , i test it again on ubuntu .

thank you very much .
[Android Software Development] osm0sis:
Let me know if wifi breaks when you use the latest AIK Win32 or AIK-mobile (or AIK-Linux

without

the --sudo switch). I added a patch to mkbootfs for AIK v2.3+v2.4 that resolved it on a different Moto device, so it might be fixed for yours now too. :good:

https://github.com/osm0sis/mkbootfs/commit/77dff554ce108cd77ba270d0cdff5e249169eada
[Android Software Development] andy_zhang:
@ osm0sis Sir, I have a trouble, I am lgvs985 user, I use AIK -LINUX unpack &repack boot.img,but flash my phone, bootloop. I use ALK-win32 unpack the boot (after treatment ALK-LINUX ),Prompt error, ramdisk is empty file.

Sorry for my English.

Boot: https://mega.nz/#!EsZwQL4R!R6zQYnY7cm4YbmT1dIZ36W_Neqif0aB4uCJLMqw4so8

vs985 China user
[Android Software Development] hohassan444:
[MENTION=1143630]osmosis[/MENTION].. Great work, please can you add support for Mtk devices for mobile version
[Android Software Development] bovirus:
[MENTION=4544860]osm0sis[/MENTION],

I have some problems using your tool with some boot.img/recovery.img files.

I tested the same file with Carliv Image Kitchen and it worked.

Can I make a link to the recovery to analyze it?

I believe that could be useful a batch improvement (like used in Carliv Image Kitchen)

1. to select unpack or repack operation

2. To select form a list of file the recovery/boot image file

Thanks.
[Android Software Development] osm0sis:
Link to the image please, yes. Be aware I only support Android standard images though, please see the second post of the thread.
[Android Software Development] bovirus:
@ osm0sis

The recovery.img si coming from many Mediatek device.

Probably your tools is not able to detect mediatek header and couldn't work with this kind of images.

Please take care a look about Carliv Image Kitchen and relative program tools (that are similator to your tools) that work with standard Android images and Mediatek images.

Thanks.
[Android Software Development] osm0sis:
Yeah that's in the OP I told you to read. MediaTek have deviated from the Android standard and I clearly stated I do not support any OEM who does that at this time.
[Android Software Development] bovirus:
[MENTION=4544860]osm0sis[/MENTION]

Please take care that a lot of devices use Mediatek CPU and relative images.

Then as I explained Carliv Image Kitchen use more or less the same executable of your tools.

It means I beleive that could be easily to improve your tool to support standard Android and Mediatek images using theese executable files.

On the other hands I believe that you could improve your tool with more powerful batch with operation select (unpack/repack) and select file from a list.
[Android Software Development] osm0sis:
If you like the other kitchen, go use it. I read it the first time you posted and I have explained my reasoning for limiting my support to the official image standard on many occasions, so your insistence comes off more like promotion of a different kitchen within my thread, which is not appropriate.
[Android Software Development] bovirus:
[MENTION=4544860]osm0sis[/MENTION]

I jiust propose you an update/improvement about your tool.

If you don't like that someone propose you an improvements and if you consider my proposal of improvement as advertisemnt about other tool (that is not my scope) I didn'tmake any other proposal.

Thanks.
[Android Software Development] USBhost:
[MENTION=4544860]osm0sis[/MENTION] how do i properly credit you? i did not find anything about that in the op.

i added a mention of you and your work here http://xdaforums.com/showpost.php?p=56537090&postcount=1

but is that ok? or what do you want me to put?
[Android Software Development] osm0sis:
That's all most do. Thank you! I appreciate it. :)
[Android Software Development] jimbomodder:
OK first off thanks for your excellent work, now my question, I'm using mobile version and am trying to set kernel up as permissive, I changed it in default prop to permissive and once my phone reboots it's showing "kernel is not serenoid-enofcing" which to me means I've done it, yet once it reboots it shows enforcing in settings, any ideas? It's. Samsung galaxy A500FU.

Sent from my SM-A500FU
[Android Software Development] Vagelis1608:
Try adding this in cmdline:

androidboot.selinux=permissive
[Android Software Development] jimbomodder:
In default prop? Sorry still a noob on kernels
[Android Software Development] shoey63:
That trick doesn't work anymore on later android versions. The /init binary overrides it :(
[Android Software Development] jimbomodder:
Could I grab an "init" from another kernel? Say imperium kernel ? It's for S4 but only permissive

From the giver of stock roms
[Android Software Development] osm0sis:
What about adding a late_start service to init.rc to setenforce 0 and maybe override that?
[Android Software Development] jimbomodder:
Where would I put it?
[Android Software Development] osm0sis:
Anywhere in init.rc or init.<device>.rc, generally above/below the other services. Try this:

service setpermissive /system/bin/setenforce 0
class late_start
user root
group root
seclabel u:r:init:s0
oneshot
[Android Software Development] jimbomodder:
Could I change it here?

Sent from my SM-A500FU
[Android Software Development] osm0sis:
Yup, doesn't really matter where, just makes more sense to put it below another service to keep them together; the class specified is what defines the execution order. Note I changed the snippet in my previous post to have the full path. :good:
[Android Software Development] jimbomodder:
I've added here. Sorry for all the hassle

EDIT....

I put exactly what you said in and repacked, also changed default prop to setenforce=0

Rebooted telling me kernel was not enforcing but I got this

Sent from my SM-A500FU
[Android Software Development] jimbomodder:
Still shows enforcing
[Android Software Development] jimbomodder:
I use this app currently but I'd like to not use it and have same effect. View attachment 3743090hope it helps

Sent from my SM-A500FU
[Android Software Development] jimbomodder:
Here's the split img & ramdisk folder, any help where I'm going wrong.
[Android Software Development] USBhost:
https://github.com/USBhost/FIRE-ICE/commit/eb8d50c3074faec57da4298e53a8fd2060df4fed

Rebuild the kernel with that
[Android Software Development] jimbomodder:
Everything I'm doing is harder as I've currently got no PC and doing all on the actual phone

Sent from my SM-A500FU
[Android Software Development] CurtisMJ:
Just for future reference:

The message you see at boot about the kernel not being "SEANDROID ENFORCING" is not actually indicative of success in disabling SELinux at boot. Lollipop+ Samsung bootloaders display this message for ALL modified kernels, without ever actually performing checks for the status of SELinux. You can supress the message by appending "SEANDROIDENFORCE" to the end of the kernel image before flashing

echo "SEANDROIDENFORCE" >> boot.img

This shouldn't affect any mods you make to disable SELinux.

Otherwise, the init.rc in your screenshot does not have the full path to the "setenforce" binary. I haven't checked your posted zip. There is no PATH variable this early in boot, you need to be very specific as osm0sis suggested.

You might even have more success using a script in the "su.d" directory if you use SuperSU.

EDIT:

Lastly, if you happen to be using an unmodified stock kernel you might just be completely out of luck. Samsung made modifications to kernel code that prevent the use of SELinux permissive at all. Don't know if so with the A5, but you may need a PC to recompile the kernel. :(
[Android Software Development] robertv78:
Hi,

Thanks for all your great work on this tool, really helps simplify the whole process. I just have a small request, back in Feburary you committed a patch for mkbootfs to fix the permissions on certain Motorola specific files in the ramdisk. The latest AIK 2.4 for Windows doesn't appear to have this patched executable, do you have an updated windows binary for mkbootfs?

Thanks for your time,
[Android Software Development] osm0sis:
Good eye. :)

There aren't really enough changes to merit an update for AIK-Win32 at the moment (I'm waiting on the rest of the changes for N to roll out.. and then see what CM does about them since they stuck with C where AOSP went to Python for mkbootimg. ;)) but I'll happily provide the newer mkbootfs.exe in the meantime. :good:

[ Attachment removed due to inclusion in AIK v2.5 ]
[Android Software Development] fennectech:
I am unable to repack it not sure how
[Android Software Development] robertv78:
Excellent, thanks very much
[Android Software Development] osm0sis:
Super sleuth that I am.. ;)

The Android magic/header starts at 256 in your original image, so maybe that pre-header data is a signature or something necessary to boot. You could try re-appending the pre-header data to your new repacked image manually using a hex editor.
[Android Software Development] fennectech:
Nope i just tried it i can send you a copy of a working boot.img i could be doing it wrong

https://www.dropbox.com/s/lka2flt3eewastj/boot.img?dl=0

here is an untouched (well kernel boot line has been altered but this boot.img DOES boot
[Android Software Development] osm0sis:
Android Image Kitchen - UnpackImg Script
by osm0sis @ xda-developers

Supplied image: boot.img

Removing old work folders and files...

Setting up work folders...

Splitting image to "split_img/"...
Android magic found at: 256
BOARD_KERNEL_CMDLINE console=ttyHSL0,115200,n8 androidboot.hardware=qcom user_debug=31 ehci-hcd.park=3
BOARD_KERNEL_BASE 00000000
BOARD_NAME
BOARD_PAGE_SIZE 2048
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 02008000
BOARD_TAGS_OFFSET 01e00000
BOARD_DT_SIZE 731136

Unpacking ramdisk to "ramdisk/"...

Compression used: gzip
4105 blocks

Done!

Well everything looks fine.. so my best guess is still the mystery pre-header; maybe it's a checksum based on the rest of the image so needs to be regenerated when it's altered?

Only other thought is permissions. Did you try AIK-Linux with --sudo?
[Android Software Development] fennectech:
No because i used a text editor to alter the image and it does boot it DOES trip an tamper switch but it does boot
[Android Software Development] osm0sis:
Okay, well I'd recommend trying --sudo. If that works, then there's probably a patch I can add to mkbootfs for you, if not, then it's probably a checksum.
[Android Software Development] fennectech:
Do you mean for flashing I allways use SUDO
[Android Software Development] osm0sis:
Nope. AIK-Linux has a command line option: ./unpackimg.sh --sudo boot.img

Try using that to unpack, then repack your boot.img with no changes, and let me know if it boots please. If not, then it's probably to do with that pre-header checksum/signature.
[Android Software Development] fennectech:
I have been doing that part in a virtual machine that runs windows

i can modify the image directly using a hex editor without damaging it so its not a checksum
[Android Software Development] glennsamuel32:
Is there any guide on how to modify using a hex editor ? :D

I'm facing the same issue too with the newer GT-I500 Samsung S4 firmwares...

Using Ubuntu, I unpacked with --sudo and then repacked with --original, without making any changes...

It showed no errors but the phone is stuck at the animation screen...boot animation just goes on and on...
[Android Software Development] fennectech:
there isnt much you can do with a text editor only alter the kernel line
[Android Software Development] zaibansari20:
Working on Pantech Vega Iron (IM-A870)
[Android Software Development] fennectech:
[

where do i get the unpack.sh?
[Android Software Development] ndrancs:
I have been search this tool for so long time and finally i found it.

ELFtool: for unpack / repack kernel with ELF format.

Here

Http://xdaforums.com/showpost.php?p=37929951
[Android Software Development] osm0sis:
Thanks, added. Please edit your post to not quote the OP.

No idea what you're talking about, unpackimg.sh is in the AIK-Linux package, which is linked in the OP. Please edit your post to not quote the whole AIK-Linux OP.

It's been brought up before within this very thread, so you must not have searched very hard? The last time it was discussed, it wasn't working on Marshmallow yet.
[Android Software Development] Vagelis1608:
FYI, AIK works on all stock ROMs of the LG G2 Mini.
[Android Software Development] osm0sis:
Nice! Thanks, added. Loki or Bump required?
[Android Software Development] Vagelis1608:
Nope.

However, there is no official unlock method, so the bootloader (well, the aboot partition) has to be patched to bypass LG's Secure Boot.
[Android Software Development] zainifame:
[MENTION=4544860]osm0sis[/MENTION] how to fix this sir?

i want to unpack boot.img Lenovo K900 x86 arch

Android Image Kitchen - UnpackImg Script
by osm0sis @ xda-developers

Supplied image: boot.img

Setting up work folders . . .

Splitting image to "/split_img/" . . .

Android boot magic not found.
Error!

Press any key to continue . . .
[Android Software Development] osm0sis:
If there's no magic there's not much to be done; it's not a standard Android image. As always though, upload the image and I'll take a look to tell you exactly how it deviates.
[Android Software Development] zainifame:
this my boot.img sir

oya, i using AIK windows btw
[Android Software Development] osm0sis:
It's got that weird "$OS$" header like the newer Asus devices.. I'll add your device to the 2nd OP with them.
[Android Software Development] zainifame:
that's kernel cm11 btw, my device is Lenovo K900 (redhookbay), maybe dev in my device use some stuff source from asus zenfone 5 because Lenovo K900 and zenfone 5 have almost same spesification.

i can't unpack recovery too :eek:

please bring my device to working list sir :D many many thanks to you :highfive:

Android Image Kitchen - UnpackImg Script
by osm0sis @ xda-developers

Supplied image: recovery.img

Setting up work folders . . .

Splitting image to "/split_img/" . . .

Android boot magic not found.
Error!

Press any key to continue . . .
[Android Software Development] kirito9:
[MENTION=4544860]osm0sis[/MENTION]

I'm having a bit of trouble unpacking both my recovery.img and boot.img using your tool. It unpacks fine with CIKA but not with AIK. I'm not sure what if I'm not doing something right. It's an mtk device btw.

Android Image Kitchen - UnpackImg Script
by osm0sis @ xda-developers

Supplied image: recovery.img

Setting up work folders...

Splitting image to "split_img/"...
BOARD_KERNEL_CMDLINE
BOARD_KERNEL_BASE 10000000
BOARD_NAME
BOARD_PAGE_SIZE 2048
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 01000000
BOARD_TAGS_OFFSET 00000100

Unpacking ramdisk to "ramdisk/"...

Compression used: data
Error!
[kirito9@kirito9-pc AIK-Linux]$

MTK not supported.
[Android Software Development] osm0sis:
I appreciate that you tried to report this correctly and included your images (though you didn't mention your device name or model/variant), but you could have saved yourself some time by reading.

The 2nd OP talks about why MTK device images are different and unsupported by my kitchen, and it's been discussed probably dozens of times here in the past if you had searched before you posted.
[Android Software Development] kirito9:
Ahh I figured, thanks for the quick reply.
[Android Software Development] shoey63:
Just curious. If Carliv kitchen already works for your device, what did you hope to achieve by using AIK? What is missing?
[Android Software Development] kirito9:
I'm using this script to compile TWRP and [MENTION=4478781]yuweng[/MENTION] uses [MENTION=4544860]osm0sis[/MENTION] scripts to unpack/repack boot.img. My compiled TWRP wouldn't boot unless I made a dirty hack and replace the stock ramdisk with that of TWRP.

I just read last night a fix for that, it was my bad that I didn't read the FAQ. I was following the guide Menu by Menu and I thought I was doing something wrong with the unpack/repack.
[Android Software Development] DIXES:
Is this helpful for zenfone 5 & 6 support?

https://github.com/shakalaca/ZenFone-boot-tools
[Android Software Development] czecx:
Sorry for the stupid question.. I am Nexus 5X user. Is it possible to unpack and repack the zImage kernel with your tool? If no, how I can do it? Anyway, thank you for helping.
[Android Software Development] stang5litre:
You need AIK to unpack and pack along with a tool chain. That's why you need AIK.
[Android Software Development] osm0sis:
Definitely! Awesome find. I was looking into it though, and it doesn't seem to work on all $OS$ header images; the only ones I can get it to work correctly with are just specifically the Zenphone 5/6. I'm looking into the image differences to see if I can improve the tool and resolve this, so stay tuned. ;) :fingers-crossed:

Yeah, pretty much. The zImage is the compiled kernel source code, and what AIK does is split that and the ramdisk (root "/" filesystem) from the bootimg file, allowing you to change things in the ramdisk and repackage effortlessly with a couple clicks, commands, or taps, depending on your AIK edition.

There's no good way to decompile the zImage kernel into code and have it be useful, so, as [MENTION=4840281]stang5litre[/MENTION] suggests, you'd need to compile a new zImage from source if you want to make a feature change to the kernel itself. :good:
[Android Software Development] czecx:
I use the franco kernel in my device and I need to add the init.d support for her kenel.. thank you for helping
[Android Software Development] ShinySide:
init.d is done via the ram disk not the kernel/zimage

add

service sysinit /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
class main
disabled
oneshot

Into your init.rc I normally add it right after the service bootanim. Your rom will have to support it as well. Adding just the above doesnt give you init.d suppport
[Android Software Development] tajimura:
Will try and answer

Nobody cares what/where is this sent from.
[Android Software Development] tajimura:
Finally reached my PC. Kernel doesn't boot after repack/unpack.

Nobody cares what/where is this sent from.
[Android Software Development] osm0sis:
Damn. Alright. I'll look into it.

Edit: Think I (hopefully) figured it out. lzop was repacking with default compression -

\android_win_tools>lzop -lv ..\ramdsk-new.cpio.lzo

Method Length Packed Ratio Date Time Name
------ ------ ------ ----- ---- ---- ----
LZO1X-1 5155584 4350441 84.4% 2013-05-14 16:59 ..\ramdisk-new.cpio

Resulting in a much larger output ramdisk and image compared to the original.

\android_win_tools>lzop -lv ..\split_img\3.0.8-nAa-03_LT18.img-ramdisk.cpio.lzo

Method Length Packed Ratio Date Time Name
------ ------ ------ ----- ---- ---- ----
LZO1X-999/9 5155840 3696603 71.7% 2013-05-06 12:40 ..\split_img\3.0.8-naa-03_lt18.img-ramdisk.cpio

05/14/2013 04:51 PM 8,138,752 3.0.8-nAa-03_LT18.img
05/14/2013 05:14 PM 8,792,064 image-new.img
05/14/2013 05:14 PM 4,350,723 ramdisk-new.cpio.lzo

Adding the -9 parameter to the repack command seems to match it back up with the input image/ramdisk.

\android_win_tools>lzop -lv ..\ramdisk-new.cpio.lzo

Method Length Packed Ratio Date Time Name
------ ------ ------ ----- ---- ---- ----
LZO1X-999/9 5155584 3697714 71.7% 2013-05-14 17:11 ..\ramdisk-new.cpio

05/14/2013 04:51 PM 8,138,752 3.0.8-nAa-03_LT18.img
05/14/2013 05:11 PM 8,138,752 image-new.img
05/14/2013 05:11 PM 3,697,996 ramdisk-new.cpio.lzo

So in a nutshell: I'm guessing either your kernel didn't support the default compression level of lzop or the image file was just too big. Compression levels are a whole can of worms I was hoping to not get into by keeping things mostly at the defaults for the kernels I tested it on.. I'll take a look at a few more lzop's again - maybe they all use -9 and I just missed it.

P.S. Here's how the lzop preset parameters work out, oddly most of them result in the same level:

-1 LZO1X-1(15)
-2 LZO1X-1
-3 LZO1X-1
-4 LZO1X-1
-5 LZO1X-1
-6 LZO1X-1
-7 LZO1X-999/7
-8 LZO1X-999/8
-9 LZO1X-999/9

Edit 2: Nope. The Neo V image posted before used LZO1X-1 (default compression, which is the same as setting -2 through -6), so that's why I left it as such for v1.5, and it was reported working. I wonder if they would all be happy with -9?

[MENTION=2239585]tajimura[/MENTION] [MENTION=5154676]avinashrocks1990[/MENTION] - Please test it out; edit repackimg.bat and change Line 24 from:

if "%ramdiskcomp%"=="lzop" %bin%\mkbootfs ramdisk | %bin%\lzop > ramdisk-new.cpio.lzo

to:

if "%ramdiskcomp%"=="lzop" %bin%\mkbootfs ramdisk | %bin%\lzop -9 > ramdisk-new.cpio.lzo

Let me know if the resulting lzo ramdisk repacked images boot with that change on both the Arc S and Neo V.
[Android Software Development] tajimura:
I've also noticed ramdisk size increase, but thought that it's got to do something with cpio. Okay, will test it ASAP.

Nobody cares what/where is this sent from.
[Android Software Development] tajimura:
Okay, image size is now proper, but still kernel is not booting.

Nobody cares what/where is this sent from.
[Android Software Development] osm0sis:
Alright we'll just assume lzo is broken for now, though I'm pretty sure [MENTION=5154676]avinashrocks1990[/MENTION] confirmed it worked on his anzo. Perhaps he can try again and make sure for us? There's a descriptor when you look at it with "file" that says Win32 on the repack where the original says Unix, that's my only other guess at this point, especially if it isn't working on avi's anzo after all.

Sigh.. If there was a kernel on the GN that just left all the compressions enabled in the config this would be far easier.. I know gzip continues to work just fine, and personally tested xz with AK kernel. avi confirmed lzma and (I thought) lzo.
[Android Software Development] ouroboros12:
Anyone knows how to make cm10.1 4.2.2 kernel work with cm10 4.1.2? Tried the ramdisk of cm10 + cm10.1 kernel. It dint work. Why?
[Android Software Development] osm0sis:
Same reason 4.1.2 kernel doesn't work in 4.2.2, things change too much in the actual kernel for it to work.
[Android Software Development] ouroboros12:
on our device, cm10 kernel could be flashed to cm10.1 wth just zImage, kernel injector, and system/lib/modules.

I extracted a boot.img and saw ramdisk and file named kernel. Is this file the zImage?
[Android Software Development] osm0sis:
No look in /split_img, the zImage is the zImage. ;)