AnyKernel 2.0: shell update-binary, new features

- rewrite update-script as a shell script update-binary replacement, making the zip architecture independent (tools are still dependent)
- add fall-back to included zImage to allow for ramdisk-only injections
This commit is contained in:
osm0sis committed 2015-01-07 15:23:10 -04:00
1 parent bcfd2e0ff2
commit 611804253b
4 files changed
+10 -50

No files matched your search

Binary file not shown.
+1 -47
View File
@@ -1,47 +1 @@
show_progress(1.34, 4); # Dummy file; update-binary is a shell script.
ui_print(" ");
assert(package_extract_dir("", "/tmp/anykernel"));
ui_print(file_getprop("/tmp/anykernel/anykernel.sh", "kernel.string"));
ui_print(" ");
ui_print("AnyKernel2 by osm0sis @ xda-developers");
ui_print(" ");
run_program("/sbin/busybox", "mount", "/system");
ifelse(file_getprop("/tmp/anykernel/anykernel.sh", "do.devicecheck") == 1,
(ui_print("Checking device...");
ui_print(" ");
assert(getprop("ro.product.device") == file_getprop("/tmp/anykernel/anykernel.sh", "device.name1") || getprop("ro.build.product") == file_getprop("/tmp/anykernel/anykernel.sh", "device.name1") ||
getprop("ro.product.device") == file_getprop("/tmp/anykernel/anykernel.sh", "device.name2") || getprop("ro.build.product") == file_getprop("/tmp/anykernel/anykernel.sh", "device.name2") ||
getprop("ro.product.device") == file_getprop("/tmp/anykernel/anykernel.sh", "device.name3") || getprop("ro.build.product") == file_getprop("/tmp/anykernel/anykernel.sh", "device.name3") ||
getprop("ro.product.device") == file_getprop("/tmp/anykernel/anykernel.sh", "device.name4") || getprop("ro.build.product") == file_getprop("/tmp/anykernel/anykernel.sh", "device.name4") ||
getprop("ro.product.device") == file_getprop("/tmp/anykernel/anykernel.sh", "device.name5") || getprop("ro.build.product") == file_getprop("/tmp/anykernel/anykernel.sh", "device.name5"));
)
);
ifelse(file_getprop("/tmp/anykernel/anykernel.sh", "do.initd") == 1,
(ui_print("Creating init.d...");
ui_print(" ");
run_program("/sbin/sh", "-c", "mkdir /system/etc/init.d");
set_perm_recursive(0, 0, 0755, 0755, "/system/etc/init.d");
)
);
ui_print("Installing kernel...");
run_program("/sbin/sh", "/tmp/anykernel/anykernel.sh");
ifelse(run_program("/sbin/sh", "-c", "test `cat /tmp/anykernel/exitcode` == 1") == 0,
(unmount("/system");
abort();
)
);
ifelse(file_getprop("/tmp/anykernel/anykernel.sh", "do.modules") == 1,
(ui_print("Pushing modules...");
ui_print(" ");
assert(package_extract_dir("modules", "/system/lib/modules"),
set_perm_recursive(0, 0, 0755, 0644, "/system/lib/modules"));
)
);
ifelse(file_getprop("/tmp/anykernel/anykernel.sh", "do.cleanup") == 1,
(delete_recursive("/tmp/anykernel");
)
);
unmount("/system");
ui_print(" ");
ui_print("Done!");
+2 -2
View File
@@ -3,7 +3,7 @@ by osm0sis @ xda-developers
"AnyKernel is a template for an update.zip that can apply any kernel to any ROM, regardless of ramdisk." - Koush "AnyKernel is a template for an update.zip that can apply any kernel to any ROM, regardless of ramdisk." - Koush
AnyKernel 2.0 pushes the format even further by allowing kernel developers to modify the underlying ramdisk for kernel feature support easily using a number of included command methods along with properties and variables. AnyKernel2 pushes the format even further by allowing kernel developers to modify the underlying ramdisk for kernel feature support easily using a number of included command methods along with properties and variables.
A working script based on DirtyV Kernel for Galaxy Nexus (tuna) is included for reference. A working script based on DirtyV Kernel for Galaxy Nexus (tuna) is included for reference.
@@ -50,7 +50,7 @@ You may also use ui_print "<text>" to write messages back to the recovery during
// Instructions // Instructions
1- Place zImage in the root (dtb should also go here for devices that require a custom one) 1- Place zImage in the root (dtb should also go here for devices that require a custom one, both will fallback to the original if not included)
2- Place any required ramdisk files in /ramdisk 2- Place any required ramdisk files in /ramdisk
3- Place any required patch files (generally partial files which go with commands) in /patch 3- Place any required patch files (generally partial files which go with commands) in /patch
4- Modify the anykernel.sh to add your kernel's name, boot partition location, permissions for included ramdisk files, and use methods for any required ramdisk modifications 4- Modify the anykernel.sh to add your kernel's name, boot partition location, permissions for included ramdisk files, and use methods for any required ramdisk modifications
+7 -1
View File
@@ -61,6 +61,12 @@ write_boot() {
secondoff=`cat *-secondoff`; secondoff=`cat *-secondoff`;
secondoff="--second_offset $secondoff"; secondoff="--second_offset $secondoff";
fi; fi;
if [ -f /tmp/anykernel/zImage ]; then
kernel=/tmp/anykernel/zImage;
else
kernel=`ls *-zImage`;
kernel=$split_img/$kernel;
fi;
if [ -f /tmp/anykernel/dtb ]; then if [ -f /tmp/anykernel/dtb ]; then
dtb="--dt /tmp/anykernel/dtb"; dtb="--dt /tmp/anykernel/dtb";
elif [ -f *-dtb ]; then elif [ -f *-dtb ]; then
@@ -69,7 +75,7 @@ write_boot() {
fi; fi;
cd $ramdisk; cd $ramdisk;
find . | cpio -H newc -o | gzip > /tmp/anykernel/ramdisk-new.cpio.gz; find . | cpio -H newc -o | gzip > /tmp/anykernel/ramdisk-new.cpio.gz;
$bin/mkbootimg --kernel /tmp/anykernel/zImage --ramdisk /tmp/anykernel/ramdisk-new.cpio.gz $second --cmdline "$cmdline" --board "$board" --base $base --pagesize $pagesize --kernel_offset $kerneloff --ramdisk_offset $ramdiskoff $secondoff --tags_offset $tagsoff $dtb --output /tmp/anykernel/boot-new.img; $bin/mkbootimg --kernel $kernel --ramdisk /tmp/anykernel/ramdisk-new.cpio.gz $second --cmdline "$cmdline" --board "$board" --base $base --pagesize $pagesize --kernel_offset $kerneloff --ramdisk_offset $ramdiskoff $secondoff --tags_offset $tagsoff $dtb --output /tmp/anykernel/boot-new.img;
if [ $? != 0 -o `wc -c < /tmp/anykernel/boot-new.img` -gt `wc -c < /tmp/anykernel/boot.img` ]; then if [ $? != 0 -o `wc -c < /tmp/anykernel/boot-new.img` -gt `wc -c < /tmp/anykernel/boot.img` ]; then
ui_print " "; ui_print "Repacking image failed. Aborting..."; ui_print " "; ui_print "Repacking image failed. Aborting...";
echo 1 > /tmp/anykernel/exitcode; exit; echo 1 > /tmp/anykernel/exitcode; exit;