Altera_Forum
Honored Contributor
20 years agoSome probem in starting up kernel from U-Boot
Hi all:
With Scott's great help,i have succeed in building the U-Boot for my UP3 board. Use the new CFI code in the latest u-boot code__http://www.psyent.com/download But the flash utilities have some problem,when using the command "saveevn" ==> protect off 1:0-6 Un-Protect Flash Sectors 0-6 in Bank# 1 ==> erase 1:0-6 Erase Flash Sectors 0-6 in Bank# 1 ....... done ==> loadb 0 # # Ready for binary (kermit) download to 0x00000000 at 115200 bps... # # Total Size = 0x0001180d = 71693 Bytes # # Start Addr = 0x00000000 ==> cp.b 0 00200000 1180d Copy to Flash... done ==> saveevn Saving Environment to Flash... Un-Protected 1 sectors Erasing Flash... . done Erased 1 sectors Writing to Flash... Flash not Erased Protected 1 sectors Q1: This flash problem i really have no way to fix. And the device type in UP3 is TC58FVB106AFT-70. Hope someone have a good way to fix it. Fortunately, i used another way to store U-Boot in the flash device.Just as this below: I just use the flash-program in NIOSII IDE to download the U-Boot,following "Nios II Flash Programmer User Guide" Then U-Boot is stored in the flash device and running automatically when the CPU/board is reset. However this way to download kernel has problem,i don't know why... So i use nios2-download command in IDE SDK SHELL to download the kernel. [SOPC Builder]$ nios2-download -g vmlinux Using cable "ByteBlasterII [LPT1]", device 1, instance 0x00 Pausing target processor: OK Downloaded 1642KB in 39.7s (41.3KB/s) Verified OK Starting processor at address 0x01000000 -------Then the kernel startu in U-Boot-----------------------uClinux/Nios II
Altera Nios II support (C) 2004 Microtronix Datacom Ltd.
Built 1 zonelists
Kernel command line: root=/dev/mtdblock0 ro
PID hash table entries: 64 (order: 6, 1024 bytes)
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory available: 6360k/8192k RAM, 0k/0k ROM (1397k kernel code, 314k data)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
NET: Registered protocol family 16
NIOS serial driver version 0.0
ttyS0 (irq = 2) is a builtin NIOS UART
Serial: JTAG UART driver $Revision: 1.3 $
ttyJ0 at MMIO 0x80020820 (irq = 0) is a jtag_uart
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
Using anticipatory io scheduler
Altera NDK flash (AMD): Found 1 x16 devices at 0x0 in 8-bit bank
Amd/Fujitsu Extended Query Table at 0x0040
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
cmdlinepart partition parsing not available
RedBoot partition parsing not available
Using Altera NDK partition definition
Creating 4 MTD partitions on "Altera NDK flash (AMD)":
0x00200000-0x00600000 : "romfs/jffs2"
mtd: partition "romfs/jffs2" is out of reach -- disabled
0x00000000-0x00200000 : "loader/kernel"
0x00600000-0x00700000 : "User configuration"
mtd: partition "User configuration" is out of reach -- disabled
0x00700000-0x00800000 : "safe configuration"
mtd: partition "safe configuration" is out of reach -- disabled
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 1024)
NET: Registered protocol family 1
NET: Registered protocol family 17
end_request: I/O error, dev mtdblock0, sector 2
EXT2-fs: unable to read superblock
end_request: I/O error, dev mtdblock0, sector 0
FAT: unable to read boot sector
VFS: Cannot open root device "mtdblock0" or unknown-block(31,0)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,0) It seems that i should write my own mapping driver,modify this files: altera.c, microtronix.c and the nios_romfs.c in drivers/mtd/maps But i don't know how to modify this parameters in a good way. My flash store size is 2MBytes. U-Boot size:70KBytes Kernel size: 14373810bytes (vmlinux,creat from NIOSII IDE) Howevery i try it this way: altera.c # else
{
.name = "romfs/jffs2",
.size = 0x0A80000,
.offset = 0x100000,
},{
.name = "loader/kernel",
.size = 0x0FFFFF,
.offset = 0,
}, {
.name = "User configuration",
.size = 0x010000,
.offset = 0x1A90000,
}, {
.name = "safe configuration",
.size = 0x010000,
.offset = 0x1AB0000,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}# endif
nios_romfs.c int __init microtronix_mtd_init(void)
{
struct mtd_info *mtd;
struct map_info *mapp;
unsigned long addr = na_flash_kernel + 0x0;
...
microtronix.c static struct mtd_partition microtronix_partitions = {
{
.name = "romfs",
.size = 0xA80000,
.offset = 0x100000,
},{
.name = "loader/kernel",
.size = 0x100000,
.offset = 0,
}
};
Then rebuild this kernel,download vmlinux again: Some differen info below: uClinux/Nios II
Altera Nios II support (C) 2004 Microtronix Datacom Ltd.
Built 1 zonelists
Kernel command line: root=/dev/mtdblock0 ro
PID hash table entries: 64 (order: 6, 1024 bytes)
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory available: 6344k/8192k RAM, 0k/0k ROM (1403k kernel code, 325k data)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
NET: Registered protocol family 16
NIOS serial driver version 0.0
ttyS0 (irq = 2) is a builtin NIOS UART
Serial: JTAG UART driver $Revision: 1.4 $
ttyJ0 at MMIO 0x80020820 (irq = 0) is a jtag_uart
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
Microtronix map: Found 1 x16 devices at 0x0 in 16-bit bank
Amd/Fujitsu Extended Query Table at 0x0040
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
cmdlinepart partition parsing not available
RedBoot partition parsing not available
Using Microtronix development partition definition
Creating 2 MTD partitions on "Microtronix map":
0x00100000-0x00b80000 : "romfs"
mtd: partition "romfs" extends beyond the end of device "Microtronix map" -- size truncated to 0x100000
0x00000000-0x00100000 : "loader/kernel"
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
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)
NET: Registered protocol family 1
NET: Registered protocol family 17
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,0)
Q2: What's above info say,the flash in UP3 is not supported in the kernel..? How to set up a flash partition map? How to modify this parameters to suit my board. Q3: Are there another better way to build kernel?I build it in IDE.This way right? Q4: I has been created the cramfs filesystem. So how to launch or load this filesystem to kernel,should modify some file in drivers/mtd/maps? Q5: As the U-Boot flash utilities has some problem, are there another ways to download the kernel to flash? Thank you very much! Regards! Justin