Last active
September 15, 2023 19:15
-
-
Save minlexx/77816ce567b9877de51ab2f9d00542c6 to your computer and use it in GitHub Desktop.
Script to create boot.img for xiaomi-lavender from inside kernel build tree, using initramfs file built by pmbootstrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
KERNEL=./arch/arm64/boot/Image.gz | |
KERNEL_DTB=${KERNEL}-dtb | |
DTB=./arch/arm64/boot/dts/qcom/sdm660-xiaomi-lavender.dtb | |
INITRD=initramfs-postmarketos-qcom-sdm660 | |
# Optional: | |
# Build kernel with: | |
# make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- O=build -j12 -C ../ | |
# You should have cross-compiler installed before that. | |
# CROSS_COMPILE may be "aarch64-unknown-linux-gnu-" or "aarch64-linux-gnu-" | |
# depending on your Linux distribution. | |
source ~/.local/var/pmbootstrap/cache_git/pmaports/device/device-xiaomi-lavender/deviceinfo | |
cp -i ~/.local/var/pmbootstrap/chroot_rootfs_xiaomi-lavender/boot/initramfs-postmarketos-qcom-sdm660 . | |
# append DTB to gzipped kernel image | |
cat ${KERNEL} ${DTB} > ${KERNEL_DTB} | |
mkbootimg \ | |
--kernel "${KERNEL_DTB}" \ | |
--ramdisk "${INITRD}" \ | |
--base "${deviceinfo_flash_offset_base}" \ | |
--second_offset "${deviceinfo_flash_offset_second}" \ | |
--cmdline "${deviceinfo_kernel_cmdline_mainline}" \ | |
--kernel_offset "${deviceinfo_flash_offset_kernel}" \ | |
--ramdisk_offset "${deviceinfo_flash_offset_ramdisk}" \ | |
--tags_offset "${deviceinfo_flash_offset_tags}" \ | |
--pagesize "${deviceinfo_flash_pagesize}" \ | |
-o boot-xiaomi-lavender-mainline.img |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment