cfig / Android_boot_image_editor

Parsing and re-packing Android boot.img/vbmeta.img/payload.bin, supporting Android 15
Apache License 2.0
1.04k stars 232 forks source link

cmdline customization #121

Closed ybtag closed 5 months ago

ybtag commented 1 year ago

Any way to customize the kernel command line? It just copies the command line of the unmodified image.

cfig commented 1 year ago

1. If your kernel cmdline is in boot.img, you can unpack boot.img and modify build/unzip_boot/boot.json,

{
  "info" : {
    "output" : "boot.img",
    "json" : "boot.json",
    "headerVersion" : 4,
    "headerSize" : 1584,
    "pageSize" : 4096,
    "cmdline" : "xx=yy",
    "osVersion" : "12.0.0",
    "osPatchLevel" : "2021-10-00",
    "imageSize" : 33554432,
    "signatureSize" : 4096
  },

2. If your kernel cmdline is in vendor_boot.img, please unpack vendor_boot.img and modify like this:

build/unzip_boot/vendor_boot.json

{
  "info" : {
    "output" : "vendor_boot.img",
    "json" : "vendor_boot.json",
    "headerVersion" : 4,
    "product" : "",
    "headerSize" : 2128,
    "pageSize" : 2048,
    "cmdline" : "earlycon=exynos4210,0x10A00000 console=ttySAC0,115200 androidboot.console=ttySAC0 printk.devkmsg=on at24.write_timeout=100 buildvariant=userdebug log_buf_len=1024K bootconfig",
    "tagsLoadAddr" : 268435712,
    "kernelLoadAddr" : 268468224,
    "imageSize" : 28518400
  },
cfig commented 1 year ago

If it doesn't work for you, please describe your detailed steps and upload the images. Another possibility is that some customized bootloader may ignore the kernel commandline part of some images.

ybtag commented 1 year ago

Thanks. I guess my bootloader is one of those 😦.

cfig commented 1 year ago

If you can get the "/proc/cmdline" of the running system, that would be good enough to go on. Normally bootloader will combine internal cmdline and the values from some Android images, like boot.img, vendor_boot.img, vendor_kernel_boot.img or init_boot.img, you can try to identify which images the final cmdline come from, then you can modify that image, and you can customize it .....

cfig commented 1 year ago

If you can get the "/proc/cmdline" of the running system, that would be good enough to go on. Normally bootloader will combine internal cmdline and the values from some Android images, like boot.img, vendor_boot.img, vendor_kernel_boot.img or init_boot.img, you can try to identify which images the final cmdline come from, then you can modify that image, and you can customize it .....

Rofikkernel commented 1 year ago

@Saikatsaha1996 what device you want to port to mainline

Saikatsaha1996 commented 1 year ago

@Saikatsaha1996 what device you want to port to mainline

Already successfully added framebuffer .. have issues with secure pincontrol vendor_boot no more required.. only empty dtbo is enough..