Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
760 Views

How to make initramfs smaller

This is what I get after compilation of kernel 

 

nios2-linux/uClinux-dist/images: 

 

-rwxrwxr-x. 1 lukasz lukasz 6592577 Jan 29 17:19 linux.initramfs.gz 

-rw-rw-r--. 1 lukasz lukasz 8903168 Jan 29 17:18 rootfs.initramfs 

-rw-rw-r--. 1 lukasz lukasz 26566 Jan 29 17:18 rootfs.initramfs.contents 

-rw-rw-r--. 1 lukasz lukasz 3505996 Jan 29 17:18 rootfs.initramfs.gz 

-rw-r--r--. 1 lukasz lukasz 549708 Jan 29 17:19 System.map.initramfs.gz 

-rw-r--r--. 1 lukasz lukasz 1112191 Jan 29 17:18 vmImage 

-rwxrwxr-x. 1 lukasz lukasz 3090497 Jan 29 17:18 vmlinux 

lrwxrwxrwx. 1 lukasz lukasz 19 Jan 29 17:19 zImage -> zImage.initramfs.gz 

-rwxrwxr-x. 1 lukasz lukasz 4620775 Jan 29 17:19 zImage.initramfs.gz 

 

 

 

 

Does anyone know what I need to remove to make initramfs smaller? I can not boot this kernel on 8MB SDRAM. Or maybe this is not reason of my problem?  

 

Booting stops on:  

 

Linux version 2.6.35-00743-ge3b9b64-dirty (lukasz@centos) (gcc version 4.1.2)# 129 Tue Jan 29 17:12:52 CET 2013 

bootconsole [early0] enabled 

early_console initialized at 0xe18014a0 

 

 

 

 

Linux/Nios II-MMU 

init_bootmem_node(?,0xdbd, 0x800, 0x1000) 

free_bootmem(0xdbd000, 0x243000) 

reserve_bootmem(0xdbd000, 0x100) 

Built 1 zonelists in Zone order, mobility grouping off. Total pages: 2032 

Kernel command line:  

PID hash table entries: 32 (order: -5, 128 bytes) 

Dentry cache hash table entries: 1024 (order: 0, 4096 bytes) 

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

We have 4096 pages of RAM 

Memory available: 2232k/5873k RAM, 0k/0k ROM (1862k kernel code, 4011k data) 

Hierarchical RCU implementation. 

RCU-based detection of stalled CPUs is disabled. 

Verbose stalled-CPUs detection is disabled. 

NR_IRQS:32 

Calibrating delay loop... 24.21 BogoMIPS (lpj=121088) 

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: 512 (order: 0, 4096 bytes) 

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

TCP: Hash tables configured (established 512 bind 512) 

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 

RPC: Registered udp transport module. 

RPC: Registered tcp transport module. 

RPC: Registered tcp NFSv4.1 backchannel transport module. 

 

 

When I use images/vmlinux I get this: 

 

 

Linux version 2.6.35-00743-ge3b9b64-dirty (lukasz@centos) (gcc version 4.1.2)# 130 Tue Jan 29 17:18:35 CET 2013 

bootconsole [early0] enabled 

early_console initialized at 0xe18014a0 

 

 

 

 

Linux/Nios II-MMU 

init_bootmem_node(?,0xa69, 0x800, 0x1000) 

free_bootmem(0xa69000, 0x597000) 

reserve_bootmem(0xa69000, 0x100) 

Built 1 zonelists in Zone order, mobility grouping off. Total pages: 2032 

Kernel command line:  

PID hash table entries: 32 (order: -5, 128 bytes) 

Dentry cache hash table entries: 1024 (order: 0, 4096 bytes) 

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

We have 4096 pages of RAM 

Memory available: 5640k/2465k RAM, 0k/0k ROM (1872k kernel code, 592k data) 

Hierarchical RCU implementation. 

RCU-based detection of stalled CPUs is disabled. 

Verbose stalled-CPUs detection is disabled. 

NR_IRQS:32 

Calibrating delay loop... 24.21 BogoMIPS (lpj=121088) 

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: 512 (order: 0, 4096 bytes) 

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

TCP: Hash tables configured (established 512 bind 512) 

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 

RPC: Registered udp transport module. 

RPC: Registered tcp transport module. 

RPC: Registered tcp NFSv4.1 backchannel transport module. 

msgmni has been set to 16 

Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254) 

io scheduler noop registered 

io scheduler deadline registered 

io scheduler cfq registered (default) 

ttyJ0 at MMIO 0x18014a0 (irq = 1) is a Altera JTAG UART 

console [ttyJ0] enabled, bootconsole disabled 

console [ttyJ0] enabled, bootconsole disabled 

ttyS0 at MMIO 0x1801420 (irq = 2) is a Altera UART 

dm9000 Ethernet Driver, V1.31 

dm9000 dm9000.0: eth%d: Invalid ethernet MAC address. Please set using ifconfig 

eth0: dm9000a at e18014a8,e18014ac IRQ 4 MAC: 00:00:00:00:00:00 (chip) 

mice: PS/2 mouse device common for all mice 

TCP cubic registered 

NET: Registered protocol family 17 

List of all partitions: 

No filesystem could mount root, tried:  

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
0 Kudos
5 Replies
Altera_Forum
Honored Contributor I
41 Views

I think you are going to need to cut out a whole load of device drivers - both ones built into the linux kernel and the loadable ones in initramfs. 

You'll also need to cut down some of the large hash tables that linux keeps gaining. 

I suspect it is a long time since anyone in the linux community actually tried to run in 8MB.
Altera_Forum
Honored Contributor I
41 Views

As I see I have to much data: (1862k kernel code, 4011k data) 

 

I removed all device drivers from the kernel configuration. And have still 3991k data. You said to remove loadable ones in initramfs. How to do it?
Altera_Forum
Honored Contributor I
41 Views

initramfs is probably something like a tar archive - google will tell you - or maybe 'file initramfs'. 

Nearly 2G of kernel code is going to be a problem in itself. 

You are going to need to do a lot of pruning to get a usable kernel and a RAM filesystem into 8M. 

Trimming something like a NetBSD kernel & userspace might be easier - but no one has committed NetBSD kernel support for the Nios2.
Altera_Forum
Honored Contributor I
41 Views

Thanks dsl. 

 

This is like you are saying. I have succesfully booted linux MMU on 8MB SDRAM but I needed removed a lot of things from the kernel and app/lib. I needed also check in blackfin options this: 

 

Blackfin build options &#9472;> 

[*] Cull unused ELF shared librariesproblems with kernel aft 

 

Unfortunatelly kernel is not useable. I can not even use telnetd(busybox or external) or load any module.  

 

So I came back to DE2-70 where I have 32MB SDRAM. I fight there with DM9000 to make it stable because some time driver is loading fine but some time is not. I changed some parameters in sopc builder with avalon bus and I need make more tests to say if it helped.
Altera_Forum
Honored Contributor I
41 Views

Cutting out things one by one on a working system until it is small enough for the small system is probably easier than trying to make the small one work from scratch.

Reply