Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Valued Contributor III
1,111 Views

uClinux Boot problem

Hi, 

 

I am testing my own custom board with EP1C12Q240, Flash=16bit*4M, Sdram=32bit*2M. 

My system has NiosII/f Core, uart, jtag-uart, sdram, flash, epcs_controller, timer and some PIOs. 

I use U-Boot to boot uClinux of Microtronix 1.4.  

When I run bootm command to boot uClinux, there display 

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

--- Quote Start ---  

==> bootm 0x50000 

# # Booting image at 00050000 ... 

   Image Name:   Linux Kernel Image 

   Image Type:   Nios-II Linux Kernel Image (gzip compressed) 

   Data Size:    458311 Bytes = 447.6 kB 

   Load Address: 00800000 

   Entry Point:  00800000 

   Verifying Checksum ... OK 

   Uncompressing Kernel Image ... OK 

Linux version 2.6.11-uc0 (LiangYi@ciitec-liangyi) (gcc version 3.4.1 (Altera Nios II 5.0 b73))# 1 Thu Feb 23 15:45:58 2006 

 

 

 

uClinux/Nios II 

Altera Nios II support © 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: 7016k/8192k RAM, 0k/0k ROM (850k kernel code, 206k data) 

Mount-cache hash table entries: 512 (order: 0, 4096 bytes) 

Linux NoNET1.0 for Linux 2.6 

NIOS serial driver version 0.0 

ttyS0 (irq = 3) is a builtin NIOS 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 

Microtronix map: CFI does not contain boot bank location. Assuming top. 

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

0x00200000-0x00800000 : "romfs" 

0x00000000-0x00200000 : "loader/kernel" 

VFS: Mounted root (romfs filesystem) readonly. 

Freeing unused kernel memory: 52k freed (0x8f0000 - 0x8fc000) 

expand: from=/ramfs.img to=/dev/ram0 

expand: from=/ramfs.img to=/dev/ram1 

SIOCSIFADDR=-1: 9 

SIOCGIFFLAGS = -1: Bad file descriptor (9) 

SIOCADDRT=-1: 9 

Unable to create socket 

close on exec: : Bad file descriptor 

setsockopt: : Function not implemented 

Unable to bind server socket: : Function not implemented 

Unable to listen to socket 

Unable to create socket 

close on exec: : Bad file descriptor 

setsockopt: : Function not implemented 

Unable to bind server socket: : Function not implemented 

Unable to listen to socket 

Unable to create socket 

close on exec: : Bad file descriptor 

setsockopt: : Function not implemented 

Unable to bind server socket: : Function not implemented 

Unable to listen to socket[/b] 

--- Quote End ---  

 

I do not know What is wrong? 

 

I use NiosII-IDE to generate vmlinux.bin and romfs.bin and do 

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

--- Quote Start ---  

$ gzip -9 vmlinux.bin 

$ mkimage -A nios2 -O linux -T kernel -C gzip -a 0x00800000 -e 0x00800000 -n &#39;Linux Kernel Image&#39; -d vmlinux.bin.gz uImage.img 

$ bin2flash –flash=U5 –location=0x00050000 –input=uImage.img –output=uImage.flash 

$ nios2-flash-programmer –base=0x00800000 –input=uImage.flash –sof=<path to pgm sof> 

 

$ bin2flash --flash=U5 --location=0x00200000 --input=romfs.bin --output=romfs.flash 

$ nios2-flash-programmer –base=0x00800000 –input=romfs.flash –sof=<path to pgm sof>[/b] 

--- Quote End ---  

 

 

Then, run bootm and display above. Can someone help me? 

 

BTW, another question. When I use  

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

--- Quote Start ---  

$ mkimage -A nios2 -O linux -T filesystem -C none -a 0x00a00000 -e 0x00a00000 -n &#39;romfs&#39; -d romfs.bin romfs.img 

$ bin2flash --flash=U5 --location=0x00200000 --input=romfs.img --output=romfs.flash 

$ nios2-flash-programmer –base=0x00800000 –input=romfs.flash –sof=<path to pgm sof>[/b] 

--- Quote End ---  

 

 

