使用OpenWrt开发嵌入式Linux(四):创建分区

2019-07-13 02:05发布

创建分区非常简单,直接修改DTS文件:target/linux/samsung/dts/TQ210.dts &nand { status = "okay"; nand-ecc-mode = "soft"; partition@0 { label = "boot"; reg = <0x0 0x40000>; /* 246KB */ read-only; }; partition@40000 { label = "kernel"; reg = <0x40000 0x300000>; /* 3MB */ }; partition@340000 { label = "rootfs"; reg = <0x340000 0x3fcc0000>; /* 1020MB */ }; }; 这里给boot分区添加了只读属性:read-only 重新编译固件 make -j4 运行内核,将看到如下信息 [ 1.327161] 3 fixed-partitions partitions found on MTD device b0e00000.nand [ 1.327224] Creating 3 MTD partitions on "b0e00000.nand": [ 1.327278] 0x000000000000-0x000000040000 : "boot" [ 1.327892] 0x000000040000-0x000000340000 : "kernel" [ 1.328409] 0x000000340000-0x000040000000 : "rootfs" root@OpenWrt:/# cat /proc/mtd dev: size erasesize name mtd0: 00040000 00020000 "boot" mtd1: 00300000 00020000 "kernel" mtd2: 3fcc0000 00020000 "rootfs"