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

Problem booting latest version of nios2 uClinux

Altera_Forum
Honored Contributor II
2,082 Views

I have the latest version of nios2 uClinux using the dts file created from sopcinfo. I never see the "Uncompressing Linux... Ok, booting the kernel." message before the Linux startup. This leads me to believe the file system is not being extracted to the memory. Does anyone know what would be causing this? 

 

Linux version 3.4.0+ (root@server) (gcc version 4.1.2)# 360 PREEMPT Wed May 23 12:29:37 EDT 2012 bootconsole enabled early_console initialized at 0xf0008d20 On node 0 totalpages: 32768 free_area_init_node: node 0, pgdat c846314c, node_mem_map c8476280 DMA zone: 256 pages used for memmap DMA zone: 0 pages reserved DMA zone: 32512 pages, LIFO batch:7 pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768 pcpu-alloc: 0 Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512 Kernel command line: debug console=ttyAL0,115200 init=/bin/init PID hash table entries: 512 (order: -1, 2048 bytes) Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) Memory available: 125344k/4557k RAM (1953k kernel code, 2603k data) NR_IRQS:64 Calibrating delay loop... 30.31 BogoMIPS (lpj=151552) pid_max: default: 32768 minimum: 301 Mount-cache hash table entries: 512 NET: Registered protocol family 16 bio: create slab <bio-0> at 0 Switching to clocksource timer NET: Registered protocol family 2 IP route cache hash table entries: 1024 (order: 0, 4096 bytes) TCP established hash table entries: 4096 (order: 3, 32768 bytes) TCP bind hash table entries: 4096 (order: 2, 16384 bytes) TCP: Hash tables configured (established 4096 bind 4096) 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 jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc. io scheduler noop registered io scheduler deadline registered (default) ttyAL0 at MMIO 0x10008d20 (irq = 5) is a Altera UART console enabled, bootconsole disabled console enabled, bootconsole disabled spi_altera 10007c00.spi: master is unqueued, this is deprecated m25p80 spi32766.0: found m25p64, expected m25p80 m25p80 spi32766.0: m25p64 (8192 Kbytes) spi_altera 10007c00.spi: base f0007c00, irq 4 altera_tse-mdio: probed eth0: Altera TSE MAC at 0xf0008400 irq 2/1 eth0: Reporting available PHYs: eth0: PHY with ID 0x20005c7a at 0x1 altera_tse-mdio: probed eth1: Altera TSE MAC at 0xf0008800 irq 7/6 eth1: Reporting available PHYs: TCP: cubic registered NET: Registered protocol family 17 Freeing unused kernel memory: 2308k freed (0xc81ea000 - 0xc842b000) Failed to execute /init Failed to execute /bin/init. Attempting defaults... Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
0 Kudos
14 Replies
Altera_Forum
Honored Contributor II
669 Views

Hi,  

 

 

--- Quote Start ---  

I never see the "Uncompressing Linux... Ok, booting the kernel." message before the Linux startup. This leads me to believe the file system is not being extracted to the memory 

--- Quote End ---  

 

 

Did you download the compressed kernel with your "Root File System"? 

 

Freeing unused kernel memory: 2308k freed (0xc81ea000 - 0xc842b000) Failed to execute /init Failed to execute /bin/init. Attempting defaults... Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.  

 

The kernel only says "I can't find 'init' program". Did you confirm that your program includes it? 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
669 Views

 

--- Quote Start ---  

The kernel only says "I can't find 'init' program". Did you confirm that your program includes it? 

 

--- Quote End ---  

 

 

The zImage built from the romfs directory has the init in both the / and the /bin directories.
0 Kudos
Altera_Forum
Honored Contributor II
669 Views

Hi, 

 

 

--- Quote Start ---  

The zImage built from the romfs directory has the init in both the / and the /bin directories. 

--- Quote End ---  

 

 

And where did you store those, initrd, initramfs or jffs2 ? 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
669 Views

 

--- Quote Start ---  

And where did you store those, initrd, initramfs or jffs2 ? 

--- Quote End ---  

 

 

The initramfs files are in the uClinux-dist/linux-2.6.x/usr directory. This directory contains the initramfs_data.cpio which is mountable under linux and shows all the files in the romfs directory.
0 Kudos
Altera_Forum
Honored Contributor II
669 Views

Hi, 

 

 

--- Quote Start ---  

The initramfs files are in the uClinux-dist/linux-2.6.x/usr directory. This directory contains the initramfs_data.cpio which is mountable under linux and shows all the files in the romfs directory. 

--- Quote End ---  

 

 

And which file did you download? Maybe, you have many files in your 'Image' directory. And What message does your 'make' say in the last part of build process?  

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
669 Views

 

--- Quote Start ---  

And which file did you download? 

--- Quote End ---  

 

 

There are two files in the images directory. 

 

romfs-inst.log (2353 bytes) 

zImage (3293581 bytes) 

 

After uploading the SOF file I upload the zImage file to the FPGA. 

 

 

--- Quote Start ---  

