我想将kernel分区大小设为0x800000,所以环境变量里的mtdparts里设成0x800000了,但是启动内核后找不到mtd/block2分区,然后就去uboot里用mtdparts命令查看nand分区,结果kernel分区还是0x1400000大小。
请问,应该在编译linux内核时做哪些修改?
=> mtdparts
device nand0 <nand0>, # parts = 3
#: name size offset mask_flags
0: u-boot 0x00200000 0x00000000 0
1: kernel 0x01400000 0x00200000 0
2: user 0x06a00000 0x01600000 0
active partition: nand0,0 - (u-boot) 0x00200000 @ 0x00000000
defaults:
mtdids : nand0=nand0
mtdparts: mtdparts=nand0:0x200000@0x0(u-boot),0x1400000@0x200000(kernel),-(user)
=> printenv
baudrate=115200
bootargs=noinitrd root=/dev/mtdblock2 rootfstype=yaffs2 rootflags=inband-tags console=tty0 console=ttyS0,115200n8 rdinit=/sbin/init mem=64M mtdparts=nand0:0x200000@0x0(u-boot)ro,0x800000@0x200000(kernel)ro,-(user)
bootcmd=nboot 0x7fc0 0 0x200000; bootm 0x7fc0
bootdelay=1
ethact=emac
ethaddr=00:00:00:11:66:88
ipaddr=192.168.1.11
mtddevname=u-boot
mtddevnum=0
mtdids=nand0=nand0
mtdparts=mtdparts=nand0:0x200000@0x0(u-boot),0x1400000@0x200000(kernel),-(user)
partition=nand0,0
serverip=192.168.1.99
stderr=serial
stdin=serial
stdout=serial
内核make menuconfig时的这个选项是勾选了的。
Command line partition table parsing
最近编辑记录 Gentlepig (2023-01-12 16:27:39)
离线
那么先将跟文件系统烧录到0x16000000吧,结果kernel panic...
U-Boot 2016.11 (Jan 12 2023 - 15:23:13 +0800)
CPU: NUC972
Board: NUC972
DRAM: 64 MiB
NAND: 128 MiB
In: serial
Out: serial
Err: serial
Net: emac
Hit any key to stop autoboot: 0
Loading from nand0, offset 0x200000
Image Name: Linux-3.10.108
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1948600 Bytes = 1.9 MiB
Load Address: 00008000
Entry Point: 00008000
## Booting kernel from Legacy Image at 00007fc0 ...
Image Name: Linux-3.10.108
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1948600 Bytes = 1.9 MiB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
XIP Kernel Image ... OK
StartiBooting Linux on physical CPU 0x0
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Initializing cgroup subsys cpuacct
Linux version 3.10.108 (user@ubuntu) (gcc version 4.8.5 (Buildroot 2016.11.1-g7116cea) ) #4 PREEMPT Thu Jan 12 15:33:11 CST 2023
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: NUC970
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock2 rootfstype=yaffs2 rootflags=inband-tags console=tty0 console=ttyS0,115200n8 rdinit=/sbin/init mem=64M mtdparts=nand0:0x200000@0x0(u-boot)ro,0x800000@0x200000(kernel)ro,-(user)
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 60812k/60812k available, 4724k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xc4800000 - 0xff000000 ( 936 MB)
lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc0376eec (3516 kB)
.init : 0xc0377000 - 0xc03943b4 ( 117 kB)
.data : 0xc0396000 - 0xc03cdf60 ( 224 kB)
.bss : 0xc03cdf60 - 0xc0400b08 ( 203 kB)
SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Preemptible hierarchical RCU implementation.
NR_IRQS:625
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
Console: colour dummy device 80x30
console [tty0] enabled
console [ttyS0] enabled
Calibrating delay loop... 148.88 BogoMIPS (lpj=744448)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
Initializing cgroup subsys devices
Initializing cgroup subsys freezer
Initializing cgroup subsys perf_event
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0xc02c1df8 - 0xc02c1e34
devtmpfs: initialized
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
cfg80211: Calling CRDA to update world regulatory domain
NET: Registered protocol family 2
TCP established hash table entries: 512 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 512 bind 512)
TCP: reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
NetWinder Floating Point Emulator V0.97 (double precision)
msgmni has been set to 118
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
[nuc970fb_probe] 10
fb0: nuc970fb frame buffer device
nuc970-uart.0: ttyS0 at I/O 0x0 (irq = 36) is a NUC970
brd: module loaded
nuc970 mtd nand driver version: 20160331
NAND device: Manufacturer ID: 0xef, Chip ID: 0xf1 (Winbond NAND 128MiB 3,3V 8-bit), 128MiB, page size: 2048, OOB size: 64
nand: SMRA size 64, 32
Bad block table found at page 65472, version 0x01
Bad block table found at page 65408, version 0x01
3 cmdlinepart partitions found on MTD device nand0
Creating 3 MTD partitions on "nand0":
0x000000000000-0x000000200000 : "u-boot"
0x000000200000-0x000000a00000 : "kernel"
0x000000a00000-0x000008000000 : "user"
fmi-sm: registered successfully! mtdid=nand0
CAN device driver interface
nuc970-can0 nuc970-can0: nuc970_can0_platform device registered (regs=f800b000, irq=58)
nuc970-can1 nuc970-can1: nuc970_can1_platform device registered (regs=f800b400, irq=59)
libphy: nuc970_rmii0: probed
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci_nuc970_probe() - name: nuc970-ehci
nuc970-ehci nuc970-ehci: Nuvoton NUC970/N9H30 EHCI Host Controller
nuc970-ehci nuc970-ehci: new USB bus registered, assigned bus number 1
nuc970-ehci nuc970-ehci: irq 23, io mem 0xb0005000
nuc970-ehci nuc970-ehci: USB 2.0 started, EHCI 0.95
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
nuc970-ohci nuc970-ohci: Nuvoton NUC970/N9H30 OHCI Host Controller
nuc970-ohci nuc970-ohci: new USB bus registered, assigned bus number 2
nuc970-ohci nuc970-ohci: irq 24, io mem 0xb0007000
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
usbcore: registered new interface driver usb-storage
TCP: cubic registered
NET: Registered protocol family 17
can: controller area network core (rev 20120528 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20120528)
can: broadcast manager protocol (rev 20120528 t)
can: netlink gateway (rev 20130117) max_hops=1
yaffs: dev is 32505858 name is "mtdblock2" rw
yaffs: passed flags "inband-tags"
VFS: Mounted root (yaffs2 filesystem) on device 31:2.
devtmpfs: mounted
Freeing unused kernel memory: 116K
Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.108 #4
Backtrace:
[<c0011f44>] (dump_backtrace+0x0/0x10c) from [<c0012158>] (show_stack+0x18/0x1c)
r6:00000000 r5:c039fb88 r4:c032f8cc r3:00000000
[<c0012140>] (show_stack+0x0/0x1c) from [<c02bed68>] (dump_stack+0x20/0x28)
[<c02bed48>] (dump_stack+0x0/0x28) from [<c02bc9f0>] (panic+0xa4/0x1fc)
[<c02bc94c>] (panic+0x0/0x1fc) from [<c02bc46c>] (kernel_init+0x130/0x158)
r3:00000000 r2:00000001 r1:000002ff r0:c032f8cc
r7:00000000
[<c02bc33c>] (kernel_init+0x0/0x158) from [<c000ecf8>] (ret_from_fork+0x14/0x3c)
r5:c02bc33c r4:00000000
离线
貌似可以了,感觉是我烧写跟文件系统的地址搞错了,内核分区地址0x200000,大小0x800000。那么跟文件系统分区地址是0xa00000,结果我写成了0x1000000。
离线
内核留8M分区是不是有点小?
离线