Android_boot_image_editor icon indicating copy to clipboard operation
Android_boot_image_editor copied to clipboard

cmdline customization

Open ybtag opened this issue 2 years ago • 7 comments

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

ybtag avatar May 29 '23 18:05 ybtag

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 avatar May 30 '23 05:05 cfig

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.

cfig avatar May 30 '23 05:05 cfig

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

ybtag avatar May 30 '23 19:05 ybtag

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 avatar May 31 '23 15:05 cfig

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 avatar May 31 '23 15:05 cfig

@Saikatsaha1996 what device you want to port to mainline

rofikkerneldev avatar Aug 09 '23 03:08 rofikkerneldev

@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..

Saikatsaha1996 avatar Aug 09 '23 03:08 Saikatsaha1996