嵌入式


启动和用户数据更新

<h3>挂载nfs</h3> <p>设置环境变量后保存<code>saveenv</code></p> <pre><code>setenv bootargs 'console=${console},${baudrate} root=/dev/nfs rw nfsroot=${serverip}:${root_path}ip=${ipaddr}:${serverip}:${gw-ip}:${netmask}:${hostname}:${device}:off' setenv bootargs 'console=ttymxc0,115200 root=/dev/nfs rw nfsroot=192.168.1.137:/nfsroot/rootfs ip=192.168.1.136:192.168.1.137:192.168.1.254:255.255.255.0:EPC-M6G2C:eth0:off' </code></pre> <p>恢复</p> <pre><code>setenv bootargs 'console=ttymxc0,115200 ubi.mtd=5 ro root=ubi0:rootfs rootfstype=ubifs g_mass_storage.stall=0 g_mass_storage.removable=1 g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF g_mass_storage.iSerialNumber=""'</code></pre> <h3>网络启动</h3> <pre><code>MX6UL &gt; setenv ethaddr 00:01:02:03:04:05 # 设定以太网口 MAC 地址 MX6UL &gt; setenv ipaddr 192.168.1.136 # EPC-6G2C-L 的 IP 地址 MX6UL &gt; setenv serverip 192.168.1.137 # ubuntu 主机的 IP 地址 MX6UL &gt; ping 192.168.1.137 # 测试与 ubuntu 主机的网络通路 Using FEC1 device host 192.168.1.137 is alive MX6UL &gt; setenv root_path /nfsroot/rootfs # NFS 根文件系统在 ubuntu 主机中的路径 MX6UL &gt; setenv gw-ip 192.168.1.254 # 网关 IP 地址 MX6UL &gt; setenv netmask 255.255.255.0 # 子网掩码 MX6UL &gt; saveenv # 保存参数设定 Saving Environment to NAND... Erasing NAND... MX6UL &gt; run netboot Booting from net ... Using FEC1 device TFTP from server 192.168.1.137; our IP address is 192.168.1.136 Filename 'zImag</code></pre> <pre><code>setenv bootcmd ‘run netboot’ MX6UL &gt;saveenv</code></pre> <h3>网络升级内核和文件系统</h3> <p>1.设置网络</p> <pre><code>MX6UL&gt; printenv fdt_file # 查看更新的 dtb 文件 MX6UL &gt;run updtb #更新 dtb,可通过设置 fdt_file 变量更改 dtb 文件 Using FEC1 device TFTP from server 192.168.1.137; our IP address is 192.168.1.136 Filename 'imx6g2c.dtb'. Load address: 0x80800000 Loading: ### 1.2 MiB/s done Bytes transferred = 35322 (9fa hex) NAND erase.part: device 0 offset 0x400000, size 0x100000 Erasing at 0x4e0000 -- 100% complete. OK NAND write: device 0 offset 0x400000, size 0x89fa 35322 bytes written: OK MX6UL &gt;run uplogo # 更新 LOGO Using FEC1 device TFTP from server 192.168.1.137; our IP address is 192.168.1.136 Filename 'logo.bmp'. Load address: 0x80800000 Loading: ######### 1.4 MiB/s MX6UL &gt;run upkernel # 更新 kernel Using FEC1 device TFTP from server 192.168.1.137; our IP address is 192.168.1.136 Filename 'zImage' MX6UL &gt;run uprootfs # 更新 rootfs Using FEC1 device TFTP from server 192.168.1.137; our IP address is 192.168.1.136 Filename 'rootfs.ubifs.img</code></pre> <p>若tftp服务器根目录下没有放入相应文件将提示错误</p> <h3>系统启动后更新内核和uboot</h3> <p>使用freescale官方工具<code>kobs-ng</code>烧录<code>uboot</code>到<code>flash</code>,dtb和内核文件通过<code>nandwrite</code>写入</p> <pre><code>[root@EPC-M6G2C ~]# ls /opt/ u-boot.imx # 新的 uboot 文件 [root@EPC-M6G2C ~]# mount -t debugfs debugfs /sys/kernel/debug #获取 NAND 的 BCH 布局 [root@EPC-M6G2C ~]# flash_erase /dev/mtd0 0 0 # 擦除旧的 uboot Erasing 128 Kibyte @ 3e0000 -- 100 % complete [root@EPC-M6G2C ~]# wr kobs-ng init -x -v --chip_0_device_path=/dev/mtd0 /opt/u-boot.imx # 注意双横杠 省略输出 [root@EPC-M6G2C ~]# sync # 同步 NAND Flash</code></pre> <h3>rtlinux</h3> <p><a href="https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git">https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git</a> 实时系统补丁https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/ <a href="https://mirrors.edge.kernel.org/pub/linux/kernel/">https://mirrors.edge.kernel.org/pub/linux/kernel/</a></p> <p>rt-tests测试工具下载: git clone git://git.kernel.org/pub/scm/linux/kernel/git/clrkwllms/rt-tests.git</p> <p><a href="https://rt.wiki.kernel.org/index.php/Main_page">https://rt.wiki.kernel.org/index.php/Main_page</a></p> <p><a href="https://lwn.net/Articles/572740/">https://lwn.net/Articles/572740/</a> <a href="https://lwn.net/Articles/143323/">https://lwn.net/Articles/143323/</a> <a href="https://lwn.net/Articles/146861/">https://lwn.net/Articles/146861/</a></p> <h4>安装rtlinux</h4> <p><a href="https://github.com/yongjianchn/rtlinux-learning/blob/master/HOWTO.md">https://github.com/yongjianchn/rtlinux-learning/blob/master/HOWTO.md</a></p> <h4>实时系统需要的属性</h4> <ul> <li>服务质量</li> <li>必须检查的代码量以确保服务质量</li> <li>提供 API</li> <li>操作系统和应用程序的相对复杂性</li> <li>故障隔离:哪些非RT故障危及 RT 代码?</li> <li>支持哪些硬件和软件配置?</li> </ul>

页面列表

ITEM_HTML