[Galaxy S 4 i9505 Original Android Development] chenxiaolong:
UPDATE: New beta 13 release to fix the broken beta 12 ;) For those who want to know what went wrong in the previous beta, click this button:

Fix: https://github.com/chenxiaolong/DualBootPatcher/commit/3532fb6030ba33215ea912a05ba162f012f21ace

The issue was that my minicpio implementation stored cpio entries in reverse order compared to the original ramdisk and new files were appended to the end. Normally, that wouldn't matter because the newly generated cpio file still conforms to the standards. What doesn't conform to the standard is the Android kernel. When it goes through the cpio entries (files), it expects to find the directories before files that are contained within them.

So, lets say the files in the original, unpatched ramdisk were stored in this order:

charger
data
default.prop
dev
file_contexts
fstab.hammerhead
init
init.cm.rc
init.environ.rc
init.hammerhead.rc
init.hammerhead.usb.rc
init.multiboot.mounting.sh
init.rc
init.superuser.rc
init.trace.rc
init.usb.rc
proc
property_contexts
res
res/images
res/images/charger
res/images/charger/battery_0.png
res/images/charger/battery_1.png
res/images/charger/battery_2.png
res/images/charger/battery_3.png
res/images/charger/battery_4.png
res/images/charger/battery_5.png
res/images/charger/battery_charge.png
res/images/charger/battery_fail.png
sbin
sbin/adbd
sbin/busybox-static
sbin/healthd
sbin/ueventd
sbin/watchdogd
seapp_contexts
sepolicy
sys
system
ueventd.hammerhead.rc
ueventd.rc

The cpio entries in the patched ramdisk could potentially be stored like this:

sbin/healthd
sbin/adbd
sbin
res/images/charger/battery_fail.png
res/images/charger/battery_charge.png
res/images/charger/battery_5.png
res/images/charger/battery_4.png
res/images/charger/battery_3.png
res/images/charger/battery_2.png
res/images/charger/battery_1.png
res/images/charger/battery_0.png
res/images/charger
res/images
res
property_contexts
proc
init.usb.rc
init.trace.rc
init.superuser.rc
init.rc
init.hammerhead.usb.rc
init.hammerhead.rc
init.environ.rc
init.cm.rc
init
fstab.hammerhead
file_contexts
dev
default.prop
data
charger
sbin/busybox-static
init.multiboot.mounting.sh
ueventd.rc
ueventd.hammerhead.rc
system
sys
sepolicy
seapp_contexts
sbin/watchdogd
sbin/ueventd

Notice how the directories res/ and sbin/ come after the files inside them. This is perfectly valid with any cpio tool, but apparently the kernel doesn't like it.

The fix is to assign proper unique inodes to the cpio entries first and then sort the entries by name before writing them to the output file. At least the kernel doesn't expect the inodes to be in order lol ;)

--------

New beta release :) (Yes, I know I said the previous beta was going to be the last one...)

This beta uses my cpio implementation for dealing with the ramdisk. This allows me to remove a few more binaries for Windows, but more importantly, I can now deal with Linux file permissions on Windows without jumping through hoops. With this change, the Google Edition ROMs that didn't boot when patched from Windows will now work correctly. Also, the codebases are now completely unified for all OS's, meaning that you will no longer have issues where a ROM can be patched from Android, but not on Windows for example.

Let me know if there are any issues with this beta. I did a lot of testing and I think it's ready for a final release.

Full changelog:

Fix issue where Python 2 on Android sometimes appends an 'L' to the end of an string returned from hex()

Use my 'minicpio' cpio implementation: https://github.com/chenxiaolong/DualBootPatcher/blob/master/scripts/multiboot/minicpio/minicpio.py

Fully written in Python, so cpio binaries are no longer needed

Handles permissions without issues on Windows

(finally enables jflte Google Edition ROMs to be patched in Windows)

Only supports the new-ASCII-format cpio archives without CRC

Patcher no longer extracts ramdisk files. Everything is done in RAM

Update sample patchinfo file with the autopatcher lines

Add support for BeanStalk

Add support for Mahdi

Add support for Phoenix

Add support for official AOKP Google Apps

Add support for Alucard kernel (AOSP & Google Edition)

Add support for Ausdim TouchWiz 4.3 kernels

CC:

[MENTION=1827300]visanciprian[/MENTION]

[MENTION=232429]animelover[/MENTION]

[MENTION=5599740]heltonlevi85[/MENTION]

[MENTION=4581110]jthrasher47[/MENTION]

[MENTION=5309830]XxmentxX[/MENTION]

[MENTION=4991991]gravedigger76[/MENTION]

[MENTION=4485012]rushi.1986[/MENTION]

[MENTION=2682152]enotar[/MENTION]