There display 

 

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

--- Quote Start ---  

uClinux/Nios II 

Altera Nios II support © 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: 7016k/8192k RAM, 0k/0k ROM (850k kernel code, 206k data) 

Mount-cache hash table entries: 512 (order: 0, 4096 bytes) 

Linux NoNET1.0 for Linux 2.6 

NIOS serial driver version 0.0 

ttyS0 (irq = 3) is a builtin NIOS 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 

Microtronix map: CFI does not contain boot bank location. Assuming top. 

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

0x00200000-0x00800000 : "romfs" 

0x00000000-0x00200000 : "loader/kernel" 

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,0)[/b] 

--- Quote End ---  

 

I do not know what different between these two method and which is correct for me and how to deal with the problem. 

 

Thank you, 

LiangYi
0 Kudos
11 Replies
Highlighted
Valued Contributor III
7 Views

Hi LiangYi, 

 

The first error you&#39;re getting  

SIOCSIFADDR=-1: 9 SIOCGIFFLAGS = -1: Bad file descriptor (9) SIOCADDRT=-1: 9 Unable to create socket close on exec: : Bad file descriptor setsockopt: : Function not implemented Unable to bind server socket: : Function not implemented Unable to listen to socket Unable to create socket close on exec: : Bad file descriptor setsockopt: : Function not implemented Unable to bind server socket: : Function not implemented Unable to listen to socket Unable to create socket close on exec: : Bad file descriptor setsockopt: : Function not implemented Unable to bind server socket: : Function not implemented Unable to listen to socket 

Is (probably) due to the fact that you haven&#39;t compiled in an ethernet driver (And from what I read you don&#39;t have one so that&#39;s perfectly OK) but the standard rc file in the ramfs.img tries to configure ethernet (SIOCSIFADDR=-1: 9 SIOCGIFFLAGS = -1: Bad file descriptor (9) SIOCADDRT=-1: 9) and then tries to start the inet deamon and maybe dhcpc (Don&#39;t know exactly, I don&#39;t use the standard rc file anymore). That&#39;s what the socket errors are from. 

 

I expect your system boots fine even though it&#39;s complaining. Make sure to enable your lo device (loopback network). 

When you "fix" the rc file (/etc/rc) you&#39;re system should run fine &#153;. 

 

Regarding the second error: no idea.... 

 

Hope you get it running! 

Walter Goossens
0 Kudos
Highlighted
Valued Contributor III
7 Views

Hi LiangYi, 

 

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

--- Quote Start ---  

BTW, another question. When I use <div class='quotetop'>QUOTE  

--- Quote End ---  

 

--- Quote Start ---  

 

$ mkimage -a nios2 -o linux -t filesystem -c none -a 0x00a00000 -e 0x00a00000 -n &#39;romfs&#39; -d romfs.bin romfs.img 

$ bin2flash --flash=U5 --location=0x00200000 --input=romfs.img --output=romfs.flash 

$ nios2-flash-programmer –base=0x00800000 –input=romfs.flash –sof=<path to pgm sof>[/b] 

--- Quote End ---  

[/b] 

--- Quote End ---  

 

Don&#39;t use mkimage -- it adds an &#39;image&#39; header to your romfs image ... which the 

kernel knows nothing about. Just use bin2flash and the flash programmer as you 

normally would. In most cases, mkimage is used only for the kernel itself ... since 

u-boot for Nios does not support separate kernel/ramdisk image files at this time. 

 

Regards, 

--Scott
0 Kudos
Highlighted
Valued Contributor III
7 Views

Hi Walter, 

 

Thank you for your reply. 

I have no ethernet device, but do I need networking support? 

Otherwise, How can I "fix" the rc file of Microtronix Linux 1.4? 

 

I have re-configured the kernel with networking support but have not select any ethernet device. When I boot kernel, the Unable to listen to socket error disappear, but stop here 

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

--- Quote Start ---  

uClinux/Nios II 

Altera Nios II support © 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: 6368k/8192k RAM, 0k/0k ROM (1407k kernel code, 297k data) 

