1.clone u-boot
git clone -b nano-v2018.01 https://github.com/Lichee-Pi/u-boot.git
git clone -b v3s-spi-experimental https://github.com/Lichee-Pi/u-boot.git
cd u-boot
git branch -a
git checkout //nano-v2018.01
如果需要生成在sdram里启动的uboot
make ARCH=arm licheepi_nano_defconfig
如果需要生成在spiflash里启动的uboot
make ARCH=arm licheepi_nano_spiflash_defconfig
6.install
sudo apt install gcc
sudo apt install python
apt install swig
apt install python-dev
apt install bc
6.1 make
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LicheePi_Zero_800x480LCD_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LicheePi_Zero480x272LCD_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LicheePi_Zero_defconfig
make LicheePi_Zero_480x272LCD_defconfig
make LicheePi_Zero_800x480LCD_defconfig
make LicheePi_Zero_defconfig
make ARCH=arm menuconfig
time make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 2>&1 | tee build.log
7.add spiflash
make ARCH=arm menuconfig
Device Drivers -> SPI Flash Suppor -> Macronix SPI flash support
如果使用的是16MB以上的flash,需要勾选flash bank支持选项,否则最多只能读到16MB: CONFIG_SPI_FLASH_BAR
在文件 include/configs/sun8i.h 中添加默认bootcmd和bootargs的环境变量设置
注意添加的位置在“ #include
#define CONFIG_BOOTCOMMAND "sf probe 0; "
"sf read 0x41800000 0x100000 0x10000; "
"sf read 0x41000000 0x110000 0x400000; "
“bootz 0x41000000 - 0x41800000”
#define CONFIG_BOOTARGS "console=ttyS0,115200 earlyprintk panic=5 rootwait "
“mtdparts=spi32766.0:1M(uboot)ro,64k(dtb)ro,4M(kernel)ro,-(rootfs) root=31:03 rw rootfstype=jffs2”
8.make uboot
time make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 2>&1 | tee build.log
会在目录下生成 u-boot-sunxi-with-spl.bin
修改 suniv.h
#define CONFIG_BOOTCOMMAND "sf probe 0:50000000; "
"sf read 0x80C00000 0x100000 0x4000; "
"sf read 0x80008000 0x110000 0x400000; "
“bootz 0x80008000 - 0x80C00000”
9.修改开机logo
bmp文件必须为8bit bmp 可用ps存储为8位256色png web格式 后重新打开保存为8位bmp
将bmp文件放入/tools/logos中,命名为denx.bmp
或者修改/tools/下的Makefile
LOGO_BMP= ( s r c t r e e ) / (srctree)/ (srctree)/(src)/logos/denx.bmp
确认配置文件
在 include/configs/sun8i.h 中加入两个宏定义:
#define CONFIG_VIDEO_LOGO
#define CONFIG_VIDEO_BMP_LOGO
10.隐藏版本信息
drivers/video/cfb_console.c 搜索 CONFIG_HIDE_LOGO_VERSION ,删除除第一行以下的代码 即可隐藏uboot的版本信息。
#ifndef CONFIG_HIDE_LOGO_VERSION
space = (VIDEO_LINE_LEN / 2 - VIDEO_INFO_X) / VIDEO_FONT_WIDTH;
len = strlen(info);
if (len > space) {
video_drawchars(VIDEO_INFO_X, VIDEO_INFO_Y,
(uchar *) info, space);
video_drawchars(VIDEO_INFO_X + VIDEO_FONT_WIDTH,
VIDEO_INFO_Y + VIDEO_FONT_HEIGHT,
(uchar *) info + space, len - space);
y_off = 1;
} else
video_drawstring(VIDEO_INFO_X, VIDEO_INFO_Y, (uchar *) info);
11.logo居中
接下来要使图片居中显示,修改drivers/video/cfb_console.c,在函数static void *video_logo(void)中修改
splash_get_pos(&video_logo_xpos, &video_logo_ypos);
//这里是增加的代码,设置图片居中显示
if(video_logo_xpos0&&video_logo_ypos0)
{
video_logo_xpos= (VIDEO_VISIBLE_COLS - BMP_LOGO_WIDTH)>>1;
video_logo_ypos= (VIDEO_VISIBLE_ROWS - BMP_LOGO_HEIGHT)>>1;
}