Uboot porting with NXP MX serie
12 Jun 2020
Post Tags
Linux UbootSome previous knowledge about U-boot has been discussed in another blog.
1. Files need to be configured
THe following files are needed to be created and configured before doing further modifications.
/configs/<board_name>_defconfig
/include/configs/<board_name>.h
/arch/arm/cpu/armv7/mash-imx/mx6/Kconfig
//adding config TARGET and source “board/<vendor>/<board_name>”
/board/<vendor>/<board_name>/
...Kconfig
...<board_name>.c
...MAINTAINERS
2. Add or modify devices support
One of the most important file will need to modify is /board/<vendor>/<board_name>/<board_name>.c
, which
2.1 Add LCD support
A. Uboot command
A.1 Network commands
Basically, network connections can be very useful in debugging drivers and testing a system.
A.1.1 ping and network configuration
ping and configuration Before we use the network. There are some configurations have to be done first.
- setenv ipaddr 192.168.0.209 (Or using dhcp for dynamically allocate ip address)
- setenv ethaddr 08:00:00:00:22:02 (Depend on the ethernet port for eth-0 ethaddr, eth-1 eth1addr, eth-2 eth2addr)
- setenv gatewayip 192.168.0.1
- setenv netmask 255.255.255.0
- setenv serverip 192.168.1.250
- saveenv
A.1.2 nfs
nfs service can be very useful when we debug the rootsf or kernel.
1. nfs server setup (pc)
sudo apt install nfs-kernel-server
install nfs-server- configuration of nfs:
sudo vim /etc/exports
adding following content to the end of /etc/exports
/home/jie/workdir 192.168.0.0/24(rw,sync,all_squash,anonuid=998,anongid=998,no_subtree_check)
Note: anonuid=, anongid= related with the uid and gid of PC which can be obtained by `id` command in terminal.
192.168.0.0/24 is the netmask and network of host PC. This `/home/jie/workdir` path, which can be modified , will be used to share files.
2. nfs client operation(embedded device)
nfs 80800000 192.168.0.188:/home/jie/workdir/zImage
A.1.3 tftp
tftp command is very similar with nfs command.
sudo apt-get install tftp-hpa tftpd-hpa
sudo apt-get install xinetd
mkdir /home/zuozhongkai/linux/tftpboot
chmod 777 /home/zuozhongkai/linux/tftpboot
` touch /etc/xinetd.d/tftp `
write following content into tftp:
server tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /home/jie/linux/tftpboot/
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
vim /etc/default.tftp-hpa
sudo service tftpd-hpa start
# /etc/default/tftpd-hpa
2
3 TFTP_USERNAME="tftp"
4 TFTP_DIRECTORY="/home/zuozhongkai/linux/tftpboot"
5 TFTP_ADDRESS=":69"
6 TFTP_OPTIONS="-l -c -s"
sudo service tftpd-hpa restart
A.2 boot command
A.2.1 bootz
A.2.2 go
By using go command, we can run the bare-metal program at assigned address. It is a convenient way to test bare-metal program.
tftp 87800000 printf.bin
go 87800000
B Usage of U-boot
B.1 Boot from network
- bootcmd ‘tftp 80800000 zImage;tftp 83000000 imx6ull-14x14-evk.dtb;bootz 80800000 - 83000000’
- bootargs ‘console=ttymxc0,115200 root=/dev/mmcblk1p2’
B.1.1. bootcmd & bootargs
- bootcmd can save those default command and execute it when bringup.
- bootargs is one of the crucial arguments which save environment features