1. 程式人生 > >全志A64 修改uboot環境變數及核心除錯級別

全志A64 修改uboot環境變數及核心除錯級別

通過uboot輸出的啟動資訊:

--------fastboot partitions--------
-total partitions:15-
-name-        -start-       -size-      
bootloader  : 1000000       2000000     
env         : 3000000       1000000     
boot        : 4000000       2000000     
system      : 6000000       80000000    
verity_block: 86000000      2000000     
misc        : 88000000      1000000     
recovery    : 89000000      2000000     
cache       : 8b000000      30000000    
metadata    : bb000000      1000000     
private     : bc000000      1000000     
frp         : bd000000      80000       
empty       : bd080000      f80000      
alog        : be000000      5000000     
media_data  : c3000000      1000000     
UDISK       : c4000000      0  

板上的emmc分成14個分割槽,其中環境變數單獨存放在一個分割槽,所以修改uboot環境變數時無須重編譯uboot原始碼.

環境變數存放的檔案在: /lichee/tools/pack/chips/sun50iw1p1/configs/default/env.cfg
裡面的內容:


#kernel command arguments
earlyprintk=sunxi-uart,0x01c28000
initcall_debug=0
console=ttyS0,115200
nand_root=/dev/system
mmc_root=/dev/mmcblk0p7
init=/init
loglevel=1
cma=256M
selinux=enforcing
#set kernel cmdline if boot.img or recovery.img has no cmdline we will use this
setargs_nand=setenv bootargs earlyprintk=${earlyprintk} initcall_debug=${initcall_debug} console=${console} loglevel=${loglevel} root=${nand_root} init=${init} partitions=${partitions} cma=${cma} androidboot.selinux=${selinux} setargs_mmc=setenv bootargs earlyprintk=${earlyprintk} initcall_debug=${initcall_debug}
console=${console} loglevel=${loglevel} root=${mmc_root} init=${init} partitions=${partitions} cma=${cma} androidboot.selinux=${selinux} #nand command syntax: sunxi_flash read address partition_name read_bytes #0x4007f800 = 0x40080000(kernel entry) - 0x800(boot.img header 2k) boot_normal=sunxi_flash read 4507f800 boot;boota 4507f800 boot boot_recovery=sunxi_flash read 4507f800 recovery;boota 4507f800 recovery boot_fastboot=fastboot #recovery key recovery_key_value_max=0x13 recovery_key_value_min=0x10 #fastboot key fastboot_key_value_max=0x8 fastboot_key_value_min=0x2 #uboot system env config bootdelay=0 #default bootcmd, will change at runtime according to key press bootcmd=run setargs_nand boot_normal#default nand boot

從上面的內容可以看出,uboot啟動後直接執行”run setargs_nand boot_normal”.

環境變數partitions=bootloader@mmcblk0p2:env@mmcblk0p5:boot@mmcblk0p6:system@mmcblk0p7:verity_block@mmcblk0p8:misc@mmcblk0p9:recovery@mmcblk0p10:cache@mmcblk0p11:metadata@mmcblk0p12:private@mmcblk0p13:frp@mmcblk0p14:empty@mmcblk0p15:alog@mmcblk0p16:media_data@mmcblk0p17:UDISK@mmcblk0p1
setenv bootargs earlyprintk=sunxi-uart,0x01c28000 initcall_debug=0 console=ttyS0,115200 loglevel=1 root=/dev/system init=/init partitions=...

其中loglevel為printk除錯輸出級別,如需要捕捉核心除錯輸出,則需要修改loglevel的值.

如需要在uboot上操作,則需要把環境變數bootdelay的值改為非0即可.

 9 loglevel=8
 ...
 28 bootdelay=6

修改完成後,進入android原始碼目錄下操作:

    . ./build/envsetup.sh 

      lunch
        //選擇22. tulip_p1-eng

      pack   //重新打包映象

重新燒寫新映象lichee/tools/pack/sun50iw1p1_android6.0_p1_uart0_bv3.img即修改生效.