DAY67 IMX6 Development Board Configuration from Scratch

IMX6 Development Board Configuration from Scratch: U-Boot IP/MAC/bootargs Setup + Kernel Boot Full Process

1. Preparation

1.1 Tools and Environment

Tool/Environment Version/Configuration Requirements Core Function
IMX6 Development Board Supports U-Boot (e.g., official ported version) Hardware platform for running U-Boot and kernel
Ubuntu Host Any version supporting TFTP/NFS (this guide uses 18.04 as an example) Set up TFTP server (providing kernel/device tree) and NFS root filesystem
Serial Tool SecureCRT/Xshell/Minicom Connect to the development board's U-Boot and execute commands
TFTP Server tftpd-hpa (Ubuntu package) Quickly download zImage and imx6.dtb to the development board's memory
NFS Service nfs-kernel-server (Ubuntu package) Provide root filesystem, mounted by the kernel after boot

1.2 Pre-configuration (Ubuntu Side)

  1. TFTP Server Configuration : After installation, specify a shared directory (e.g., /home/linux/tftp) and place the zImage kernel and imx6.dtb device tree in it.
  2. NFS Configuration : Add the configuration in /etc/exports (e.g., /home/linux/nfs *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)), then restart the NFS service.
  3. Network Setup : Ensure the development board and Ubuntu host are on the same LAN (e.g., connected to a router). Note the Ubuntu host's IP (e.g., 192.168.1.3).

2. Step 1: Configure IP and MAC Address in U-Boot

U-Boot's network functionality depends on environment variables like IP/MAC, which must be configured before downloading files via TFTP.

2.1 Core Environment Variables

Environment Variable Purpose
ipaddr The development board's IP address during U-Boot (must be on the same subnet as Ubuntu, e.g., 192.168.1.100)
serverip TFTP server IP address (i.e., Ubuntu host IP, e.g., 192.168.1.3)
ethaddr Development board NIC MAC address (custom, e.g., 00:11:22:33:44:55, avoid conflicts with other devices)

2.2 Configuration Commands

  1. Power on the development board and enter the U-Boot command line via the serial tool (press any key to interrupt auto-boot).

  2. Execute the following commands to configure network parameters:

    bash 复制代码
    # Set development board IP  
    setenv ipaddr 192.168.1.100  
    # Set TFTP server IP (Ubuntu host IP)  
    setenv serverip 192.168.1.3  
    # Set MAC address (optional, required if the board has no default MAC)  
    setenv ethaddr 00:11:22:33:44:55  
    # Save environment variables (write to the board's MMC to avoid loss after reboot)  
    saveenv  
  3. Verify network connectivity:

    bash 复制代码
    # Ping Ubuntu host; success will show "host 192.168.1.3 is alive"  
    ping 192.168.1.3  

2.3 Additional Notes

  • U-Boot environment variables are essentially strings stored in Flash/MMC. setenv modifies variables in memory, while saveenv writes them to persistent storage.
  • The MAC address is the NIC's unique identifier. Without configuration, network conflicts may occur, preventing TFTP/NFS from functioning properly.

3. Step 2: Set bootargs Boot Parameters

bootargs are parameters passed by U-Boot to the Linux kernel, which the kernel uses to initialize the system (e.g., specifying console and root filesystem).

3.1 bootargs Breakdown (NFS Root Filesystem Example)

Example parameter (aligned with the guide):

bash 复制代码
setenv bootargs console=ttymxc0,115200 root=/dev/nfs nfsroot=192.168.1.3:/home/linux/nfs/imx6/rootfs,nfsvers=3 ip=192.168.1.100 init=/linuxrc  

Parameter meanings:

Parameter Purpose
console=ttymxc0,115200 Specify Linux console as serial port ttymxc0 (IMX6 default UART), baud rate 115200
root=/dev/nfs Declare root filesystem type as NFS (network filesystem)
nfsroot=... Specify NFS root filesystem path: UbuntuIP:shared_directory, nfsvers=3 specifies NFS protocol version 3
ip=192.168.1.100 Specify the IP address after Linux kernel boot (should match U-Boot's ipaddr)
init=/linuxrc Specify Linux's init process (PID 1) as /linuxrc (initialization script in the root filesystem)

3.2 Configuration Commands

bash 复制代码
# Set bootargs (enter as one line, replace the path with your NFS directory)  
setenv bootargs console=ttymxc0,115200 root=/dev/nfs nfsroot=192.168.1.3:/home/linux/nfs/imx6/rootfs,nfsvers=3 ip=192.168.1.100 init=/linuxrc  
# Save parameters  
saveenv  
# Verify parameters (displays current bootargs value)  
printenv bootargs  

4. Step 3: Download zImage and imx6.dtb via TFTP

The Linux kernel (zImage) and device tree (imx6.dtb) must be downloaded to the development board's memory before execution. TFTP is the most common method in U-Boot.

4.1 Key Notes

  • zImage : Compressed Linux kernel image, must be downloaded to a specific memory address (recommended 0x80800000 for IMX6).
  • imx6.dtb : Device tree file describing hardware resources (e.g., GPIO, UART, SPI), recommended download address 0x83000000.
  • Memory addresses must avoid critical kernel regions. The above addresses are general recommendations for IMX6; refer to the chip manual for adjustments.

4.2 Download Commands

bash 复制代码
# Download zImage to memory address 0x80800000  
tftp 0x80800000 zImage  
# Download imx6.dtb to memory address 0x83000000  
tftp 0x83000000 imx6.dtb  
  • Success will show "Bytes transferred = xxx (xxx hex)", indicating the file was written to memory.
  • If download fails, check if the TFTP service is running, files are in the shared directory, and IP addresses are correct.

5. Step 4: Boot Linux Kernel with bootz

bootz is the U-Boot command for booting compressed kernels (zImage). It requires specifying the kernel address, initrd address (use "-" if none), and device tree address.

5.1 Boot Command

bash 复制代码
# bootz kernel_address - device_tree_address (initrd unused, placeholder "-")  
bootz 0x80800000 - 0x83000000  

5.2 Boot Success Verification

  1. After execution, the serial port will output kernel boot logs (e.g., driver initialization, filesystem mounting).
  2. Eventually, the Linux command line (e.g., / #) will appear, indicating successful boot.
  3. Verify NFS mount: Run df -h, which should show 192.168.1.3:/home/linux/nfs/imx6/rootfs mounted to /.

6. Troubleshooting

6.1 Cannot Ping TFTP Server

  • Verify the development board and Ubuntu are on the same subnet with no IP conflicts.
  • Disable Ubuntu firewall (sudo ufw disable).
  • Confirm ethaddr is configured and not duplicated with other devices.

6.2 TFTP File Download Fails

  • Check if the TFTP shared directory is correct and files (zImage/imx6.dtb) exist.
  • Ensure the TFTP service is running (sudo systemctl start tftpd-hpa).
  • Verify memory addresses are correct and do not exceed the board's memory limits.

6.3 Kernel Boot Fails to Enter Command Line

  • Check nfsroot path in bootargs and NFS service status.
  • Confirm init=/linuxrc exists in the root filesystem.
  • Verify serial parameters (baud rate 115200) match the console configuration in bootargs.

7. Summary

This guide covers the core configuration process for the IMX6 development board in U-Boot, from environment setup to kernel boot:

  1. Network configuration (IP/MAC) is foundational, ensuring TFTP/NFS communication.
  2. bootargs parameters are critical, determining kernel initialization and root filesystem mounting.
  3. TFTP downloading of kernel/device tree is efficient; memory addresses should follow chip recommendations.
  4. The bootz command is central for booting compressed kernels, with parameter order being crucial.
相关推荐
zuYM4g7Dp28 分钟前
NoSql数据库设计心得
数据库·nosql
睡不醒男孩0308232 小时前
第七篇:揭秘 PostgreSQL 数据库内核级管控:CLup 深度架构设计与高可用底座技术白皮书
数据库·postgresql·clup
cmes_love3 小时前
Level 2逐笔成交历史数据下载方法笔记
数据库·笔记·oracle
swordbob3 小时前
MySQL字符集陷阱:从Oracle迁移踩坑到utf8mb4强制规范
数据库·sql
牛油果子哥q3 小时前
【C++ STL string 】C++ STL string 终极精讲:底层原理、内存机制、全套API、深浅拷贝、易错坑点与工程实战规范
数据库·c++
十五年专注C++开发3 小时前
MySql中各种功能用sql语句实现总结
数据库·sql·mysql
数据库小学妹4 小时前
AI时代数据库怎么选?多模融合、数据统一存储与选型实战指南
数据库·人工智能·经验分享·ai
Albert Edison4 小时前
【Redis】Centos7.9 安装 Redis 5 教程
数据库·redis·缓存
云计算磊哥@4 小时前
运维开发宝典026-MySQL02数据库表操作
运维·数据库·运维开发
小二·4 小时前
Redis 内存溢出(OOM)排查与恢复实战
数据库·redis·bootstrap