Category:UBoot

From ElectroDragon Wiki
Revision as of 20:08, 12 May 2020 by Chao (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Source

Download and Complie

git clone https://github.com/Lichee-Pi/u-boot.git -b v3s-current
#or git clone https://github.com/Lichee-Pi/u-boot.git -b v3s-spi-experimental
cd u-boot
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LicheePi_Zero_800x480LCD_defconfig
#or make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LicheePi_Zero480x272LCD_defconfig
#or make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LicheePi_Zero_defconfig
make ARCH=arm menuconfig
time make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 2>&1 | tee build.log

Config

  • make ARCH=arm menuconfig

Zero UBoot

install prequiste

apt-get install gcc make pkg-config libusb-1.0-0-dev libncurses5-dev
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev gcc-multilib x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils
apt-get install gcc-arm-linux-gnueabihf device-tree-compiler mtd-utils
  • GCC Linaro
wget https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
tar xvf gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
mv gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu /opt/
vim /etc/bash.bashrc
# add: PATH="$PATH:/opt/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin"
arm-linux-gnueabihf-gcc -v

Uboot

For SPI Flash version

or normal version


config file include/configs/sun8i.h

For TF card boot ?

#define CONFIG_BOOTCOMMAND   "setenv bootm_boot_mode sec; " \
                           "load mmc 0:1 0x41000000 zImage; "  \
                           "load mmc 0:1 0x41800000 sun8i-v3s-licheepi-zero-dock.dtb; " \
                           "bootz 0x41000000 - 0x41800000;"
#define CONFIG_BOOTARGS      "console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 earlyprintk rw  vt.global_cursor_default=0"
or for SPI Flash boot
#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"

Menuconfig

  • config generate default configuration file
cd u-boot
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LicheePi_Zero_800x480LCD_defconfig
#or make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LicheePi_Zero480x272LCD_defconfig
#or make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LicheePi_Zero_defconfig
  • config in menu -> ARCH=arm make menuconfig
  • Architecture select - ARM
  • ARM architecture
Target select (Support sunxi (Allwinner) SoCs) 
(360) sunxi dram clock speed          config dram speed
(14779) sunxi dram zq value           config dram ZQ value,是用来动态加强DDR3的
-*- Board uses DDR2 DRAM             use DDR2 DRAM使用DDR2 DRAM
[*] Enable graphical uboot console on HDMI, LCD or VGA   这个就是在显示设备上使能串口控制
[ ] VGA via LCD controller support             使能支持VGA通过LCD的控制器,就是LCD和VAG转换需要的控制器
(x:800,y:480,depth:18,pclk_khz:33000,le:87,ri:40,up:31,lo:13,hs:1,vs:1,sync:3,vmode:0) LCD pane
> 该选项就是配置LCD的分辨率的配置选项可以看到x是800 y是480 等等一些关于LCD的配置内容,点击回车进去可以对其进行修改。
(1)   LCD panel display clock phase               这个是LCD的显示时钟相位
()    LCD panel power enable pin               LCD的电源使能引脚
()    LCD panel reset pin                                             LCD的复位引脚
(PB4) LCD panel backlight pwm pin                    背光PWN引脚 这个应该是调节亮度的引脚PB4
[*]   LCD panel backlight pwm is inverted            反转PWN背光引脚
[ ]   LCD panel needs to be configured via i2c
   LCD panel support (Generic parallel interface LCD panel)  --->     这个选择支持的LCDpanel
           (X) Generic parallel interface LCD panel                   这里选择支持通用的并行的LCD接口
           ( ) Generic lvds interface LCD panel                       这个是LVDS接口
           ( ) MIPI 4-lane, 513Mbps LCD panel via SSD2828 bridge chip
           ( ) eDP 4-lane, 1.62G LCD panel via ANX9804 bridge chip
           ( ) Hitachi tx18d42vm LCD panel
           ( ) tl059wv5c0 LCD panel
(0) GMAC Transmit Clock Delay Chain
  • Boot images - (1008000000) CPU clock frequency
  • delay in seconds before automatically booting - 2s

SPL / TPL ---> 这个就是SPL相关的配置了

[*]   MMC raw mode: by sector                       按扇区
(0x50)  Address on the MMC to load U-Boot from  mmc加载uboot的地址
[*] Support GPIO                                 支持GPIO
[*] Support I2C                                 支持I2C
[*] Support common libraries                    支持通用lib
[*] Support disk paritions                      支持分区
[*] Support generic libraries                   支持一般lib库
[*] Support MMC                                 支持MMC
[*] Support power drivers                  支持电源驱动
[*] Support serial                               支持串口

complie

  • time make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 2>&1 | tee build.log
  • ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make
  • or ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make -j3
  • 第一个time命令完全可以去掉,time主要为了计算该编译需要花费的时间
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
  • 这个之前的config也说了,其实就是给变量ARCH赋值arm
  • 给CROSS_COMPILE赋值arm-linux-gnueabihf-
  • 也可以先省去,剩下的:
make 2>&1 | tee build.log
  • tee 这个命令是把make生成的log写入到build.log文件中,这样编译之后的log文件可以保留存有备份,也可以省去。
make 2>&1
  • 查了下资料 数字2对应stderr 数字1对应stdout
  • 这里即将标准err输出 &作为连接符表示‘与’的意思,即标准输出和标准error输出都进行输出。
  • 其实真正执行编译的是下面的命令:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
  • 小伙伴可以试下,该命令是否可以编译出u-boot-sunxi-with-spl.bin文件,其他的命令都是辅助编译的命令,用于调试的时候开启。亲测直接make CROSS_COMPILE=arm-linux-gnueabihf- 也是可以的。

Use Uboot

Hit any key to stop autoboot:  0 
=> printenv
arch=arm
baudrate=115200
board=sunxi
board_name=sunxi
...

Reference

This category currently contains no pages or media.