Mount-cache hash table entries: 512 (order: 0, 4096 bytes) 

NET: Registered protocol family 16 

NIOS serial driver version 0.0 

ttyS0 (irq = 3) is a builtin NIOS 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 

Microtronix map: CFI does not contain boot bank location. Assuming top. 

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

0x00200000-0x00800000 : "romfs" 

0x00000000-0x00200000 : "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 

VFS: Mounted root (romfs filesystem) readonly. 

Freeing unused kernel memory: 60k freed (0x98a000 - 0x998000) 

expand: from=/ramfs.img to=/dev/ram0 

expand: from=/ramfs.img to=/dev/ram1[/b] 

--- Quote End ---  

 

Here cursor holdup and can not run anymore. 

Why? 

 

Thank you, 

LiangYi
0 Kudos
Highlighted
Valued Contributor III
7 Views

Hi LiangYi, 

 

It seems to have problems in MTD. 

 

It should be easier if you follow my buildroot guide, 

http://forum.niosforum.com/forum/index.php?showtopic=3174 (http://forum.niosforum.com/forum/index.php?showtopic=3174

It does not need romfs, ramdrive, cfi, or mtd to boot. 

 

tschmelcher had a post about u-boot to be used with it, 

http://forum.niosforum.com/forum/index.php?showtopic=3253 (http://forum.niosforum.com/forum/index.php?showtopic=3253)
0 Kudos
Highlighted
Valued Contributor III
7 Views

Hi All, 

 

Does nobody help me? 

 

I read the start-up text and find that 

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

--- Quote Start ---  

RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize[/b] 

--- Quote End ---  

 

Here, I do not know why use RAMDISK driver, I also can not find it during Kernel config. 

Then, display 

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

--- Quote Start ---  

VFS: Mounted root (romfs filesystem) readonly. 

Freeing unused kernel memory: 64k freed (0x99c000 - 0x9ab000) 

expand: from=/ramfs.img to=/dev/ram0 

expand: from=/ramfs.img to=/dev/ram1[/b] 

--- Quote End ---  

 

Here, I know romfs has been mounted. But, ramfs.img can not be expanded. So, the boot process can not continue anymore. I do not know why here can not be expanded.  

Can help me? 

 

Thank you, 

LiangYi
0 Kudos
Highlighted
Valued Contributor III
7 Views

Hi LiangYi, 

 

> Does nobody help me? 

 

I&#39;ll try once more ... 

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

--- Quote Start ---  

VFS: Mounted root (romfs filesystem) readonly. 

Freeing unused kernel memory: 64k freed (0x99c000 - 0x9ab000) 

expand: from=/ramfs.img to=/dev/ram0 

expand: from=/ramfs.img to=/dev/ram1[/b] 

--- Quote End ---  

 

> Here, I know romfs has been mounted. But, ramfs.img can not be expanded. 

 

From your earlier post: 

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

--- Quote Start ---  

$ mkimage -A nios2 -O linux -T filesystem -C none -a 0x00a00000 -e 0x00a00000 -n &#39;romfs&#39; -d romfs.bin romfs.img[/b] 

--- Quote End ---  

 

Are you using mkimage to create your ramfs.img file? 

 

--Scott
0 Kudos
Highlighted
Valued Contributor III
7 Views

As was suggested by wgoossens, the problem should be in the etc/rc after mounting all fs. 

Try findfile for the etc/rc. 

Try comment out all that after mounts, eg ifattach, inetd, boa...
0 Kudos
Highlighted
Valued Contributor III
7 Views

Hi Scott, 

 

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

--- Quote Start ---  

Are you using mkimage to create your ramfs.img file?[/b] 

--- Quote End ---  

 

I have tried this before, but display <div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

Kernel Panic:......[/b] 

--- Quote End ---  

. So, I now do not use mkimage and directly program the romfs.flash(has been transfered from romfs.bin). Then display above I described. 

 

Hi hippo, 

 

I can not find etc/rc anywhere. Can you tell me where it is in Microtronix Linux directory? 

 

Thany you, 

LiangYi
0 Kudos
Highlighted
Valued Contributor III
7 Views

LiangYi, 