And What message does your 'make' say in the last part of build process? 

--- Quote End ---  

 

 

make ARCH=nios2 -C vendors image make: Entering directory `/root/nios2-linux/uClinux-dist/vendors' make -C /root/nios2-linux/uClinux-dist/vendors/Altera/nios2/. dir_v=/root/nios2-linux/uClinux-dist/vendors/Altera/nios2/. -f /root/nios2-linux/uClinux-dist/vendors/vendors-common.mak image make: Entering directory `/root/nios2-linux/uClinux-dist/vendors/Altera/nios2' || mkdir -p /root/nios2-linux/uClinux-dist/images chmod -R +x /root/nios2-linux/uClinux-dist/romfs/bin rm /root/nios2-linux/uClinux-dist/linux-2.6.x/usr/initramfs_data.cpio.gz LDFLAGS="" make ARCH=nios2 CROSS_COMPILE=nios2-linux-gnu- -C /root/nios2-linux/uClinux-dist/../linux-2.6 O=/root/nios2-linux/uClinux-dist/linux-2.6.x zImage make: Entering directory `/root/nios2-linux/linux-2.6' Using /root/nios2-linux/linux-2.6 as source for kernel GEN /root/nios2-linux/uClinux-dist/linux-2.6.x/Makefile CHK include/linux/version.h CHK include/generated/utsrelease.h CALL /root/nios2-linux/linux-2.6/scripts/checksyscalls.sh cc1: warning: include location "/usr/local/include" is unsafe for cross-compilation CHK include/generated/compile.h GEN usr/initramfs_data.cpio.gz AS usr/initramfs_data.o cc1: warning: include location "/usr/local/include" is unsafe for cross-compilation LD usr/built-in.o DTC arch/nios2/boot/system.dtb DTC: dts->dtb on file "/root/nios2-linux/linux-2.6/../linux-2.6/arch/nios2/boards/wim_mmu/wim.dts" AS arch/nios2/boot/linked_dtb.o cc1: warning: include location "/usr/local/include" is unsafe for cross-compilation LD arch/nios2/boot/built-in.o LD vmlinux.o MODPOST vmlinux.o GEN .version CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o cc1: warning: include location "/usr/local/include" is unsafe for cross-compilation LD init/built-in.o LD vmlinux SYSMAP System.map OBJCOPY arch/nios2/boot/vmlinux.bin GZIP arch/nios2/boot/vmlinux.gz LD arch/nios2/boot/compressed/piggy.o LD arch/nios2/boot/compressed/vmlinux OBJCOPY arch/nios2/boot/zImage Kernel: arch/nios2/boot/zImage is ready make: Leaving directory `/root/nios2-linux/linux-2.6' cp /root/nios2-linux/uClinux-dist/linux-2.6.x/arch/nios2/boot/zImage /root/nios2-linux/uClinux-dist/images/zImage make: Leaving directory `/root/nios2-linux/uClinux-dist/vendors/Altera/nios2' make: Leaving directory `/root/nios2-linux/uClinux-dist/vendors'
0 Kudos
Altera_Forum
Honored Contributor II
669 Views

Hi, 

 

Maybe you have uncompressed kernel 'vmlinux' somewhere, please read the elf header by 'nios2-*****-readelf' -a vmlimux > ***. If you see the section '.init.ramfs' etc. and it has enough size, then I think that it's time for 'kernel debuging'. There are several popular method, 'printk' or gdb..... 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
669 Views

There is no .init.ramfs in the section headers after running the "nios2-linux-gnu-readelf -a vmlinux" command. Is this the problem?

0 Kudos
Altera_Forum
Honored Contributor II
669 Views

Hi, 

 

 

--- Quote Start ---  

There is no .init.ramfs in the section headers after running the "nios2-linux-gnu-readelf -a vmlinux" command. Is this the problem? 

--- Quote End ---  

 

 

Maybe. Please search where your root file system is linked. In general, the linker do this automatically, so please check your 'Makefile' and 'linker script' again. 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
669 Views

What linker script are you referring to? I do not see any links to the root file system. I also tried uploading the vmlinux file to the FPGA but it gives the same error message as before. Has anyone built the latest version of uClinux for NIOS2 and has it working?

0 Kudos
Altera_Forum
Honored Contributor II
669 Views

Hi, 

 

 

--- Quote Start ---  

What linker script are you referring to? I do not see any links to the root file system.  

--- Quote End ---  

 

 

Please search the file 'vmlinux.lds' or 'vmlimux.lds.S'. It's the linker script, and you will find the linking position of 'init.ramfs'. 

 

 

--- Quote Start ---  

I also tried uploading the vmlinux file to the FPGA but it gives the same error message as before.  

--- Quote End ---  

 

 

It's quite natural when your kernel does not include 'init.ramfs'. The files zImage etc. are only compressed ones of 'vmlinux'. 

 

 

--- Quote Start ---  

Has anyone built the latest version of uClinux for NIOS2 and has it working? 

--- Quote End ---  

 

 

At least, the maintainers do it. And of course, you select 'Initial RAM filesystem' in the menuconfig like 

&#9472; General setup --> Create deprecated sysfs layout for older userspace tools Kernel->user space relay support (formerly relayfs) Namespaces support Initial RAM filesystem and RAM disk (initramfs/initrd) suppor () Initramfs source file(s) Support initial ramdisks compressed using gzip Support initial ramdisks compressed using bzip2 Support initial ramdisks compressed using LZMA

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
669 Views

Hi, 

 

 

--- Quote Start ---  

There are two vmlinux.lds files in the linux-2.6.x directory. The file in the arch/nios2/boot/compressed does not have the .init.ramfs reference. The file in the arch/nios2/kernel does have the .init.ramfs reference. 

 

--- Quote End ---  

 

 

You must use the linker script which contains the .init.ramfs reference. 

 

 

--- Quote Start ---  

 

Also, I have to configure the "Initramfs source file(s)" in the menuconfig "General setup" with "../romfs ../vendors/Altera/nios2/romfs_list" or I get this error message. 

 

No filesystem could mount root, tried: Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) 

--- Quote End ---  

 

 

Of course, your downloaded program does not contain the 'root file system'. Maybe, your linking process causes these errors. 

 

Kazu
0 Kudos
Altera_Forum
Honored Contributor II
669 Views

I have an older version of uClinux 2.6.35 that compiles and uploads to the FPGA with this SOPC design. I compared the linker scripts with the old uClinux version and the new uClinux version and there is not much difference between the files. I don't see any problems with the linker scripts. Do you have any other suggestions? 

 

Uncompressing Linux... Ok, booting the kernel. Linux version 2.6.35-00743-ge3b9b64-dirty (root@server) (gcc version 4.1.2)# 2127 Fri Jan 13 14:47:19 EST 2012 bootconsole enabled early_console initialized at 0xf0007120 Linux/Nios II-MMU init_bootmem_node(?,0x83c9, 0x8000, 0x10000) free_bootmem(0x83c9000, 0x7c37000) reserve_bootmem(0x83c9000, 0x1000) Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512 Kernel command line: PID hash table entries: 512 (order: -1, 2048 bytes) Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) We have 65536 pages of RAM Memory available: 126060k/3875k RAM, 0k/0k ROM (1692k kernel code, 2183k data) Hierarchical RCU implementation. RCU-based detection of stalled CPUs is disabled. Verbose stalled-CPUs detection is disabled. NR_IRQS:32 Calibrating delay loop... 30.51 BogoMIPS (lpj=152576) pid_max: default: 32768 minimum: 301 Mount-cache hash table entries: 512 NET: Registered protocol family 16 init_BSP(): registering device resources bio: create slab <bio-0> at 0 Switching to clocksource timer NET: Registered protocol family 2 IP route cache hash table entries: 1024 (order: 0, 4096 bytes) TCP established hash table entries: 4096 (order: 3, 32768 bytes) TCP bind hash table entries: 4096 (order: 2, 16384 bytes) TCP: Hash tables configured (established 4096 bind 4096) 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 JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc. ROMFS MTD (C) 2007 Red Hat, Inc. msgmni has been set to 246 io scheduler noop registered io scheduler deadline registered io scheduler cfq registered (default) ttyS0 at MMIO 0x10007120 (irq = 5) is a Altera UART console enabled, bootconsole disabled console enabled, bootconsole disabled m25p80 spi0.0: found m25p64, expected m25p80 m25p80 spi0.0: m25p64 (8192 Kbytes) Creating 2 MTD partitions on "m25p80": 0x000000780000-0x000000800000 : "romfs/jffs2" 0x000000000000-0x000000780000 : "fpga configuration" Altera TSE MII Bus: probed Found PHY with ID=0x20005c7a at address=0x1 Altera Triple Speed MAC IP Driver(v8.0) developed by SLS,August-2008 Altera SFP TSE MII Bus: probed Found PHY with ID=0x20005c7a at address=0x0 Altera SFP Triple Speed MAC IP Driver(v8.0) developed by SLS,August-2008 TCP cubic registered NET: Registered protocol family 17 Freeing unused kernel memory: 1724k freed (0xc81a8000 - 0xc8356000) Welcome to ____ _ _ / __| ||_| _ _| | | | _ ____ _ _ _ _ | | | | | | || | _ \| | | |\ \/ / | |_| | |__| || | | | | |_| |/ | ___\____|_||_|_| |_|\____|\_/\_/ | | |_| For further information check: http://www.uclinux.org/ BusyBox v1.18.2 (2012-01-12 12:55:58 EST) hush - the humble shell Enter 'help' for a list of built-in commands. /#
0 Kudos
Altera_Forum
Honored Contributor II
669 Views

Did you resolve this issue, I also have the problem that zImage doesn't contain .init.ramfs reference when using nios2-linux-readelf -a zImage.  

 

I would appreciate any hints on why the linker doesn't do this automatically (isn't it supposed to?)
0 Kudos
Reply