Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
12748 Discussions

Some probem in starting up kernel from U-Boot

Altera_Forum
Honored Contributor II
2,051 Views

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
0 Kudos
8 Replies
Altera_Forum
Honored Contributor II
888 Views

Hi all: 

Anyone can help me? Thank you in advance. 

 

I have fixed some above problem today. 

But,uClinux startup some new error info appears: 

Creating 1 MTD partitions on "RAM": 0x00000000-0x14005000 : "ROMfs" microtronix: set ROMfs to be root filesystem 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 VFS: Mounted root (cramfs filesystem) readonly. Freeing unused kernel memory: 60k freed (0x11b6000 - 0x11c4000) Warning: unable to open an initial console. Kernel panic - not syncing: No init found.  Try passing init= option to kernel.     

Maybe the filesystem has some problem ? 

I creat this filesystem under NIOSII IDE,and use mkcramfs to creat cramfs image. 

Is this way right? 

 

Looking forward to your reply.Thank you!  

 

Regards! 

Justin
0 Kudos
Altera_Forum
Honored Contributor II
888 Views

Hi Justin, 

 

> 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" 

... 

> And the device type in UP3 is TC58FVB106AFT-70. 

> Hope someone have a good way to fix it. 

 

The generic u-boot CFI code uses the toggle-bit rather than DQ7 polling ... so this causes problems on the 

avalon bus -- see: http://forum.niosforum.com/forum/index.php?act=st&f=2&t=2302 (http://forum.niosforum.com/forum/index.php?act=st&f=2&t=2302

 

I'm working on a patch that uses DQ7 polling ... I'll make a post when this is updated. In the mean time, 

you _should_ still be able to erase and program the flash using the u-boot command line using the 

protect, erase and cp commands. The saveenv fails because it attempts to write before the erase algorithm 

completes (the device is still busy). 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
888 Views

Hi Scott: 

Thanks you!When this flash utilities is completed, it's very convenience to download kernel and filesystem to flash. 

But now, i use the flash-program in NIOSII IDE to complete the flash function.Also it works good. 

So how to fix this kernel panic below, i try to fix it ,but no result.Hopefully you have a good idea:-) 

Thank you!  

 

Creating 1 MTD partitions on "RAM": 0x00000000-0x14005000 : "ROMfs" microtronix: set ROMfs to be root filesystem 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 VFS: Mounted root (cramfs filesystem) readonly. Freeing unused kernel memory: 60k freed (0x11b6000 - 0x11c4000) Warning: unable to open an initial console. Kernel panic - not syncing: No init found.  Try passing init= option to kernel. 

 

 

Best Regards! 

Justin
0 Kudos
Altera_Forum
Honored Contributor II
888 Views

Hi Justin, 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

Creating 1 MTD partitions on "RAM": 

0x00000000-0x14005000 : "ROMfs" 

microtronix[mtd]: set ROMfs to be root filesystem[/b] 

--- Quote End ---  

 

This looks incorrect. Your flash is only 2 MB ... if you are using the entire device your partition would be: 

0x0000_0000 - 0x0020_0000. 

 

You might want to create your own mtd map ... keep it simple at first -- use just a single partition. 

Once you have things working, you can add partitions and adjust as necessary. 

 

BTW: the reason for having partitions such as "loader/kernel", "safe configuration", etc. was (presumably) 

to provide (read or read/write) access to those partitions. But today, in many cases, the partitions appear 

to be created for documentation purposes, rather than for actual access ... since the designer never really 

intends to provide read or write access to such paritions. A good example is the "safe configuration" partition. 

In most cases, you won&#39;t need to read it ... and you certainly don&#39;t want to write it ... at least not with a 

user-space application. 

 

When creating your initial flash layout the extra partitions can cause unnecessary confusion. So, keep it 

simple at first: one partition, root device /dev/mtdblock0 -- it will save you some headaches. Once you 

have things working ... it&#39;s easy to adjust ;-) 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
888 Views

Hi all: 

 

Now the own mtd map is created, but there is the tired error info appears: 

  RAMDISK driver initialized: 8 RAM disks of 1024K size 1024 blocksize   UP3: mtd map: 00200000: 00200000 bytes   UP3: mtd map: virt: 00200000   Creating 1 MTD partitions on "UP3 Development Board":   0x00100000-0x00200000 : "cramfs"   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 17   VFS: Mounted root (cramfs filesystem) readonly.   Freeing unused kernel memory: 60k freed (0x1188000 - 0x1196000)   Warning: unable to open an initial console.   Kernel panic - not syncing: No init found.  Try passing init= option to kernel.    

As one partition, the Kernel command line is root=/dev/mtdblock0 ro. 

 

Hope someone have a good way to fix this problem. 

Thank you very much!:-) 

Best Regards! 

Justin
0 Kudos
Altera_Forum
Honored Contributor II
888 Views

Hi Justin, 

 

Please see: http://www.niosforum.com/forum/index.php?a...=st&f=18&t=2383 (http://www.niosforum.com/forum/index.php?act=st&f=18&t=2383

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

Freeing unused kernel memory: 60k freed (0x1188000 - 0x1196000) 

  Warning: unable to open an initial console. 

  Kernel panic - not syncing: no init found.  Try passing init= option to kernel.[/b] 

--- Quote End ---  

 

This is due to the bugs in the 1.4 fs/cramfs/inode.c. Basically, the code doesn&#39;t correctly access the offset and 

namelen bit fields in the cramfs_inode struct (as well as some others). Soooo ... it can&#39;t even create 

a good offset to the root directory inode from the superblock -- which is why the kernel can&#39;t even find the /dev/console. 

 

Anyway, see the URL above ... the fix is pretty simple. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
888 Views

 

--- Quote Start ---  

originally posted by smcnutt@Aug 25 2005, 06:19 PM 

hi justin, 

 

please see: http://www.niosforum.com/forum/index.php?a...=st&f=18&t=2383 (http://www.niosforum.com/forum/index.php?act=st&f=18&t=2383

<div class='quotetop'>quote  

--- quote end ---  

 

--- quote start ---  

freeing unused kernel memory: 60k freed (0x1188000 - 0x1196000) 

  warning: unable to open an initial console.[/b] 

  Kernel panic - not syncing: no init found.  Try passing init= option to kernel.[/b] 

--- Quote End ---  

 

This is due to the bugs in the 1.4 fs/cramfs/inode.c. Basically, the code doesn&#39;t correctly access the offset and 

namelen bit fields in the cramfs_inode struct (as well as some others). Soooo ... it can&#39;t even create 

a good offset to the root directory inode from the superblock -- which is why the kernel can&#39;t even find the /dev/console. 

 

Anyway, see the URL above ... the fix is pretty simple. 

 

Regards, 

--Scott 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=9280)</div> 

[/b] 

--- Quote End ---  

 

 

 

Hi Scott, 

The link is fail. Could you tell me how to fix this bug in detail? 

Regards, 

Sam
0 Kudos
Altera_Forum
Honored Contributor II
888 Views

Hi Sam, 

 

Here&#39;s the new link (the old ones don&#39;t work since the forum was updated): 

 

http://forum.niosforum.com/forum/index.php...wtopic=2383&hl= (http://forum.niosforum.com/forum/index.php?showtopic=2383&hl=

 

Regards, 

--Scott
0 Kudos
Reply