Giter Site home page Giter Site logo

kramflash's Introduction

kramflash

kramflash is a simple bootable ramdisk that flashes a custom kernel on devices with boot image v2 or newer. It is not capable of flashing real GKIs because it doesn't manipulate any ramdisks for compatibility reasons, but it works with the GKI boot scheme and partition layout.

Requirements

The flasher script, flash.sh, must be installed as the init script in an Alpine Linux ramdisk with the following changes made:

  • sgdisk package installed
  • magiskboot tool from Magisk placed in PATH
  • reboot_with_cmd tool (source code available in this repo) placed in PATH

For the flasher to show output rather than appearing to freeze and crash at the bootloader splash, the kernel console needs to be configured to display output to the user. The easiest way to do this is to enable and use the default fbcon console and make it render to simplefb, backed by the continuous splash framebuffer that the bootloader sets up before starting Linux.

If a console is present, adding loglevel=2 to the kernel command-line is recommended to reduce spammy output and speed up boot significantly.

Payload

The kernel payload should be placed in the /payload directory of the ramdisk, consisting of:

  • Image.lz4: LZ4-compressed kernel image without appended DTBs
  • dtb: Concatenated DTBs for supported devices
  • banner: Optional banner to show to the user when flashing

DTBO flashing is not currently supported.

Kernel changes

The flashed kernel payload should not be changed in any way. However, the flasher itself uses a kernel because it is essentially a custom bootable recovery. No changes to the kernel are strictly necessary, but they improve the user experience significantly:

  • For easier debugging on newer kernels (4.14+): add printk.devkmsg=on to cmdline (example)
  • Minimize kernel size in order to reduce the total flasher size: example
  • Framebuffer console for live feedback, otherwise it just looks like the flasher crashed even if it succeeded: example framebuffer and console

If using a console:

  • Silence kernel logs: add quiet to cmdline (example) and set loglevel (example)
  • Larger font for legibility: Terminus 16x32 (example)

See the changes made to the Pixel 5 kernel for more information.

kramflash's People

Contributors

kdrag0n avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

kimocoder gmh5225

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.