2018/05/09 10:49
zhoulinhua@2018-05-10
一、单板类型支持
1.修改at91sam9x5ek_defconfig定制软件匹配当前单板
buildroot-at91/configs/at91sam9x5ek_defconfig
备注:先备份为at91sam9x5ek_defconfig_bak
1)修改配置bootstrap文件为:at91sam9x5ekdf_uboot
BR2_TARGET_AT91BOOTSTRAP3_DEFCONFIG="at91sam9x5ekdf_uboot"
2)修改配置u-boot文件为:at91sam9x5ek_spiflash
BR2_TARGET_UBOOT_BOARD_DEFCONFIG="at91sam9x5ek_spiflash"
修改之后对比:
diff at91sam9x5ek_defconfig at91sam9x5ek_defconfig_bak
20c20
< BR2_TARGET_AT91BOOTSTRAP3_DEFCONFIG="at91sam9x5ekdf_uboot"
---
> BR2_TARGET_AT91BOOTSTRAP3_DEFCONFIG="at91sam9x5eknf_uboot"
26c26
< BR2_TARGET_UBOOT_BOARD_DEFCONFIG="at91sam9x5ek_spiflash"
---
> BR2_TARGET_UBOOT_BOARD_DEFCONFIG="at91sam9x5ek_nandflash"
3)支持jffs2文件系统
两种方法修改编译jffs2文件系统
a、修改at91sam9x5ek_defconfig文件
BR2_TARGET_ROOTFS_UBIFS=y
BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x1f000
BR2_TARGET_ROOTFS_UBI=y
BR2_TARGET_ROOTFS_UBI_SUBSIZE=2048
修改为:
BR2_TARGET_ROOTFS_JFFS2=y
BR2_TARGET_ROOTFS_JFFS2_FLASH_64=y
BR2_TARGET_ROOTFS_JFFS2_EBSIZE=0x10000
BR2_TARGET_ROOTFS_JFFS2_LE=y
或者在make menuconfig配置界面进行勾选
2.at91bootstrap,修改启动uboot在SPI-FLASH的位置为0x10000
修改at91bootstrap根目录下的Config.in.u-boot文件(at91bootstrap/Config.in.u-boot)
default "0x00008000" if CONFIG_DATAFLASH
为:
default "0x00010000" if CONFIG_DATAFLASH
3.修改at91sam9x5ek_spiflash_defconfig定制uboot匹配当前单板
u-boot-at91/configs/at91sam9x5ek_spiflash_defconfig
1)增加n25q128、is25lp128 SPI-FLASH支持
a、在at91sam9x5ek_spiflash_defconfig添加:
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SPI_FLASH_ISSI=y
或者在make menuconfig配置界面进行勾选
b、在drivers/mtd/spi/Kconfig文件中增加ISSI FLASH配置
config SPI_FLASH_ISSI
bool "ISSI SPI flash support"
help
Add support for various ISSI SPI flash chips (is25lp128)
c、在drivers/mtd/spi/Kconfig文件中配置SPI_FLASH_USE_4K_SECTORS默认不支持
config SPI_FLASH_USE_4K_SECTORS
bool "Use small 4096 B erase sectors"
depends on SPI_FLASH
default y
help
修改为:
config SPI_FLASH_USE_4K_SECTORS
bool "Use small 4096 B erase sectors"
depends on SPI_FLASH
#default y
help
2)修改默认设备树为at91sam9g25ek
u-boot-at91/configs/at91sam9x5ek_spiflash_defconfig
CONFIG_DEFAULT_DEVICE_TREE="at91sam9g35ek"
为:
CONFIG_DEFAULT_DEVICE_TREE="at91sam9g25ek"
4.修改at91_dt_defconfig定制linux内核匹配当前单板
1)linux-at91/arch/arm/configs/at91_dt_defconfig
支持spi-nor flash,去掉usb、802.11、media、video、sound、mouse、LCD等外设支持;修改前后的config如下附件:
2)修改linux-at91/drivers/mtd/spi-nor/Kconfig文件
config MTD_SPI_NOR_USE_4K_SECTORS
bool "Use small 4096 B erase sectors"
default y
help
修改为:
config MTD_SPI_NOR_USE_4K_SECTORS
bool "Use small 4096 B erase sectors"
# zholinhua@UTEK
# default y
help
3)修改linux-at91/drivers/usb/Kconfig
menuconfig USB_SUPPORT
bool "USB support"
depends on HAS_IOMEM
default y
修改为
menuconfig USB_SUPPORT
bool "USB support"
depends on HAS_IOMEM
# zhoulinhua@UTEK
# default y
4)通过修改menuconfig增加MTD对SPI-NOR的支持(spi-nor 驱动)
make linux-menuconfig
File systems --->
---Device Drivers --->
<*> Memory Technology Device (MTD) support --->
<*> SPI-NOR device support --->
[] Use small 4096 B erase sectors
默认勾选,这里我们要去勾选,使用64k erase sectors
---Device Drivers --->
<*> Memory Technology Device (MTD) support --->
Self-contained MTD device drivers --->
<*> Support most SPI Flash chips (AT26DF, M25P, W25X, ...)
make linux-rebulid all
make
5.修改buildroot-at91/system/Config.in设置登录信息
1)修改登录信息:
config BR2_TARGET_GENERIC_ISSUE
string "System banner"
#default "Welcome to Buildroot"
#zhoulinhua@UTEK
default "Welcome to utek"
2)修改登录密码:
config BR2_TARGET_GENERIC_ROOT_PASSWD
string "Root password"
#default ""
#zhoulinhua@UTEK
default "utek"
depends on BR2_TARGET_ENABLE_ROOT_LOGIN
二、buildroot相关:
1.相关命令
查看当前编译的组件
在buildroot-at91目录下:
查看当前所以编译的package
make show-targets
清除命令,包括所有的目标文件和配置文件
make distclean
清除迷路,只清除目标文件
make clean
全部编译
make
清除单个package命令,包括目标文件、配置文件
make
-distclean
清除单个packet命令,只清除目标文件
make
配置单独的package
make -menuconfig
编译单独的package
make -rebulid all
配置bootstrap
make at91bootstrap3-menuconfig
编译bootstrap
make at91bootstrap3-rebuild all
配置uboot
make uboot-menuconfig
编译uboot
make uboot-rebuild all
配置kernel
make linux-menuconfig
编译kernel
make linux-rebuild all
配置 uclibc
make uclibc-menuconfi
编译 uclibc
make uclibc-rebulid all
配置 busybox
make busybox-menuconfig
编译 busybox
make busybox-rebuild all
2.custom source code
bootroot的源代码都是通过git获得,每次make clean、make distclean之后bulid目录的源代码都将被删除,下一次make重新下载,不利于开发工作,因此对于要修改的源代码进行overrid,每次修改之后编译将从指定的目录拷贝源代码到buildroot-at91/output/build目录下并且命名为-custom。执行make clean或者make distclean指定的目录不会被操作。
1)在buildroot-at91新建vender目录,将第一次下载编译的package代码放在里面;
2)在buildroot-at91下新建local.mk文件将需要overrid的目录进行指定格式如下:
_OVERRIDE_SRCDIR = ./vender/
例如overrid bootstrap、uboot、linux kernel命令如下:
#LINUX override
LINUX_OVERRIDE_SRCDIR=./vender/linux-at91
#UBOOT override
UBOOT_OVERRIDE_SRCDIR=./vender/u-boot-at91
#AT91BOOTSTRAP3 override
AT91BOOTSTRAP3_OVERRIDE_SRCDIR=./vender/at91bootstrap