[Nexus 7 Original Development] frantisek.nesveda:
Agnostic-kernel - filesystem independent kernel flasher

WARNING!

Please, make a backup or be prepared to roll back to a working state somehow. You are using this tool on your own responsibility. You have been warned!

If anything goes wrong, flashing another kernel that was working for you before should return your device to a working state.

Repository on GitHub

This is a recovery tool primarily made for kernel/ROM developers, but anyone is welcome to use it, provided he knows what to do. It was made to enable kernel developers to have a single .zip with the kernel which will work on all partition layouts like All-F2FS, Data-F2FS and All-EXT4 (the standard layout).

It takes a boot.img, unpacks it during the installation, finds out what partition layout is used on the device, changes the fstab in the ramdisk accordingly, repacks the boot.img and flashes it.

Instructions for kernel/ROM developers/flashaholics who wish to incorporate this tool:

Make sure your kernel is compiled with F2FS drivers.

Download agnostic-kernel-template.zip

Replace the boot.img-placeholder in the .zip with your boot.img.

OPTIONAL: change the fstab in fstab/ folder to specify any mount options you wish to use. Make sure you include a line for each partition and filesystem combination you want to use.

OPTIONAL: change the updater-script to print any additional messages or make modifications to the kernel after flashing.

Instructions for users who wish to try this tool:

Choose one of the prepacked kernels you wish to install and download it.

Install it via recovery.

Instructions for people who wish to port it to other devices:

Change the asserts in updater-script to check for your device name.

Change the fstab in the fstab/ folder. Make sure you include a line for each partition and filesystem combination you want to use.

Change the FSTAB variable in tools/repack-and-flash.sh to contain the name of your fstab file.

Change the BOOT_PARTITION variable to contain the path to your /boot partition device.

Currently supported partition layouts:

/system on EXT4 or F2FS

/cache on EXT4 or F2FS

/data on EXT4 or F2FS

Filesystem changes are supported only on these partitions because the Nexus 7 doesn't have any other EXT4 partitions by default.

If you want to add support for some other device specific layout (F2FS formatted SD card comes to mind, for example), feel free to do so or contact me, but it may require some changes to your recovery too.

Tested on:

Kernels

3.2.5-XPerience by [MENTION=4403780]TeamMex[/MENTION]

LegoKernel / SlimKernel by [MENTION=2743057]legolas93[/MENTION]

franco.Kernel by [MENTION=3292224]franciscofranco[/MENTION] and modified by [MENTION=4693882]HTCDreamOn[/MENTION]

linux-tegra-nv-3.1-grouper by [MENTION=4693882]HTCDreamOn[/MENTION]

M-Kernel by [MENTION=2687601]Metallice[/MENTION]

Recoveries

CWM Recovery 6.0.4.3 by ClockworkMod

TWRP by [MENTION=2743057]legolas93[/MENTION][/MENTION]

MultiROM recovery by [MENTION=3418703]@Tasssadar[/MENTION]

ROMs

ROM shouldn't matter, I tested on various 4.4 / 5.0 ROMs and even without a ROM and it always worked.

Downloads

Pre-packed kernels:

Kernel from SlimROM by [MENTION=2743057]legolas93[/MENTION]

3.2.5-XPerience-19 by [MENTION=4403780]TeamMex[/MENTION]

Empty template for devs:

agnostic-kernel-template.zip​

You can download other kernels using agnostic-kernel in their respective threads.

Credits:

Android Image Kitchen - [MENTION=4544860]osm0sis[/MENTION] - this wouldn't be possible without him

F2FS Recovery - [MENTION=2743057]legolas93[/MENTION]

Kernels on which I tested - [MENTION=4403780]TeamMex[/MENTION] & [MENTION=2743057]legolas93[/MENTION] & [MENTION=3292224]franciscofranco[/MENTION] & [MENTION=4693882]HTCDreamOn[/MENTION] & [MENTION=2687601]Metallice[/MENTION]

Recovery magic - [MENTION=631273]Chainfire[/MENTION] & [MENTION=4878287]_that[/MENTION]

Answers to a lot of my problems - xdaforums.com community

Some nice ideas - [MENTION=2687601]Metallice[/MENTION]

Partition layout checking, scripting - [MENTION=4431376]frantisek.nesveda[/MENTION]

If you wish to incorporate or modify this tool, please, mention me somewhere, thanks :)