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

/bin/init hangs

Altera_Forum
Honored Contributor II
1,639 Views

hi all, 

 

I am trying to boot uclinux on 2s60 board. where my kernel is hanging  

moment it calls /bin/init. I have build uclinux with changed memory layout 

where base addresses and irq number differs then default memory layout .sof and .ptf files 

given by microtronix. Also I have remover support for compact flash in my case. 

 

I can boot uclinux build from microtronix .sof and .ptf file on the board with similarly  

generated file system. I tried "root=/dev/mtdblock0 ro" as well as nfs boot with root=/dev/nfs ro, 

and seems fine (nfs boot init gives error with init: execv failed, but get login and prompt ok) . 

 

But when I give my memory layout sof and ptf file the compilation is successful but kernel 

get hangs when he calls /bin/init.  

 

Any one has any idea why it is happing so??? 

Do I need to build new busybox ??? 

Is it not possible to boot uclinux with custom memory layout on Altera boards ?? 

Do I need to change my quartus-II 4.2 and nios-II 1.1 versions ??? 

Any suggestion where I am going wrong ??? 

 

If any one need I can post my sof, ptf and nios2_system.h files. 

 

thanks in advance 

Ankur
0 Kudos
13 Replies
Altera_Forum
Honored Contributor II
512 Views

try the buildroot guide and work on a Linux box, it is easier to use and customize. 

http://forum.niosforum.com/forum/index.php?showtopic=3174 (http://forum.niosforum.com/forum/index.php?showtopic=3174)
0 Kudos
Altera_Forum
Honored Contributor II
512 Views

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

--- Quote Start ---  

But when I give my memory layout sof[/b] 

--- Quote End ---  

 

What dose it mean ? Could you post your *.ptf here? 

If kernel starts up and gives log messages, It seems your hardware(sof) is OK, so maybe there are mistakes in kernel config and rootfs.
0 Kudos
Altera_Forum
Honored Contributor II
512 Views

 

--- Quote Start ---  

originally posted by mountain8848@May 4 2006, 09:48 AM 

<div class='quotetop'>quote  

--- quote end ---  

 

--- quote start ---  

but when i give my memory layout sof 

--- Quote End ---  

 

What dose it meaning ? Could you post your *.ptf here? 

 

If kernel starts up and gives log messages, It seems your hardware(sof) is OK, so maybe there are mistakes in kernel config and rootfs. 

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

[/b] 

--- Quote End ---  

 

It might be problem in mtd maps. 

That&#39;s why, I would prefer using initramfs as a beginning. 

You can&#39;t success on nios2 uClinux without Linux knowhow. 

I realy feel it is totally wrong to develope Linux/uClinux on Windows.
0 Kudos
Altera_Forum
Honored Contributor II
512 Views

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

--- Quote Start ---  

But when I give my memory layout sof and ptf file the compilation is successful but kernel 

get hangs when he calls /bin/init.[/b] 

--- Quote End ---  

 

What is the last message of init? 

check etc/inittab in your rootfs. 

or you can used the sample inittab attached build0411.zip of buildroot guide.
0 Kudos
Altera_Forum
Honored Contributor II
512 Views

Hi all, 

 

It seems I have a similar problem with my 2c35 board.  

It&#39;s about one week I try to find a solution ... please HELP !!!! :-) 

 

The boot screen looks like that: 

 

Linux version 2.6.11-uc0 (fleconte@FRMTG01D57967) (gcc version 3.4.1 (Altera Ni 

s II 5.1 b73))# 12 Wed May 3 15:48:40 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: 256 (order: 8, 4096 bytes) 

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) 

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) 

Memory available: 30592k/32768k RAM, 0k/0k ROM (1531k kernel code, 302k data) 

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

NET: Registered protocol family 16 

JFFS2 version 2.2. © 2001-2003 Red Hat, Inc. 

Serial: JTAG UART driver $Revision: 1.4 $ 

ttyJ0 at MMIO 0x822208b0 (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 

smc_probe: 85000 Khz Nios 

SMSC LAN91C111 Driver (v2.1), (Linux Kernel 2.6) 

eth0: SMC91C11xFD(rev:2) at 0x82210300 IRQ:6 MEMSIZE:8192b NOWAIT:0 ADDR: 00:07 

ed:0f:07:74 

smc_probe: 85000 Khz Nios 

Altera NDK flash (AMD): Found 1 x16 devices at 0x0 in 8-bit bank 

Amd/Fujitsu Extended Query Table at 0x0040 

Altera NDK flash (AMD): 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 Altera NDK partition definition 

Creating 4 MTD partitions on "Altera NDK flash (AMD)": 

0x00400000-0x00c00000 : "romfs/jffs2" 

0x00000000-0x00400000 : "loader/kernel" 

0x00c00000-0x00d00000 : "User configuration" 

0x00d00000-0x01000000 : "safe configuration" 

NET: Registered protocol family 2 

IP: routing cache hash table of 512 buckets, 4Kbytes 

TCP established hash table entries: 2048 (order: 2, 16384 bytes) 

TCP bind hash table entries: 2048 (order: 1, 8192 bytes) 

TCP: Hash tables configured (established 2048 bind 2048) 

NET: Registered protocol family 1 

NET: Registered protocol family 17 

VFS: Mounted root (romfs filesystem) readonly. 

Freeing unused kernel memory: 60k freed (0x41aa000 - 0x41b8000) 

Kernel panic - not syncing: No init found. Try passing init= option to kernel.
0 Kudos
Altera_Forum
Honored Contributor II
512 Views

 

--- Quote Start ---  

originally posted by lefred@May 4 2006, 07:53 PM 

hi all, 

 

it seems i have a similar problem with my 2c35 board.  

it&#39;s about one week i try to find a solution ... please help !!!! :-) 

 

the boot screen looks like that: 

 

linux version 2.6.11-uc0 (fleconte@frmtg01d57967) (gcc version 3.4.1 (altera ni 

s ii 5.1 b73))# 12 wed may 3 15:48:40 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: 256 (order: 8, 4096 bytes) 

dentry cache hash table entries: 8192 (order: 3, 32768 bytes) 

inode-cache hash table entries: 4096 (order: 2, 16384 bytes) 

memory available: 30592k/32768k ram, 0k/0k rom (1531k kernel code, 302k data) 

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

net: registered protocol family 16 

jffs2 version 2.2. © 2001-2003 red hat, inc. 

serial: jtag uart driver $revision: 1.4 $ 

ttyj0 at mmio 0x822208b0 (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 

smc_probe: 85000 khz nios 

smsc lan91c111 driver (v2.1), (linux kernel 2.6) 

eth0: smc91c11xfd(rev:2) at 0x82210300 irq:6 memsize:8192b nowait:0 addr: 00:07 

ed:0f:07:74 

smc_probe: 85000 khz nios 

altera ndk flash (amd): found 1 x16 devices at 0x0 in 8-bit bank 

amd/fujitsu extended query table at 0x0040 

altera ndk flash (amd): 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 altera ndk partition definition 

creating 4 mtd partitions on "altera ndk flash (amd)": 

0x00400000-0x00c00000 : "romfs/jffs2" 

0x00000000-0x00400000 : "loader/kernel" 

0x00c00000-0x00d00000 : "user configuration" 

0x00d00000-0x01000000 : "safe configuration" 

net: registered protocol family 2 

ip: routing cache hash table of 512 buckets, 4kbytes 

tcp established hash table entries: 2048 (order: 2, 16384 bytes) 

tcp bind hash table entries: 2048 (order: 1, 8192 bytes) 

tcp: hash tables configured (established 2048 bind 2048) 

net: registered protocol family 1 

net: registered protocol family 17 

vfs: mounted root (romfs filesystem) readonly. 

freeing unused kernel memory: 60k freed (0x41aa000 - 0x41b8000) 

kernel panic - not syncing: no init found.  try passing init= option to kernel. 

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

--- quote end ---  

 

--- Quote End ---  

 

The best suggestion, 

try the buildroot guide and work on a Linux box, it is easier to use and customize. 

http://forum.niosforum.com/forum/index.php?showtopic=3174 (http://forum.niosforum.com/forum/index.php?showtopic=3174)
0 Kudos
Altera_Forum
Honored Contributor II
512 Views

hi hippo, lefred and all, 

 

I saw lefred linux boot dump which is different than mine. In my case 

I get these prints... 

 

VFS: Mounted root (nfs filesystem) 

Freeing unused kernel memory: 64k freed (0xxxxxx - 0xxxxxx)#  

 

 

I am able to get prompt "#" and it gets hang, i.e. Counter on seven segment 

display get stop and led glow freezes. 

 

But before going into some more discussion first let us try buildroot !!! 

 

thanks 

Ankur
0 Kudos
Altera_Forum
Honored Contributor II
512 Views

Some suggestions: 

 

1. Sometimes the kernel can&#39;t necessarily detect what the filesystem type is on flash so you might add rootfstype=jffs2 or whatever filesystem type you are using to the kernel commandline. 

 

2. You may not have compiled in the block driver for flash so you need to have at the very least the CONFIG_MTD_BLOCK=y in your .config file. 

 

3. The kernel also needs to have the filesystem type used compiled into it.
0 Kudos
Altera_Forum
Honored Contributor II
512 Views

hi hippo and all, 

 

I am facing some issues while running ./build script for buildroot. 

looks like nios2-linux-uclinux-gcc is missing in my case. 

 

I can&#39;t make out where I went wrong, could you please just have look  

over the error print and kindly help me out of this problem. 

 

 

 

 

cp toolchain/uClibc/uClibc.config /mnt/hdb/package/buildroot/toolchain_build_nios2/uClibc/.config /mnt/hdb/package/buildroot/toolchain_build_nios2/bin/sed -i -e &#39;s,^CROSS_COMPILER_PREFIX=.*,CROSS_COMPILER_PREFIX="/mnt/hdb/package/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-",g&#39;     -e &#39;s,# TARGET_nios2 is not set,TARGET_nios2=y,g&#39;     -e &#39;s,^TARGET_ARCH="none",TARGET_ARCH=\"nios2\",g&#39;     -e &#39;s,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"/mnt/hdb/package/buildroot/toolchain_build_nios2/linux\",g&#39;     -e &#39;s,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g&#39;     -e &#39;s,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/usr/\",g&#39;     -e &#39;s,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX=\"/lib\",g&#39;     /mnt/hdb/package/buildroot/toolchain_build_nios2/uClibc/.config /mnt/hdb/package/buildroot/toolchain_build_nios2/bin/sed -i -e &#39;s,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g&#39; /mnt/hdb/package/buildroot/toolchain_build_nios2/uClibc/.config /mnt/hdb/package/buildroot/toolchain_build_nios2/bin/sed -i -e &#39;s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g&#39; /mnt/hdb/package/buildroot/toolchain_build_nios2/uClibc/.config /mnt/hdb/package/buildroot/toolchain_build_nios2/bin/sed -i -e &#39;s,# UCLIBC_HAS_THREADS is not set,UCLIBC_HAS_THREADS=y,g&#39; /mnt/hdb/package/buildroot/toolchain_build_nios2/uClibc/.config /mnt/hdb/package/buildroot/toolchain_build_nios2/bin/sed -i -e &#39;s,# PTHREADS_DEBUG_SUPPORT is not set,PTHREADS_DEBUG_SUPPORT=y,g&#39; /mnt/hdb/package/buildroot/toolchain_build_nios2/uClibc/.config /mnt/hdb/package/buildroot/toolchain_build_nios2/bin/sed -i -e &#39;s,# LINUXTHREADS_OLD is not set,LINUXTHREADS_OLD=y,g&#39; /mnt/hdb/package/buildroot/toolchain_build_nios2/uClibc/.config mkdir -p /mnt/hdb/package/buildroot/toolchain_build_nios2/uClibc_dev/usr/include mkdir -p /mnt/hdb/package/buildroot/toolchain_build_nios2/uClibc_dev/usr/lib mkdir -p /mnt/hdb/package/buildroot/toolchain_build_nios2/uClibc_dev/lib make -C /mnt/hdb/package/buildroot/toolchain_build_nios2/uClibc PREFIX=/mnt/hdb/package/buildroot/toolchain_build_nios2/uClibc_dev/ DEVEL_PREFIX=/usr/ RUNTIME_PREFIX=/mnt/hdb/package/buildroot/toolchain_build_nios2/uClibc_dev/ HOSTCC="gcc"     pregen install_dev && touch /mnt/hdb/package/buildroot/toolchain_build_nios2/uClibc/.configured /bin/sh: line 1: /mnt/hdb/package/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-gcc: No such file or directory make: /mnt/hdb/package/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-gcc: Command not found make: Entering directory `/mnt/hdb/package/buildroot/toolchain_build_nios2/uClibc&#39; make: /mnt/hdb/package/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-gcc: Command not found HB¸0make -C extra/config conf /bin/sh: line 1: /mnt/hdb/package/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-gcc: No such file or directory make: /mnt/hdb/package/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-gcc: Command not found HB¨make: /mnt/hdb/package/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-gcc: Command not found `B`Bmake: *** No rule to make target `|&#39;, needed by `../../extra/config/conf.o&#39;.  Stop. make: *** Error 2 make: Leaving directory `/mnt/hdb/package/buildroot/toolchain_build_nios2/uClibc&#39; make: *** Error 2 

 

----------------------------------------------------------------------------------------------- 

 

 

 

Is there any thing else I need to download for running buildroot ??? 

 

I have downloaded all the packages (snapshots) from my windows m/c as I am not familier with wget [my sys wget is not able to resolve web addr !!!].... etc. 

 

thanks 

ankur
0 Kudos
Altera_Forum
Honored Contributor II
512 Views

which linux distro do you use? 

 

check your buildroot/build_nios2/staging_dir/bin, 

are there the cross gcc? 

 

I would suggest you put the buildroot dir in your home dir as user. ie ~/buildroot . 

 

please try, rm -rf ~/buildroot/toolchain_build_nios2 

and make again.
0 Kudos
Altera_Forum
Honored Contributor II
512 Views

 

--- Quote Start ---  

originally posted by hippo@May 7 2006, 02:54 AM 

which linux distro do you use? 

 

check your buildroot/build_nios2/staging_dir/bin, 

are there the cross gcc? 

 

i would suggest you put the buildroot dir in your home dir as user. ie ~/buildroot . 

 

please try, rm -rf  ~/buildroot/toolchain_build_nios2 

and make again. 

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

--- quote end ---  

 

--- Quote End ---  

 

 

hi hippo and all, 

 

I am using redhat - 9 on my host system for develop. 

Cross gcc is not there in buildroot/build_nios2/staging_dir/bin.... 

 

Now I have shifted buidroot dir in my home dir but still its failing with same error... 

 

I read that redhat-9 "make" has some problem ... do I need to update my host system linux-ver to some Fedora version. 

 

Do I need to build cross-uclibc-gcc by my self or buildroot will do it for me ???? 

 

thanks 

Ankur
0 Kudos
Altera_Forum
Honored Contributor II
512 Views

 

--- Quote Start ---  

originally posted by ankur+may 8 2006, 04:22 pm--><div class='quotetop'>quote (ankur @ may 8 2006, 04:22 pm)</div> 

--- quote start ---  

<!--quotebegin-hippo@May 7 2006, 02:54 AM 

which linux distro do you use? 

 

check your buildroot/build_nios2/staging_dir/bin, 

are there the cross gcc? 

 

i would suggest you put the buildroot dir in your home dir as user. ie ~/buildroot . 

 

please try, rm -rf  ~/buildroot/toolchain_build_nios2 

and make again. 

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

--- quote end ---  

 

--- Quote End ---  

 

 

hi hippo and all, 

 

I am using redhat - 9 on my host system for develop. 

Cross gcc is not there in buildroot/build_nios2/staging_dir/bin.... 

 

Now I have shifted buidroot dir in my home dir but still its failing with same error... 

 

I read that redhat-9 "make" has some problem ... do I need to update my host system linux-ver to some Fedora version. 

 

Do I need to build cross-uclibc-gcc by my self or buildroot will do it for me ???? 

 

thanks 

Ankur 

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

[/b] 

--- Quote End ---  

 

The "make" of redhat is too old. 

You should use Fedora Core 5. 

 

The buildroot will build the cross gcc. 

 

I have prepared the binary buildroot tools, you can try it without building buildroot. 

http://forum.niosforum.com/forum/index.php?showtopic=3879 (http://forum.niosforum.com/forum/index.php?showtopic=3879)
0 Kudos
Altera_Forum
Honored Contributor II
512 Views

hi hippo and all, 

 

I tried your binaries and it worked http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif  

 

What I actually did is ... on my redhat-9 system I untared your pre compiled gcc and stuff, then through your already build file system&#39;s help I build my kernel and it worked perfectly fine. 

 

I can now see file system in ram file system boot. But still facing some issues with nfs root .... 

 

It doesn&#39;t look like any problem with buildroot or file system .... 

 

I am getting following error while booting same kernel with nfs boot support enable  

 

mm/vmscan.c 736 Kernel BUG! 

mm/vmscan.c 738 Kernel BUG! 

 

 

What I found is I have enabled bit swaping feature in my nios processor in fpga configuration. Next I will try disabling it and will update result on forum. 

 

Thanks for all your help  

 

Ankur
0 Kudos
Reply