imx6q 笔记 环境:Ubuntu 17.10
一、安装编译工具(二选一):
下载地址:http://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/arm-linux-gnueabihf/
1、下载编译工具:gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2;下载地址:https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads
2、命令安装交叉工具链: sudo apt-get install gcc-arm-linux-gnueabi
二、交叉编译sfdisk
1、下载:https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.23/util-linux-2.23.1.tar.bz2
2、解压:tar -xjf util-linux-2.23.1.tar.bz2
3、配置:./configure --host=arm-linux CC=arm-linux-gnueabi-gcc --prefix=/home/lonnox/work/tools/util-linux-2.23.1/_install --without-ncurses
4、编译:make&&make install
三、搭建网络文件系统
1、tar zxvf rootfs.tgz
2、sudo apt-get install nfs-kernel-server portmap
3、sudo vim /etc/exports
添加:/home/lonnox/work/imx6/nfs_root *(rw,sync,no_root_squash)
4、sudo /etc/init.d/nfs-kernel-server restart
5、测试nfs是否成功:sudo mount -t nfs 127.0.0.1:/home/lonnox/work/imx6/nfs_root /mnt
如果出错 svc: failed to register lockdv1 RPC service (errno 111).
添加-o nolock,命令改成:mount -o nolock -t nfs 192.168.1.104:/home/lonnox/work/imx6/nfs_root /mnt
6.网络文件系统的方式启动
setenv bootargs console=ttySAC0,115200 ${displayArgs} root=/dev/nfs rw nfsroot=192.168.1.104:/home/lonnox/work/imx6/nfs_root,v3,tcp ip=192.168.1.106:192.168.1.104:192.168.1.1:255.255.255.0
mmc dev 3;mmc read ${loadaddr} 0x800 0x3000;setenv bootargs ${bootargs};bootm
四、交叉编译mkfs.ext3
1、下载:https://netix.dl.sourceforge.net/project/e2fsprogs/e2fsprogs/v1.44.3/e2fsprogs-1.44.3.tar.gz
2、解压 tar -xzf e2fsprogs-1.44.3.tar.gz
3、./configure --host=arm-linux CC=arm-linux-gnueabi-gcc --prefix=/home/lonnox/work/tools/e2fsprogs-1.44.3/_install
//=============================================================
///vim tmp_build.sh
#! /bin/sh
CC=arm-linux-gnueabi-gcc ./configure --enable-elf-shlibs --host=arm --prefix=/home/lonnox/work/tools/e2fsprogs-1.44.3/_install
//=============================================================
4、编译:make&&make install
5.拷贝
cp -a bin/* ../../../imx6/nfs_root/usr/bin/
cp -a sbin/* ../../../imx6/nfs_root/usr/sbin/
cp -a lib/* ../../../../imx6/nfs_root/lib/
6、查看分区信息cat /proc/partitions
五、编译uboot
1、下载uboot:git clone https://source.codeaurora.org/external/imx/uboot-imx -b u-boot/master
2、修改board/freescale/mx6qarm2/imximage.cfg
/* DCD */
DATA 4, 0x020e0798, 0x000C0000
DATA 4, 0x020e0758, 0x00000000
DATA 4, 0x020e0588, 0x00000030
DATA 4, 0x020e0594, 0x00000030
DATA 4, 0x020e056c, 0x00000030
DATA 4, 0x020e0578, 0x00000030
DATA 4, 0x020e074c, 0x00000030
DATA 4, 0x020e057c, 0x00000030
DATA 4, 0x020e058c, 0x00000000
DATA 4, 0x020e059c, 0x00000030
DATA 4, 0x020e05a0, 0x00000030
DATA 4, 0x020e078c, 0x00000030
DATA 4, 0x020e0750, 0x00020000
DATA 4, 0x020e05a8, 0x00000018
DATA 4, 0x020e05b0, 0x00000018
DATA 4, 0x020e0524, 0x00000018
DATA 4, 0x020e051c, 0x00000018
DATA 4, 0x020e0518, 0x00000018
DATA 4, 0x020e050c, 0x00000018
DATA 4, 0x020e05b8, 0x00000018
DATA 4, 0x020e05c0, 0x00000018
DATA 4, 0x020e0774, 0x00020000
DATA 4, 0x020e0784, 0x00000018
DATA 4, 0x020e0788, 0x00000018
DATA 4, 0x020e0794, 0x00000018
DATA 4, 0x020e079c, 0x00000018
DATA 4, 0x020e07a0, 0x00000018
DATA 4, 0x020e07a4, 0x00000018
DATA 4, 0x020e07a8, 0x00000018
DATA 4, 0x020e0748, 0x00000018
DATA 4, 0x020e05ac, 0x00000018
DATA 4, 0x020e05b4, 0x00000018
DATA 4, 0x020e0528, 0x00000018
DATA 4, 0x020e0520, 0x00000018
DATA 4, 0x020e0514, 0x00000018
DATA 4, 0x020e0510, 0x00000018
DATA 4, 0x020e05bc, 0x00000018
DATA 4, 0x020e05c4, 0x00000018
DATA 4, 0x021b0800, 0xa1390003
DATA 4, 0x021b080c, 0x001F001F
DATA 4, 0x021b0810, 0x001F001F
DATA 4, 0x021b480c, 0x001F001F
DATA 4, 0x021b4810, 0x001F001F
DATA 4, 0x021b083c, 0x43180330
DATA 4, 0x021b0840, 0x03180310
DATA 4, 0x021b483c, 0x43200330
DATA 4, 0x021b4840, 0x0320025C
DATA 4, 0x021b0848, 0x40363838
DATA 4, 0x021b4848, 0x38362E3C
DATA 4, 0x021b0850, 0x3E3C4840
DATA 4, 0x021b4850, 0x44364640
DATA 4, 0x021b081c, 0x33333333
DATA 4, 0x021b0820, 0x33333333
DATA 4, 0x021b0824, 0x33333333
DATA 4, 0x021b0828, 0x33333333
DATA 4, 0x021b481c, 0x33333333
DATA 4, 0x021b4820, 0x33333333
DATA 4, 0x021b4824, 0x33333333
DATA 4, 0x021b4828, 0x33333333
DATA 4, 0x021b08b8, 0x00000800
DATA 4, 0x021b48b8, 0x00000800
DATA 4, 0x021b0004, 0x00020036
DATA 4, 0x021b0008, 0x09444040
DATA 4, 0x021b000c, 0x8A8F7955
DATA 4, 0x021b0010, 0xFF328F64
DATA 4, 0x021b0014, 0x01FF00DB
DATA 4, 0x021b0018, 0x00001740
DATA 4, 0x021b001c, 0x00008000
DATA 4, 0x021b002c, 0x000026D2
DATA 4, 0x021b0030, 0x008F1023
DATA 4, 0x021b0040, 0x00000047
DATA 4, 0x021b0000, 0x841A0000
DATA 4, 0x021b001c, 0x04088032
DATA 4, 0x021b001c, 0x00008033
DATA 4, 0x021b001c, 0x00048031
DATA 4, 0x021b001c, 0x09408030
DATA 4, 0x021b001c, 0x04008040
DATA 4, 0x021b0020, 0x00005800
DATA 4, 0x021b0818, 0x00011117
DATA 4, 0x021b4818, 0x00011117
DATA 4, 0x021b0004, 0x00025576
DATA 4, 0x021b0404, 0x00011006
DATA 4, 0x021b001c, 0x00000000
/* set the default clock gate to save power */
DATA 4 0x020c4068 0x00C03F3F
DATA 4 0x020c406c 0x0030FC03
DATA 4 0x020c4070 0x0FFFC000
DATA 4 0x020c4074 0x3FF00000
DATA 4 0x020c4078 0x00FFF300
DATA 4 0x020c407c 0x0F0000C3
DATA 4 0x020c4080 0x000003FF
/* enable AXI cache for VDOA/VPU/IPU */
DATA 4 0x020e0010 0xF00000CF
/* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
DATA 4 0x020e0018 0x007F007F
DATA 4 0x020e001c 0x007F007F
3、修改board/freescale/mx6qarm2/mx6qarm2.c
//modify:添加uart1的引脚出事化
static void setup_iomux_uart(void)
{
imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
}
iomux_v3_cfg_t const uart1_pads[] =
{
MX6_PAD_SD3_DAT6__UART1_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
MX6_PAD_SD3_DAT7__UART1_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
};
iomux_v3_cfg_t const usdhc3_pads[] =
{
MX6_PAD_SD3_CLK__SD3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD3_CMD__SD3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD3_DAT0__SD3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD3_DAT1__SD3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD3_DAT2__SD3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD3_DAT3__SD3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD3_DAT4__SD3_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD3_DAT5__SD3_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
//MX6_PAD_SD3_DAT6__SD3_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),//modify:uart1引脚冲突,注释掉该语句
//MX6_PAD_SD3_DAT7__SD3_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),//modify:uart1引脚冲突,注释掉该语句
MX6_PAD_NANDF_CS0__GPIO6_IO11 | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
};
网络部分修改:
//modify:添加
vim include/configs/mx6qarm2.h
#define CONFIG_NET_RANDOM_ETHADDR
#define CONFIG_LIB_RAND
//modify:修改引脚
vim mx6qarm2.c
iomux_v3_cfg_t const enet_pads[] = {
MX6_PAD_ENET_MDIO__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_ENET_MDC__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_ENET_RXD1__GPIO1_IO26 | MUX_PAD_CTRL(NO_PAD_CTRL),
MX6_PAD_ENET_CRS_DV__GPIO1_IO25 | MUX_PAD_CTRL(NO_PAD_CTRL),
MX6_PAD_RGMII_TXC__RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_RGMII_TD0__RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_RGMII_TD1__RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_RGMII_TD2__RGMII_TD2 | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_RGMII_TD3__RGMII_TD3 | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_RGMII_RXC__RGMII_RXC | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_RGMII_RD0__RGMII_RD0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_RGMII_RD1__RGMII_RD1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_RGMII_RD2__RGMII_RD2 | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_RGMII_RD3__RGMII_RD3 | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL),
};
//modify:添加初始化
int board_early_init_f(void)
{
volatile unsigned int i = 0x88888;
setup_iomux_uart();
setup_iomux_enet();
//reset_ar8035();
/* Reset AR8031 PHY */
gpio_direction_output(IMX_GPIO_NR(1, 25) , 0);
while(i--);//mdelay(10);
gpio_set_value(IMX_GPIO_NR(1, 25), 1);
//udelay(100);
return 0;
}
SD卡部分修改:
SD卡挂载在ESDHC2上
int board_mmc_init(bd_t *bis)
{
int ret;
u32 index = 0;
usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);//modify:修改为MXC_ESDHC2_CLK
usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
for (index = 0; index < CONFIG_SYS_FSL_USDHC_NUM; ++index) {
switch (index) {
case 0:
imx_iomux_v3_setup_multiple_pads(
usdhc2_pads, ARRAY_SIZE(usdhc2_pads));//modify:修改为 usdhc2_pads
break;
case 1:
imx_iomux_v3_setup_multiple_pads(
usdhc4_pads, ARRAY_SIZE(usdhc4_pads));
break;
default:
printf("Warning: you configured more USDHC controllers"
"(%d) then supported by the board (%d)\n",
index + 1, CONFIG_SYS_FSL_USDHC_NUM);
return -EINVAL;
}
ret = fsl_esdhc_initialize(bis, &usdhc_cfg[index]);
if (ret)
return ret;
}
return 0;
}
//modify:添加 usdhc2_pads
iomux_v3_cfg_t const usdhc2_pads[] = {
MX6_PAD_SD2_CLK__SD2_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD2_CMD__SD2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD2_DAT0__SD2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD2_DAT1__SD2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD2_DAT2__SD2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD2_DAT3__SD2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_GPIO_4__GPIO1_IO04 | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
};
//eMMC
iomux_v3_cfg_t const usdhc4_pads[] = {
MX6_PAD_SD4_CLK__SD4_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD4_CMD__SD4_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD4_DAT0__SD4_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD4_DAT1__SD4_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD4_DAT2__SD4_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD4_DAT3__SD4_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD4_DAT4__SD4_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD4_DAT5__SD4_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD4_DAT6__SD4_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD4_DAT7__SD4_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
};
struct fsl_esdhc_cfg usdhc_cfg[2] = {
{USDHC2_BASE_ADDR},//modify:修改 USDHC2_BASE_ADDR
{USDHC4_BASE_ADDR},
};
int board_mmc_getcd(struct mmc *mmc)
{
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
int ret;
if (cfg->esdhc_base == USDHC2_BASE_ADDR) {//modify:修改 USDHC2_BASE_ADDR
gpio_direction_input(IMX_GPIO_NR(1, 4));//modify:修改片选 IMX_GPIO_NR(1, 4)
ret = !gpio_get_value(IMX_GPIO_NR(1, 4));//modify:修改片选 IMX_GPIO_NR(1, 4)
} else if (cfg->esdhc_base == USDHC4_BASE_ADDR){
ret = 1;/* eMMC is always present */
}
else{
ret = -1;/* Don't have the CD GPIO pin on board */
}
return ret;
}
/* 此处不用修改
int board_mmc_get_env_dev(int devno)
{
return devno - 1;
}
*/
4.修改 include/configs/mx6qarm2.h
#define CONFIG_MXC_UART_BASE UART1_BASE
5、编译
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf- //arm-none-eabi-
make mx6qarm2_defconfig
make -j8
六、在uboot中查看uboot在emmc中的烧录位置和数据
1、切换到当前板子使用的boot分区 mmc bootpart
2、切换到boot分区:mmc dev 3 1
3、也可以通过命令设置启动分区到第一分区或其他分区:mmc dev 3 1
4、读取boot分区第三个block(uboot烧录是从第三个block开始)的数据到0x10800000中:mmc read 0x10800000 0x2 0x01
5、查看0x10800000内容,对比可知就是u-boot.bin的数据:md.b 0x10800000
七、在uboot中查看uImage在emmc中的烧录位置和数据
1、切换到0分区:mmc dev 3 0
2、读取0分区第2048个block(uImage烧录是从1M位置开始烧录)的数据到0x10800000中:mmc read 0x10800000 0x800 0x01
3、查看0x10800000内容,对比可知就是uImage的数据:md.b 0x10800000
八、在linux中查看uImage在emmc中的烧录位置和数据
1、mmcblk0p1:文件系统存放分区。
2、从emmc读入uImage的数据:dd if=/dev/mmcblk0 of=456 bs=1M skip=1 count=2
通过hexdump 456 -n 100可以知道和烧录的uImage数据一致。
3、从emmc读入u-boot.bin的数据: dd if=/dev/mmcblk0boot0 of=456 bs=512 skip=2 count=4
通过hexdump 456 -n 100可以知道和烧录的u-boot.bin数据一致。
linux中EMMC写入使能:echo 0 > /sys/block/mmcblk0boot0/force_ro
echo 0 > /sys/block/mmcblk0boot1/force_ro
echo 0 > /sys/block/mmcblk0/force_ro
//没有该分区echo 0 > /sys/block/mmcblk0p1/force_ro
linux中EMMC只读使能:echo 1 > /sys/block/mmcblk0boot0/force_ro
linux清除指令: dd if=/dev/zero of=/dev/mmcblk0p1 bs=1M count=1
dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=2
skip=xxx是在备份时对if 后面的部分也就是原文件跳过多少块再开始备份;
seek=xxx则是在备份时对of 后面的部分也就是目标文件跳过多少块再开始写。
九、uboot中通过指令烧录uboot
1、下载文件到内存:tftp 0x10800000 u-boot.imx
2、切换到uboot分区:mmc dev 3 1
3、烧录,根据u-boot.imx的大小确定块数:mmc write 0x10800000 2 2B6
十、编译内核
1、下载内核:git clone https://source.codeaurora.org/external/imx/linux-imx -b git.kernel.org/linux-stable/linux-4.18.y
git checkout imx_4.9.88_2.0.0_ga
2、修改 imx6q-arm2.dts
//modify:添加
pinctrl_uart1: uart1grp {
fsl,pins = <
MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA 0x1b0b1
MX6QDL_PAD_SD3_DAT6__UART1_RX_DATA 0x1b0b1
>;
};
&uart1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart1>;
status = "okay";
};
&usdhc2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usdhc2>;
bus-width = <4>;
cd-gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
wp-gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
status = "okay";
};
pinctrl_usdhc2: usdhc2grp {
fsl,pins = <
MX6QDL_PAD_SD2_CMD__SD2_CMD 0x17059
MX6QDL_PAD_SD2_CLK__SD2_CLK 0x10059
MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17059
MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059
MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059
MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17059
MX6QDL_PAD_NANDF_D4__SD2_DATA4 0x17059
MX6QDL_PAD_NANDF_D5__SD2_DATA5 0x17059
MX6QDL_PAD_NANDF_D6__SD2_DATA6 0x17059
MX6QDL_PAD_NANDF_D7__SD2_DATA7 0x17059
>;
};
//modify:删除 &usdhc3 节点和 pinctrl_usdhc3
//modify:修改网络接口节点
pinctrl_enet: enetgrp {
fsl,pins = <
MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0
MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0
MX6QDL_PAD_RGMII_TXC__RGMII_TXC 0x1b030
MX6QDL_PAD_RGMII_TD0__RGMII_TD0 0x1b030
MX6QDL_PAD_RGMII_TD1__RGMII_TD1 0x1b030
MX6QDL_PAD_RGMII_TD2__RGMII_TD2 0x1b030
MX6QDL_PAD_RGMII_TD3__RGMII_TD3 0x1b030
MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b030
MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0
MX6QDL_PAD_RGMII_RXC__RGMII_RXC 0x1b030
MX6QDL_PAD_RGMII_RD0__RGMII_RD0 0x1b030
MX6QDL_PAD_RGMII_RD1__RGMII_RD1 0x1b030
MX6QDL_PAD_RGMII_RD2__RGMII_RD2 0x1b030
MX6QDL_PAD_RGMII_RD3__RGMII_RD3 0x1b030
MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b030
MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8
>;
};
3.编译
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
make imx_v7_defconfig
make uImage LOADADDR=0x12000000
make imx6q-arm2.dtb
4、在新uboot中启动内核,挂载网络文件系统
4.1先设置网卡参数
ifconfig ens38 192.168.1.103 netmask 255.255.255.0
route add default gw 192.168.1.1
setenv ipaddr 192.168.1.106
setenv serverip 192.168.1.101
setenv ethaddr 32:34:46:78:9A:DC
setenv gatewayip 192.168.1.1
4.2读入内核&&挂载网络文件系统
setenv bootargs 'noinitrd console=ttymxc0,115200 root=/dev/nfs rw nfsroot=192.168.1.103:/home/lonnox/work/imx6/nfs_root,v3,tcp ip=192.168.1.6:192.168.1.103:192.168.1.1:255.255.255.0'
//setenv bootargs 'noinitrd console=ttymxc0,115200 root=/dev/nfs rw nfsroot=192.168.1.104:/home/lonnox/work/imx6/nfs_root,v3,tcp ip=192.168.1.106:192.168.1.104:192.168.1.1:255.255.255.0'
tftp 0x11ffffc0 uImage
tftp 0x18000000 imx6q-arm2.dtb
setenv bootargs ${bootargs}
bootm 0x11ffffc0 - 0x18000000
5、在新uboot中烧录uImage和imx6q-arm2.dtb
mmc dev 1 0
tftp 0x11ffffc0 uImage
mmc write 0x11ffffc0 0x800 0x4000
tftp 0x18000000 imx6q-arm2.dtb
mmc write 0x18000000 0x5000 0x800
setenv bootargs 'noinitrd console=ttymxc0,115200 loglevel=8 root=/dev/mmcblk3p1 rw init=/linuxrc'
setenv bootcmd 'mmc dev 1; mmc read 0x11ffffc0 0x800 0x4000; mmc read 0x18000000 0x5000 0x800; bootm 0x11ffffc0 - 0x18000000'
saveenv
run bootcmd
十一、制作文件系统
1、测试烧录老版本文件系统
mksdcard.sh /dev/mmcblk1
//mkfs.ext3 -j /dev/mmcblk1p1 //???一定要使用mkfs.ext3
mke2fs -j /dev/mmcblk1p1
mkdir -p /mnt/mmcblk1p0
mount -t ext3 /dev/mmcblk1p1 /mnt/mmcblk1p0
tar --numeric-owner -zxvf rootfs.tgz -C /mnt/mmcblk1p0
umount /mnt/mmcblk1p0