如果用户想要修改内核命令行,我该怎么做?我可以使用“cat /proc/cmdline”来查看 bootargs 吗?
答案1
/proc/cmdline 将为您提供当前的启动参数,但也会显示大量技术上不可修改的数据。
我建议使用: sudo abootimg -i /dev/mmcblk0p2
这应该会给你类似的输出:
ubuntu@nexus7-265143b8:~$ sudo abootimg -i /dev/mmcblk0p2
Android Boot Image Info:
* file name = /dev/mmcblk0p2 [block device]
* image size = 8388608 bytes (8.00 MB)
page size = 2048 bytes
* Boot Name = ""
* kernel size = 4522232 bytes (4.31 MB)
ramdisk size = 2182999 bytes (2.08 MB)
* load addresses:
kernel: 0x10008000
ramdisk: 0x11000000
tags: 0x10000100
* cmdline = root=/dev/mmcblk0p9 ro console=tty1 fbcon=rotate:1 quiet
* id = 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
要修改命令行参数,请发出以下命令:
sudo abootimg -u /dev/mmcblk0p2 -c cmdline ='foo bar baz'