Sorry, I don&#39;t use IDE/cygwin. A lot of people have trouble with it, too. 

Repeat again, add a PC to run Linux. It would save you a lot of time/life.
0 Kudos
Highlighted
Valued Contributor III
7 Views

Hi hippo, 

Thank you. But now, I want to implement booting uClinux under IDE, then I will try to do it under Linux. I will ask you question later. 

 

I retry booting without U-Boot, just follow Microtronix&#39;s Quick Guide, it is OK.  

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

--- Quote Start ---  

Linux version 2.6.11-uc0 (LiangYi@ciitec-liangyi) (gcc version 3.4.1 (Altera Nios II 5.0 b73))# 4 Tue Mar 7 16:04:58 2006 

 

uClinux/Nios II 

Altera Nios II support © 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: 6552k/8192k RAM, 0k/0k ROM (1259k kernel code, 263k data) 

Mount-cache hash table entries: 512 (order: 0, 4096 bytes) 

NET: Registered protocol family 16 

NIOS serial driver version 0.0 

ttyS0 (irq = 3) is a builtin NIOS UART 

Serial: JTAG UART driver $Revision: 1.4 $ 

ttyJ0 at MMIO 0x82000800 (irq = 1) 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 

Microtronix map: CFI does not contain boot bank location. Assuming top. 

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

0x00200000-0x00800000 : "romfs" 

0x00000000-0x00200000 : "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 

VFS: Mounted root (romfs filesystem) readonly. 

Freeing unused kernel memory: 60k freed (0x960000 - 0x96e000) 

expand: from=/ramfs.img to=/dev/ram0 

expand: from=/ramfs.img to=/dev/ram1 

 

/etc/issue                         www.microtronix.com           June 2005 

                             welcom to Linux on the Nios II 

Nios2 login:[/b] 

--- Quote End ---  

 

Next, I try with U-Boot. I follow the step 

Build U-Boot and download to flash 0x0 

Use vmlinux.bin -> mkimage(not gzip) -> bin2flash(location=0x50000) -> download 

Use romfs.bin -> bin2flash(location=0x200000) -> download 

Run 

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

--- Quote Start ---  

==> bootm 0x50000 

# # Booting image at 00050000 ... 

   Image Name:   Linux Kernel Image 

   Image Type:   Nios-II Linux Kernel Image (uncompressed) 

   Data Size:    1504864 Bytes =  1.4 MB 

   Load Address: 00800000 

   Entry Point:  00800000 

   Verifying Checksum ... OK 

OK 

Linux version 2.6.11-uc0 (LiangYi@ciitec-liangyi) (gcc version 3.4.1 (Altera Nios II 5.0 b73))# 4 Tue Mar 7 16:04:58 2006 

 

uClinux/Nios II 

Altera Nios II support © 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: 6552k/8192k RAM, 0k/0k ROM (1259k kernel code, 263k data) 

Mount-cache hash table entries: 512 (order: 0, 4096 bytes) 

NET: Registered protocol family 16 

NIOS serial driver version 0.0 

ttyS0 (irq = 3) is a builtin NIOS UART 

Serial: JTAG UART driver $Revision: 1.4 $ 

ttyJ0 at MMIO 0x82000800 (irq = 1) 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 

Microtronix map: CFI does not contain boot bank location. Assuming top. 

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

0x00200000-0x00800000 : "romfs" 

0x00000000-0x00200000 : "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 

VFS: Mounted root (romfs filesystem) readonly. 

Freeing unused kernel memory: 60k freed (0x960000 - 0x96e000) 

expand: from=/ramfs.img to=/dev/ram0 

expand: from=/ramfs.img to=/dev/ram1 

Cursor wink here, but nothing displays. Then, I type anything from keypad and all can be displayed in the terminal where cursor wink. Why?[/b] 

--- Quote End ---  

 

So, I want to ask if U-Boot has some settings involved in Kernel of Filesystem Booting and make this happen. 

 

Thank you, 

LiangYi
0 Kudos
Highlighted
Valued Contributor III
7 Views

Why do you want to use u-boot with IDE?

0 Kudos