十二、移植優化---CONFIG 優化進 menuconfig(1)


  在移植 JZ2440 中,include/configs/jz2440.h 中有很多config 項都是已經在 uboot 的主配置中已經存在了的,這些配置造成了重復,需要優化。

  先將原先的 smdk2410.h 拷貝進來:cp include/configs/smdk2410.h ../../uboot/include/configs/jz2440.h

  並把其中的2410 字樣全部改為2440

  執行編譯

12.1 加入S3C24X0 架構

   修改:

  

  

這里修改之后,可以將 include/configs/jz2440.h 中的幾個宏刪掉:

  • CONFIG_S3C24X0
  • CONFIG_S3C2440
  • CONFIG_JZ2440

12.2 根據報錯修改 u-boot 

12.2.1 include/configs/jz2440.h:78:10: fatal error: config_cmd_default.h: No such file or directory

  此文件找不到,config_cmd_default.h 中定義了一系列的命令行命令,查找以下里面的命令是否已經在,若存在,則打開響應的宏,然后刪除 config_cmd_default.h 頭文件包含

 1 #ifndef _CONFIG_CMD_DEFAULT_H
 2 #define _CONFIG_CMD_DEFAULT_H
 3 
 4 /*
 5  * Alphabetical list of all commands that are configured by default.
 6  * This is essentially all commands minus those that are considered
 7  * "non-standard" for some reason (memory hogs, requires special
 8  * hardware, not fully tested, etc.).
 9  */
10 
11 #define CONFIG_CMD_BDI        /* bdinfo            */
12 #define CONFIG_CMD_BOOTD    /* bootd            */
13 #define CONFIG_CMD_CONSOLE    /* coninfo            */
14 #define CONFIG_CMD_ECHO        /* echo arguments        */
15 #define CONFIG_CMD_EDITENV    /* editenv            */
16 #define CONFIG_CMD_FPGA        /* FPGA configuration Support    */
17 #define CONFIG_CMD_IMI        /* iminfo            */
18 #define CONFIG_CMD_ITEST    /* Integer (and string) test    */
19 #ifndef CONFIG_SYS_NO_FLASH
20 #define CONFIG_CMD_FLASH    /* flinfo, erase, protect    */
21 #define CONFIG_CMD_IMLS        /* List all found images    */
22 #endif
23 #define CONFIG_CMD_LOADB    /* loadb            */
24 #define CONFIG_CMD_LOADS    /* loads            */
25 #define CONFIG_CMD_MEMORY    /* md mm nm mw cp cmp crc base loop */
26 #define CONFIG_CMD_MISC        /* Misc functions like sleep etc*/
27 #define CONFIG_CMD_NET        /* bootp, tftpboot, rarpboot    */
28 #define CONFIG_CMD_NFS        /* NFS support            */
29 #define CONFIG_CMD_RUN        /* run command in env variable    */
30 #define CONFIG_CMD_SAVEENV    /* saveenv            */
31 #define CONFIG_CMD_SETGETDCR    /* DCR support on 4xx        */
32 #define CONFIG_CMD_SOURCE    /* "source" command support    */
33 #define CONFIG_CMD_XIMG        /* Load part of Multi Image    */
34 
35 #endif    /* _CONFIG_CMD_DEFAULT_H */

  最后發現有兩個宏找不到:

  CONFIG_SYS_NO_FLASH:這個宏是用來控制是否使用 flash的 CONFIG_CMD_FLASH 和  CONFIG_CMD_IMLS 命令的,這兩個命令我們可以單獨開,不需要移植進來   

  CONFIG_CMD_SETGETDCR:主要是為了支持 DCR 寄存器。先看看 2015.01 中關於這個宏的定義:

  

  依賴文件為 cmd_dcr.c,我們可以添加進來,保證這條命令可以執行。但是先看看這個宏我們是否要開啟

  2015.01 common/Makefile 中

  

  可以看見依賴於 CONFIG_4xx

  

  CONFIG_4xx 在 Powerpc 架構中才使用,我們不需要,不移植

  當前config_cmd_default.h 移植完畢,在 include/configs/jz2440.h 中刪掉此頭文件。

12.2.2 CONFIG_NAND_S3C2440

  include/configs/jz2440.h:173:0: warning: "CONFIG_NAND_S3C2440" redefined

  此宏在前面已經添加,直接刪除掉

12.2.3 CONFIG_LZMA

  include/configs/jz2440.h:127:0: warning: "CONFIG_LZMA" redefined

  CONFIG_LZMA:LZMA 是一種壓縮算法,使能能它,必須使能 CONFIG_CMD_LZMADEC,在menuconfig 命令行下。若不項使能壓縮命令,只使能算法,可以將CONFIG_CMD_LZMADEC 關掉

  這個在 uboot 中已經默認開啟,刪除掉 jz2440.h  的相關定義。

