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

How to make the uclinux boot faster?

Altera_Forum
Honored Contributor II
1,780 Views

Sash command shell (version 1.1.1) 

/> 

Uncompressing Linux... Uncompressing Linux... Ok, booting the kernel. 

[ 0.000000] Linux version 2.6.30 (root@localhost.localdomain) (gcc version 3. 

4.6)# 956 PREEMPT Mon Aug 30 15:38:18 CST 2010 

[ 0.000000]  

[ 0.000000] 

[ 0.000000] uClinux/Nios II 

[ 0.000000] Built 1 zonelists in Zone order, mobility grouping off. Total pa 

ges: 4064 

[ 0.000000] Kernel command line: 

[ 0.000000] NR_IRQS:32 

[ 0.000000] PID hash table entries: 64 (order: 6, 256 bytes) 

[ 0.000000] Dentry cache hash table entries: 2048 (order: 1, 8192 bytes) 

[ 0.000000] Inode-cache hash table entries: 1024 (order: 0, 4096 bytes) 

[ 0.010000] Memory available: 12612k/3486k RAM, 0k/0k ROM (1776k kernel code, 

1710k data) 

[ 0.050000] Calibrating delay loop... 37.06 BogoMIPS (lpj=185344) 

[ 0.240000] Mount-cache hash table entries: 512 

[ 0.310000] net_namespace: 264 bytes 

[ 0.320000] NET: Registered protocol family 16 

[ 0.330000] init_BSP(): registering device resources 

[ 0.370000] bio: create slab <bio-0> at 0 

[ 0.420000] NET: Registered protocol family 2 

[ 0.420000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes) 

[ 0.430000] TCP established hash table entries: 512 (order: 0, 4096 bytes) 

[ 0.430000] TCP bind hash table entries: 512 (order: -1, 2048 bytes) 

[ 0.430000] TCP: Hash tables configured (established 512 bind 512) 

[ 0.430000] TCP reno registered 

[ 0.440000] NET: Registered protocol family 1 

[ 7.560000] JFFS2 version 2.2. (NAND) &#28431; 2001-2006 Red Hat, Inc. 

[ 7.600000] io scheduler noop registered 

[ 7.600000] io scheduler deadline registered (default) 

[ 7.660000] ttyS0 at MMIO 0x1801160 (irq = 4) is a Altera UART 

[ 7.660000] console [ttyS0] enabled 

[ 7.670000] dm9000 Ethernet Driver, V1.31 

[ 7.800000] eth0 (dm9000): not using net_device_ops yet 

[ 7.810000] eth0: dm9000 at 81002100,81002108 IRQ 1 MAC: 00:07:ed:0a:03:08 (c 

hip) 

[ 7.840000] m25p80 spi0.0: m25p64 (8192 Kbytes) 

[ 7.850000] Creating 4 MTD partitions on "m25p80": 

[ 7.850000] 0x000000000000-0x000000400000 : "fpga configuration" 

[ 7.880000] 0x000000400000-0x000000500000 : "romfs/config" 

[ 7.900000] 0x000000500000-0x000000600000 : "romfs/app" 

[ 7.920000] 0x000000600000-0x000000800000 : "loader/kernel" 

[ 7.940000] TCP cubic registered 

[ 7.950000] NET: Registered protocol family 17 

[ 7.970000] RPC: Registered udp transport module. 

[ 7.970000] RPC: Registered tcp transport module. 

[ 8.020000] Freeing unused kernel memory: 1460k freed (0x21fa000 - 0x2366000) 

 

 

between the  

[ 0.440000] NET: Registered protocol family 1 

and 

[ 7.560000] JFFS2 version 2.2. (NAND) &#28431; 2001-2006 Red Hat, Inc. 

 

it delayed 7 second ?  

why ? 

how to reduce the wait time ? 

 

is there any other way to let the system start faster?
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
697 Views

i set  

initcall_debug=1  

in  

int do_one_initcall(initcall_t fn) 

function,and found the start info like this: 

[ 0.570000] calling 0x21de508 @ 1 

[ 7.640000] initcall 0x21de508 returned 0 after 6901126 usecs 

and in system.map file : 

021de508 t populate_rootfs 

 

is it populate_rootfs function have some problem ? 

0 Kudos
Altera_Forum
Honored Contributor II
697 Views

Are you using JFFS2 as your boot filesystem? If so this is known to be quite slow.  

 

I had great luck speeding up booting by leaving the kernel uncompressed in flash. The time to copy into RAM was increased by 2 seconds to about 4 seconds but the decompression took about 6 seconds. You can do this by using the vmlinux file in the kernel directory under uClinux directory. 

 

If you are using initramfs make sure that if you are using compression you only use one on the entire kernel or on the filesystem. You can change the initramfs filesystem compression by going to the linux kernel configuration under general setup, Built-in initramfs compression mode and setting it to none.
0 Kudos
Altera_Forum
Honored Contributor II
697 Views

How do you make vmlinux bootable? It seems that the default boot loader wants to uncompress whatever is in the Flash. 

 

After taking out the initramfs, I created the soft.flash image using the following command: 

 

elf2flash --base=0x06000000 --end=0x06ffffff --reset=0x06300000 --input=vmlinux --output=soft.flash --boot=$SOPC_KIT_NIOS2/components/altera_nios2/boot_loader_cfi.srec 

 

Then I wrote soft.flash to Flash. If I try to open the nios2-terminal, there is a partial message: "Uncompres" nothing else after that. 

 

I'm using the NEEK board to test this out. 

 

Thanks
0 Kudos
Altera_Forum
Honored Contributor II
697 Views

If you are seeing the "Uncompressing Linux" or the beginning as it appears to be than it seems like it is still the compressed version. For my system the uncompressed kernel is located at "uClinux-dist/linux-2.6.x/vmlinux". I would try to use "nios2-download -g vmlinux" and see if that works with the file first before starting to rewrite flash. You can see the code that prints out that line in "uClinux-dist/../linux-2.6.x/arch/nios2/boot/compressed/misc.c" 

 

The bootloader provided by Altera doesn't actually decompress anything. The CFI bootloader just starts copying the data from flash to the correct locations in RAM based on a simple header where the first 4 bytes indicate the size to copy (if 0 then this is a jump record, if 0xFFFFFFFF then a halt record since the flash is probably erased), the next 4 are the address to copy or jump to, followed by the data. This process is described in App Note: 458 http://www.altera.com/literature/an/an458.pdf
0 Kudos
Reply