在前面的文章我们已经介绍了如何自己去实现一个BootLoader,今天我们来介绍u-boot的移植,u-boot是一种通用的BootLoader。
在中我们已经介绍了如何通过Source Insight打开u-boot源码,以及uboot的编译过程。这一节我们将对u-boot源码进行分析,并且将uboot移植到Mini2440开发板。
在移植之前,我们首先需要明确Mini2440开发板具有的硬件资源:
- CPU:S3C2440;
- NAND:K9F2G08U0C;
- 网卡:DM9000A;
- SDRAM:HY57V561620FTP;
从网站上下载得到u-boot源码包,例如:u-boot-2016.05.tar.bz2 (最新的u-boot版本已经不支持s3c2440)。
一、uboot编译
在之前的文章中我们介绍过smdk2410的编译过程,这里在啰嗦一遍,uboot的编译分为两步:配置、编译:
1.1 配置
配置选择所要使用的board ,我调试使用的是S3C2440,但是./configs目录下没有smdk2440_defconfig这个文件,只有smdk2410_defconfig,因此执行如下命令,生成.config文件:
make smdk2410_defconfig
.config文件定义如下:
# # Automatically generated file; DO NOT EDIT. # U-Boot 2016.05 Configuration # CONFIG_CREATE_ARCH_SYMLINK=y CONFIG_HAVE_GENERIC_BOARD=y CONFIG_SYS_GENERIC_BOARD=y # CONFIG_ARC is not set CONFIG_ARM=y # CONFIG_AVR32 is not set # CONFIG_BLACKFIN is not set # CONFIG_M68K is not set # CONFIG_MICROBLAZE is not set # CONFIG_MIPS is not set # CONFIG_NDS32 is not set # CONFIG_NIOS2 is not set # CONFIG_OPENRISC is not set # CONFIG_PPC is not set # CONFIG_SANDBOX is not set # CONFIG_SH is not set # CONFIG_SPARC is not set # CONFIG_X86 is not set CONFIG_SYS_ARCH="arm" CONFIG_SYS_CPU="arm920t" CONFIG_SYS_SOC="s3c24x0" CONFIG_SYS_VENDOR="samsung" CONFIG_SYS_BOARD="smdk2410" CONFIG_SYS_CONFIG_NAME="smdk2410" # # ARM architecture # CONFIG_CPU_ARM920T=y # CONFIG_SEMIHOSTING is not set # CONFIG_SYS_L2CACHE_OFF is not set # CONFIG_ARCH_AT91 is not set # CONFIG_TARGET_EDB93XX is not set # CONFIG_TARGET_VCMA9 is not set CONFIG_TARGET_SMDK2410=y # CONFIG_TARGET_ASPENITE is not set # CONFIG_TARGET_GPLUGD is not set # CONFIG_ARCH_DAVINCI is not set # CONFIG_KIRKWOOD is not set # CONFIG_ARCH_MVEBU is not set # CONFIG_TARGET_DEVKIT3250 is not set # CONFIG_TARGET_WORK_92105 is not set # CONFIG_TARGET_MX25PDK is not set # CONFIG_TARGET_ZMX25 is not set # CONFIG_TARGET_APF27 is not set # CONFIG_TARGET_APX4DEVKIT is not set # CONFIG_TARGET_XFI3 is not set # CONFIG_TARGET_M28EVK is not set # CONFIG_TARGET_MX23EVK is not set # CONFIG_TARGET_MX28EVK is not set # CONFIG_TARGET_MX23_OLINUXINO is not set # CONFIG_TARGET_BG0900 is not set # CONFIG_TARGET_SANSA_FUZE_PLUS is not set # CONFIG_TARGET_SC_SPS_1 is not set # CONFIG_ORION5X is not set # CONFIG_TARGET_SPEAR300 is not set # CONFIG_TARGET_SPEAR310 is not set # CONFIG_TARGET_SPEAR320 is not set # CONFIG_TARGET_SPEAR600 is not set # CONFIG_TARGET_STV0991 is not set # CONFIG_TARGET_X600 is not set # CONFIG_TARGET_IMX31_PHYCORE is not set # CONFIG_TARGET_MX31ADS is not set # CONFIG_TARGET_MX31PDK is not set # CONFIG_TARGET_WOODBURN is not set # CONFIG_TARGET_WOODBURN_SD is not set # CONFIG_TARGET_FLEA3 is not set # CONFIG_TARGET_MX35PDK is not set # CONFIG_ARCH_BCM283X is not set # CONFIG_TARGET_VEXPRESS_CA15_TC2 is not set # CONFIG_TARGET_VEXPRESS_CA5X2 is not set # CONFIG_TARGET_VEXPRESS_CA9X4 is not set # CONFIG_TARGET_KWB is not set # CONFIG_TARGET_TSERIES is not set # CONFIG_TARGET_CM_T335 is not set # CONFIG_TARGET_PEPPER is not set # CONFIG_TARGET_AM335X_IGEP0033 is not set # CONFIG_TARGET_PCM051 is not set # CONFIG_TARGET_DRACO is not set # CONFIG_TARGET_THUBAN is not set # CONFIG_TARGET_RASTABAN is not set # CONFIG_TARGET_PXM2 is not set # CONFIG_TARGET_RUT is not set # CONFIG_TARGET_PENGWYN is not set # CONFIG_TARGET_AM335X_BALTOS is not set # CONFIG_TARGET_AM335X_EVM is not set # CONFIG_TARGET_AM335X_SL50 is not set # CONFIG_TARGET_AM43XX_EVM is not set # CONFIG_TARGET_BAV335X is not set # CONFIG_TARGET_TI814X_EVM is not set # CONFIG_TARGET_TI816X_EVM is not set # CONFIG_TARGET_BCM28155_AP is not set # CONFIG_TARGET_BCMCYGNUS is not set # CONFIG_TARGET_BCMNSP is not set # CONFIG_ARCH_EXYNOS is not set # CONFIG_ARCH_S5PC1XX is not set # CONFIG_ARCH_HIGHBANK is not set # CONFIG_ARCH_INTEGRATOR is not set # CONFIG_ARCH_KEYSTONE is not set # CONFIG_ARCH_MX7 is not set # CONFIG_ARCH_MX6 is not set # CONFIG_ARCH_MX5 is not set # CONFIG_TARGET_M53EVK is not set # CONFIG_TARGET_MX51EVK is not set # CONFIG_TARGET_MX53ARD is not set # CONFIG_TARGET_MX53EVK is not set # CONFIG_TARGET_MX53LOCO is not set # CONFIG_TARGET_MX53SMD is not set # CONFIG_OMAP34XX is not set # CONFIG_OMAP44XX is not set # CONFIG_OMAP54XX is not set # CONFIG_RMOBILE is not set # CONFIG_ARCH_SNAPDRAGON is not set # CONFIG_ARCH_SOCFPGA is not set # CONFIG_TARGET_CM_T43 is not set # CONFIG_ARCH_SUNXI is not set # CONFIG_TARGET_TS4800 is not set # CONFIG_TARGET_VF610TWR is not set # CONFIG_TARGET_COLIBRI_VF is not set # CONFIG_TARGET_PCM052 is not set # CONFIG_ARCH_ZYNQ is not set # CONFIG_ARCH_ZYNQMP is not set # CONFIG_TEGRA is not set # CONFIG_TARGET_VEXPRESS64_AEMV8A is not set # CONFIG_TARGET_VEXPRESS64_BASE_FVP is not set # CONFIG_TARGET_VEXPRESS64_BASE_FVP_DRAM is not set # CONFIG_TARGET_VEXPRESS64_JUNO is not set # CONFIG_TARGET_LS2080A_EMU is not set # CONFIG_TARGET_LS2080A_SIMU is not set # CONFIG_TARGET_LS2080AQDS is not set # CONFIG_TARGET_LS2080ARDB is not set # CONFIG_TARGET_HIKEY is not set # CONFIG_TARGET_LS1021AQDS is not set # CONFIG_TARGET_LS1021ATWR is not set # CONFIG_TARGET_LS1043AQDS is not set # CONFIG_TARGET_LS1043ARDB is not set # CONFIG_TARGET_H2200 is not set # CONFIG_TARGET_ZIPITZ2 is not set # CONFIG_TARGET_COLIBRI_PXA270 is not set # CONFIG_ARCH_UNIPHIER is not set # CONFIG_STM32 is not set # CONFIG_ARCH_ROCKCHIP is not set # CONFIG_TARGET_THUNDERX_88XX is not set # CONFIG_SYS_MALLOC_F is not set # # ARM debug # # CONFIG_DEBUG_LL is not set # # General setup # CONFIG_LOCALVERSION="" CONFIG_LOCALVERSION_AUTO=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_EXPERT=y CONFIG_SYS_MALLOC_CLEAR_ON_INIT=y # # Boot images # # CONFIG_FIT is not set CONFIG_SYS_EXTRA_OPTIONS="" # # Boot timing # # CONFIG_BOOTSTAGE is not set CONFIG_BOOTSTAGE_USER_COUNT=20 CONFIG_BOOTSTAGE_STASH_ADDR=0 CONFIG_BOOTSTAGE_STASH_SIZE=4096 # CONFIG_CONSOLE_RECORD is not set # # Command line interface # CONFIG_CMDLINE=y CONFIG_HUSH_PARSER=y CONFIG_SYS_HUSH_PARSER=y CONFIG_SYS_PROMPT="SMDK2410 # " # # Autoboot options # # CONFIG_AUTOBOOT_KEYED is not set # # Commands # # # Info commands # CONFIG_CMD_BDI=y CONFIG_CMD_CONSOLE=y # CONFIG_CMD_CPU is not set # CONFIG_CMD_LICENSE is not set # # Boot commands # CONFIG_CMD_BOOTD=y CONFIG_CMD_BOOTM=y # CONFIG_CMD_BOOTZ is not set CONFIG_CMD_ELF=y CONFIG_CMD_GO=y CONFIG_CMD_RUN=y CONFIG_CMD_IMI=y CONFIG_CMD_IMLS=y CONFIG_CMD_XIMG=y # # Environment commands # # CONFIG_CMD_ASKENV is not set CONFIG_CMD_EXPORTENV=y CONFIG_CMD_IMPORTENV=y CONFIG_CMD_EDITENV=y # CONFIG_CMD_GREPENV is not set CONFIG_CMD_SAVEENV=y CONFIG_CMD_ENV_EXISTS=y # # Memory commands # CONFIG_CMD_MEMORY=y CONFIG_CMD_CRC32=y # CONFIG_LOOPW is not set # CONFIG_CMD_MEMTEST is not set # CONFIG_CMD_MX_CYCLIC is not set # CONFIG_CMD_MEMINFO is not set # # Device access commands # CONFIG_CMD_LOADB=y CONFIG_CMD_LOADS=y CONFIG_CMD_FLASH=y # CONFIG_CMD_ARMFLASH is not set # CONFIG_CMD_MMC is not set # CONFIG_CMD_NAND is not set # CONFIG_CMD_SF is not set # CONFIG_CMD_SPI is not set # CONFIG_CMD_I2C is not set CONFIG_CMD_USB=y # CONFIG_CMD_DFU is not set # CONFIG_CMD_USB_MASS_STORAGE is not set CONFIG_CMD_FPGA=y # CONFIG_CMD_GPIO is not set # # Shell scripting commands # CONFIG_CMD_ECHO=y CONFIG_CMD_ITEST=y CONFIG_CMD_SOURCE=y # CONFIG_CMD_SETEXPR is not set # # Network commands # CONFIG_CMD_NET=y # CONFIG_CMD_TFTPPUT is not set # CONFIG_CMD_TFTPSRV is not set # CONFIG_CMD_RARP is not set CONFIG_CMD_DHCP=y CONFIG_CMD_NFS=y # CONFIG_CMD_MII is not set CONFIG_CMD_PING=y # CONFIG_CMD_CDP is not set # CONFIG_CMD_SNTP is not set # CONFIG_CMD_DNS is not set # CONFIG_CMD_LINK_LOCAL is not set # # Misc commands # CONFIG_CMD_CACHE=y # CONFIG_CMD_TIME is not set CONFIG_CMD_MISC=y # CONFIG_CMD_TIMER is not set # # Power commands # # # Security commands # # # Filesystem commands # CONFIG_CMD_EXT2=y # CONFIG_CMD_EXT4 is not set CONFIG_CMD_FAT=y # CONFIG_CMD_FS_GENERIC is not set CONFIG_SUPPORT_OF_CONTROL=y # # Device Tree Control # # CONFIG_OF_CONTROL is not set CONFIG_NET=y # CONFIG_NET_RANDOM_ETHADDR is not set # CONFIG_NETCONSOLE is not set CONFIG_NET_TFTP_VARS=y # # Device Drivers # # # Generic Driver Options # # CONFIG_DM is not set # CONFIG_ADC is not set # CONFIG_ADC_EXYNOS is not set # CONFIG_ADC_SANDBOX is not set # CONFIG_BLOCK_CACHE is not set # # Clock # # CONFIG_CPU is not set # # Hardware crypto devices # # CONFIG_FSL_CAAM is not set # # Demo for driver model # # # DFU support # # CONFIG_DFU_TFTP is not set # # DMA Support # # CONFIG_TI_EDMA3 is not set # # GPIO Support # # # I2C support # # CONFIG_CROS_EC_KEYB is not set # # LED Support # # # Memory Controller drivers # # # Multifunction device drivers # # CONFIG_CROS_EC is not set # CONFIG_FSL_SEC_MON is not set # CONFIG_MXC_OCOTP is not set # CONFIG_PCA9551_LED is not set # CONFIG_WINBOND_W83627 is not set # # MMC Host controller Support # # # MTD Support # # # NAND Device Support # # CONFIG_NAND_DENALI is not set # CONFIG_NAND_VF610_NFC is not set # CONFIG_NAND_PXA3XX is not set # CONFIG_NAND_ARASAN is not set # # Generic NAND options # # # SPI Flash Support # # CONFIG_SPI_FLASH is not set # CONFIG_PHYLIB is not set # CONFIG_NETDEVICES is not set # # PCI # # # Pin controllers # # # Power # # # Remote Processor drivers # # # Real Time Clock # # # Serial drivers # # CONFIG_DEBUG_UART is not set # CONFIG_DEBUG_UART_SKIP_INIT is not set # CONFIG_FSL_LPUART is not set # CONFIG_SYS_NS16550 is not set # # Sound support # # CONFIG_SOUND is not set # # SPI Support # # CONFIG_FSL_ESPI is not set # CONFIG_TI_QSPI is not set # # SPMI support # # CONFIG_DM_THERMAL is not set # # Timer Support # # # TPM support # # CONFIG_USB is not set # # Graphics support # # # TrueType Fonts # # CONFIG_VIDEO_VESA is not set # CONFIG_VIDEO_LCD_ANX9804 is not set # CONFIG_VIDEO_LCD_SSD2828 is not set # CONFIG_VIDEO_MVEBU is not set # CONFIG_PHYS_TO_BUS is not set # # File systems # # # Library routines # # CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED is not set CONFIG_HAVE_PRIVATE_LIBGCC=y # CONFIG_USE_PRIVATE_LIBGCC is not set CONFIG_SYS_HZ=1000 # CONFIG_USE_TINY_PRINTF is not set CONFIG_REGEX=y # CONFIG_LIB_RAND is not set # CONFIG_CMD_DHRYSTONE is not set # CONFIG_RSA is not set # # Hashing Support # # CONFIG_SHA1 is not set # CONFIG_SHA256 is not set # CONFIG_SHA_HW_ACCEL is not set # # Compression Support # # CONFIG_LZ4 is not set # CONFIG_ERRNO_STR is not set # CONFIG_OF_LIBFDT is not set # CONFIG_SPL_OF_LIBFDT is not set # CONFIG_UNIT_TEST is not set