12.2.4 CONFIG_DISPLAY_CPUINFO

  include/configs/jz2440.h:117:0: warning: "CONFIG_DISPLAY_CPUINFO" redefined

  前面移植已經做過操作,直接刪除文件中的 CONFIG_DISPLAY_CPUINFO 即可。

12.2.5 CONFIG_SYS_PROMPT

  include/configs/jz2440.h:109:0: warning: "CONFIG_SYS_PROMPT" redefined

  前面移植已經做過操作,直接刪除文件中的 CONFIG_SYS_PROMPT 即可。  

12.2.6 CONFIG_SYS_LONGHELP

  include/configs/jz2440.h:108:0: warning: "CONFIG_SYS_LONGHELP" redefined

  CONFIG_SYS_LONGHELP:顯示長的命令幫助信息

  menuconfig 中可以直接開啟,刪除掉 jz2440.h 中的定義

12.2.7 CONFIG_CMDLINE_EDITING

  如果有 include/configs/jz2440.h:89:0: warning: "CONFIG_CMDLINE_EDITING" redefined

  CONFIG_CMDLINE_EDITING:為交互式命令行輸入操作啟用編輯和歷史功能,即為我們的 uboot 串口shell 啟動交互,已經選中,可以關閉jz2440.h 中的定義,或是在 menuconfig 有這個配置項可取消

12.2.8 CONFIG_RTC_S3C24X0

  這個需要添加進 menuconfig 中,添加方式如下

  搜索其他版本可以看到如下打印信息:

  

  查看當前版本 可知道有 s3c24x0_rtc.c 文件,但 menuconfig 中無法設置,移植到menuconfig 中

  driver/rtc/Kconfig 中修改:

  

  刪除掉jz2440.h 中的定義

  

12.2.9 CONFIG_CMD_NAND

  include/configs/jz2440.h:77:0: warning: "CONFIG_CMD_NAND" redefined

  先關閉 nand 命令,在 menuconfig 中已經有定義,刪除掉 jz2440.h 中的定義

12.2.10 CONFIG_CMD_ELF

  include/configs/jz2440.h:76:0: warning: "CONFIG_CMD_ELF" redefined

  CONFIG_CMD_ELF:從內存中啟動一個 EFI 鏡像

  我們不需要此項設置,在 menuconfig 中關閉,並刪除掉 jz2440.h 中的重復定義

12.2.11 CONFIG_S3C24X0_SERIAL

  需要先移植進串口驅動,直接拷貝2015中的串口驅動使用:

  cp ./drivers/serial/serial_s3c24x0.c ../uboot/drivers/serial/serial_s3c24x0.c

  修改 drivers/serial/Makefile:

  

  添加 此項定義進 menuconfig 中

  修改下面的 Kconfig 文件:

  

  刪除掉jz2440.h 中的定義。

12.2.12 cmd/reginfo.c:10:10: fatal error: asm/ppc.h: No such file or directory

  ppc 架構我們不需要,但是reginfo.c 這個文件我們調用了,可以在將其隔離。

  定義了 CONFIG_CMD_REGINFO 才會編譯此文件。

  

  CONFIG_CMD_REGINFO:寄存器 dump,但是只支持 PPC 架構,刪除掉。

12.2.13 cmd/ubi.c: In function ‘display_ubi_info’

  沒打算在 uboot 支持 ubi 文件系統,去掉兩個 UBI 宏

  

  注意也在 menuconfig 中關閉,若是有重復定義的話

12.2.14 cmd/built-in.o: In function `do_fat_fsinfo'

  與 ubi 一樣,是  fat 文件系統的支持,此文件系統可以在 menuconfig 中直接配置,刪除掉。

  

12.2.15 fdt 的錯誤

(1)common/built-in.o: In function `bootm_find_images':

  common/bootm.c:247: undefined reference to `set_working_fdt_addr'

(2)common/built-in.o: In function `boot_relocate_fdt':

  common/image-fdt.c:194: undefined reference to `set_working_fdt_addr'

(3)common/built-in.o: In function `cmd_process':

  common/command.c:544: undefined reference to `do_bootd'

  do_bootd 代碼走向依賴於宏CONFIG_CMD_BOOTD,此宏在 jz2440.h 中未定義,關閉掉

(4)lib/built-in.o: In function `efi_exit_boot_services':

  lib/efi_loader/efi_boottime.c:1748: undefined reference to `board_quiesce_devices'

  lib/efi_loader/efi_boottime.c:1754: undefined reference to `bootm_disable_interrupts'

  關掉宏:

  • CONFIG_OF_LIBFDT:是嗯那個 FDT 庫,S3C2440 並沒有支持 設備樹,這個宏會關閉 EFI  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM