Skip to content

Instantly share code, notes, and snippets.

Last active November 17, 2022 07:45
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
#!/usr/bin/env bash
# Variable for path to mobile-nix boot.img
# Variable for path to lineage boot.img (recovery)
# Variables for directory names to place extracted contents
## Clean up
rm -f "${lineage_out_dir}"/*
rm -f "${mobile_nix_out_dir}"/*
rm new-boot.img
## Create directories for extracted contents to go
mkdir -p "${lineage_out_dir}"
mkdir -p "${mobile_nix_out_dir}"
## Unpack boot.img
unpackbootimg -i "${lineage_boot_img_path}" -o "${lineage_out_dir}"
unpackbootimg -i "${mobile_nix_boot_img_path}" -o "${mobile_nix_out_dir}"
# Sort of working, gets out of fastboot
mkbootimg \
--ramdisk "${mobile_nix_out_dir}"/mobile-nix-boot.img-ramdisk.gz \
--cmdline "$(cat "${mobile_nix_out_dir}"/mobile-nix-boot.img-cmdline)" \
--base "$(cat "${mobile_nix_out_dir}"/mobile-nix-boot.img-base)" \
--pagesize "$(cat "${mobile_nix_out_dir}"/mobile-nix-boot.img-pagesize)" \
--ramdisk_offset "$(cat "${mobile_nix_out_dir}"/mobile-nix-boot.img-ramdisk_offset)" \
--tags_offset "$(cat "${mobile_nix_out_dir}"/mobile-nix-boot.img-tags_offset)" \
--dtb "${lineage_out_dir}"/lineage-boot.img-dtb \
--dtb_offset "$(cat "${lineage_out_dir}"/lineage-boot.img-dtb_offset)" \
--header_version "$(cat "${lineage_out_dir}"/lineage-boot.img-header_version)" \
--kernel "${lineage_out_dir}"/lineage-boot.img-zImage \
--output new-boot.img
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment