0
点赞
收藏
分享

微信扫一扫

bootargs使用记录

颜路在路上 2022-04-04 阅读 29
linux

记录一下最近遇到的问题:

U-Boot中分区参数:

mtdparts=mtdparts=nand0:0x200000@0x0(u-boot),0x1400000@0x200000(kernel),-(user)

Kernel中分区参数:

static struct mtd_partition partitions[] = {
	{
		.name = "u-boot",
		.offset = 0,
		.size = 2 * 1024 * 1024,
		.ecclayout = (struct nand_ecclayout*)&nuc970_nand_oob
	},
	{
		.name = "kernel",
		.size = 20 * 1024 * 1024,
		.offset = MTDPART_OFS_APPEND,
		.ecclayout = (struct nand_ecclayout*)&nuc970_nand_oob
	},
	{
		.name = "user",
		.offset = MTDPART_OFS_APPEND,
		.size = MTDPART_SIZ_FULL
	}
};

刚开始使用的bootargs:

bootargs=ubi.mtd=2 root=ubi0:user rw mem=64M console=ttyS0,115200 noinitrd rootfstype=ubifs

内核启动显示:

// 开头省略 
Creating 3 MTD partitions on "nand0":
0x000000000000-0x000000200000 : "u-boot"
0x000000200000-0x000001600000 : "kernel"
0x000001600000-0x000008000000 : "user"
// 中间部分省略
UBIFS error (pid 1): ubifs_mount: cannot open "ubi0:user", error -19
VFS: Cannot open root device "ubi0:user" or unknown-block(0,0): error -19
Please append a correct "root=" boot option; here are the available partitions:
1f00            2048 mtdblock0  (driver?)
1f01           20480 mtdblock1  (driver?)
1f02          108544 mtdblock2  (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.108+ #16
Backtrace: 
[<c0011f40>] (dump_backtrace+0x0/0x10c) from [<c0012154>] (show_stack+0x18/0x1c)
 r6:c03c6970 r5:00008000 r4:c035f4f0 r3:00000000
[<c001213c>] (show_stack+0x0/0x1c) from [<c02ebbb0>] (dump_stack+0x20/0x28)
[<c02ebb90>] (dump_stack+0x0/0x28) from [<c02e974c>] (panic+0xa4/0x1fc)
[<c02e96a8>] (panic+0x0/0x1fc) from [<c03ae028>] (mount_block_root+0x230/0x2d8)
 r3:00000001 r2:00000000 r1:c3843ed8 r0:c035f4f0
 r7:c03c6960
[<c03addf8>] (mount_block_root+0x0/0x2d8) from [<c03ae2d4>] (prepare_namespace+0x98/0x1c0)
[<c03ae23c>] (prepare_namespace+0x0/0x1c0) from [<c03adc44>] (kernel_init_freeable+0x1d8/0x220)
 r6:c0403aa0 r5:00000007 r4:c03cae20
[<c03ada6c>] (kernel_init_freeable+0x0/0x220) from [<c02e90a8>] (kernel_init+0x10/0x158)
[<c02e9098>] (kernel_init+0x0/0x158) from [<c000ecf8>] (ret_from_fork+0x14/0x3c)
 r5:c02e9098 r4:00000000

 启动一直报error -19,网上看了一部分讲解都是说bootargs和分区名没对应。

直到看到:

=> ubi part user
ubi0: attaching mtd1
ubi0: scanning is finished
ubi0: attached mtd1 (name "mtd=2", size 106 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 848, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 799458905
ubi0: available PEBs: 0, total reserved PEBs: 848, PEBs reserved for bad PEB handling: 20
=> ubi info l
Volume information dump:
	vol_id          0
	reserved_pebs   824
	alignment       1
	data_pad        0
	vol_type        3
	name_len        6
	usable_leb_size 126976
	used_ebs        824
	used_bytes      104628224
	last_eb_bytes   126976
	corrupted       0
	upd_marker      0
	name            rootfs
Volume information dump:
	vol_id          2147479551
	reserved_pebs   2
	alignment       1
	data_pad        0
	vol_type        3
	name_len        13
	usable_leb_size 126976
	used_ebs        2
	used_bytes      253952
	last_eb_bytes   2
	corrupted       0
	upd_marker      0
	name            layout volume

把bootargs进行修改:

bootargs=ubi.mtd=2 root=ubi0:rootfs rw mem=64M console=ttyS0,115200 noinitrd rootfstype=ubifs

终于启动起来了,作为一个初学者,目前还不知所以然。

举报

相关推荐

0 条评论