2008-04-16 18:23:04 Running out of memory.
blue hash (UNITED STATES)
Message: 54364 Any command(busybox) I try to type at the terminal gives me a page allocation error.
The BF537 board has 16Megs of RAM(8Mb+8Mb), running uClinux(2008).
The kernel image(uImage) is around 3.88Mb.
The image is transferred to RAM 0x800000 via U-boot command
tftp 0x800000 uImage
I'va attached the crash trace and kernel_boot log. Can anyone give me pointers where to look regarding the memory error
"Unable to allocate RAM for process text/data, errno 12"
Running cat /proc/meminfo gives the same error, so I cant really get anymore details.
Does the boot log line,
Memory available: 5196k/16384k RAM, (108k init code, 1121k kernel code, 457k data, 1024k dma, 8480k reserved)
mean theres 5196k available?
Thanks
kernel_log.txt
trace.txt
QuoteReplyEditDelete
2008-04-16 18:44:47 Re: Running out of memory.
Mike Frysinger (UNITED STATES)
Message: 54366 your system has too little memory. either remove stuff from your root filesystem, or switch over to a flash rootfs.
QuoteReplyEditDelete
2008-04-16 18:50:26 Re: Running out of memory.
Robin Getz (UNITED STATES)
Message: 54367 Blue:
Although you have some memory free, it is fragmented.
40*4kB 22*8kB 7*16kB 2*32kB 5*64kB 1*128kB 0*256kB 1*512kB 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB 0*32768kB = 1472kB
the largest page you have is 512k - Order 7 is 2 ^ 7 * 4k == 512k (so I'm surprised that failed).
Things I would do:
- move your file system to flash (if you have enough flash) (today, your file system is in RAM, as ext2 - this is bad. it consumes sdram (boot message is rootfs = 0x00700000-0x00f00000 == 8 Meg) and will be copied into the page cache when applications run (consuming 2 x the memory)
- move your file system to initfs (same as above, but the file system lives in the page cache, so "disk space" that is not being used, can be used by applications.
- move to fdpic (if you are running as flat - make sure you do a make clean in the dist before switching). This should make the file system smaller if you cut out various shared libs that you don't need
- make sure to cull things in /lib/modules and /lib that you don't need. Do something like described in the faq:
http://docs.blackfin.uclinux.org/doku.php?id=faq - "my uImage is too large".
- cut down things you don't need in the kernel (Your kernel is 1,121k (text) and 454k of data.) which is pretty big.
- update your vendor files to the way that the AnalogDevices boards are doing it. We moved things around so the init section was the last section - this init section is freed, and will combine with larger pages, and help with the frag problem.
then try again.
-Robin
QuoteReplyEditDelete
2008-04-17 17:26:50 Re: Running out of memory.
blue hash (UNITED STATES)
Message: 54437 Robin, Mike,
Thanks for the suggestions.
I got my uImage.ext2 from 3.9Mb to around 3.0Mb. The board has only 4 mb flash.
I tested the image via the commands in u-boot above and they work alright and dont crash, as below.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Booting image at 00800000 ...
Image Name: uClinux Kernel and ext2
Created: 2008-04-17 20:34:00 UTC
Image Type: Blackfin Linux Kernel Image (gzip compressed)
Data Size: 2817955 Bytes = 2.7 MB
Load Address: 00001000
Entry Point: 00166000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
Starting Kernel at = 166000
Linux version 2.6.22.18-ADI-2008R1black-svn (bwiuser@localhost.localdomain) (gcc version 4.1.2 (ADI svn)) #120 Thu Apr 17 16:30:46 EDT 2008
early printk enabled on early_BFuart0
Hardware Trace Active and Enabled
Warning: limiting memory to 7MB due to hardware anomaly 05000263
Blackfin support (C) 2004-2007 Analog Devices, Inc.
Compiled for ADSP-BF537 Rev 0.2
Blackfin Linux support by http://blackfin.uclinux.org/
Processor Speed: 400 MHz core clock and 100 MHz System Clock
Board Memory: 16MB
Kernel Managed Memory: 16MB
Memory map:
text = 0x00001000-0x001099a0
rodata = 0x0010a000-0x00155978
data = 0x00156000-0x00166000
stack = 0x00156000-0x00158000
init = 0x00166000-0x00181000
bss = 0x00181000-0x0018ff10
available = 0x0018ff10-0x00700000
rootfs = 0x00700000-0x00f00000
DMA Zone = 0x00f00000-0x01000000
Instruction Cache Enabled
Data Cache Enabled (write-through)
Built 1 zonelists. Total pages: 1778
Kernel command line: root=/dev/mtdblock3 rw earlyprintk=serial,uart0,57600
Configuring Blackfin Priority Driven Interrupts
PID hash table entries: 32 (order: 5, 128 bytes)
console handover: boot [early_BFuart0] -> real [ttyBF0]
Dentry cache hash table entries: 1024 (order: 0, 4096 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory available: 5288k/16384k RAM, (108k init code, 1058k kernel code, 429k data, 1024k dma, 8480k reserved)
Blackfin Scratchpad data SRAM: 4 KB
Blackfin Data A SRAM: 16 KB (15 KB free)
Blackfin Data B SRAM: 16 KB (16 KB free)
Blackfin Instruction SRAM: 48 KB (39 KB free)
Security Framework v1.0.0 initialized
Mount-cache hash table entries: 512
NET: Registered protocol family 16
Blackfin GPIO Controller
Blackfin DMA Controller
stamp_init(): registering device resources
Generic PHY: Registered new driver
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
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler cfq registered
PPI: PPI-EKC Driver INIT IRQ:23
Serial: Blackfin serial driver
bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 18) is a BFIN-UART
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
bfin_mac_mdio: probed
bfin_mac: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:01, irq=-1, mdc_clk=2500000Hz(mdc_div=19)@sclk=100MHz)
bfin_mac: Version 1.1, Blackfin BF53[67] BF527 on-chip Ethernet MAC driver
physmap platform flash device: 00400000 at 20000000
physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
Amd/Fujitsu Extended Query Table at 0x0040
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
RedBoot partition parsing not available
Using physmap partition information
Creating 3 MTD partitions on "physmap-flash.0":
0x00000000-0x00040000 : "Bootloader"
0x00040000-0x00390000 : "uImage"
0x00390000-0x003f0000 : "Configs"
uclinux[mtd]: RAM probe address=0x700000 size=0x800000
Creating 1 MTD partitions on "RAM":
0x00000000-0x00800000 : "ROMfs"
Generic platform RAM MTD, (c) 2004 Simtec Electronics
bfin-spi bfin-spi.0: Blackfin BF5xx on-chip SPI Contoller Driver, Version 1.0, regs_base@ffc00500, dma channel@7
rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
rtc-bfin rtc-bfin: setting the system clock to 1970-01-01 03:24:35 (12275)
VFS: Mounted root (ext2 filesystem).
Freeing unused kernel memory: 108k freed
---------------------------------------------------------------------------------------------------------------------------------------
However when I burn the uImage.ext2 to flash, the boot halts. By comparing the two boot processes it seems to halt at probing the Flash chip, where the MTD partitoning takes place. How come it works alright in the previous method?
______________________________________________________________________________________
## Booting image at 20040000 ...
Image Name: uClinux Kernel and ext2
Created: 2008-04-17 20:34:00 UTC
Image Type: Blackfin Linux Kernel Image (gzip compressed)
Data Size: 2817955 Bytes = 2.7 MB
Load Address: 00001000
Entry Point: 00166000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
Starting Kernel at = 166000
Linux version 2.6.22.18-ADI-2008R1black-svn (bwiuser@localhost.localdomain) (gcc version 4.1.2 (ADI svn)) #120 Thu Apr 17 16:30:46 EDT 2008
early printk enabled on early_BFuart0
Hardware Trace Active and Enabled
Warning: limiting memory to 7MB due to hardware anomaly 05000263
Blackfin support (C) 2004-2007 Analog Devices, Inc.
Compiled for ADSP-BF537 Rev 0.2
Blackfin Linux support by http://blackfin.uclinux.org/
Processor Speed: 400 MHz core clock and 100 MHz System Clock
Board Memory: 16MB
Kernel Managed Memory: 16MB
Memory map:
text = 0x00001000-0x001099a0
rodata = 0x0010a000-0x00155978
data = 0x00156000-0x00166000
stack = 0x00156000-0x00158000
init = 0x00166000-0x00181000
bss = 0x00181000-0x0018ff10
available = 0x0018ff10-0x00700000
rootfs = 0x00700000-0x00f00000
DMA Zone = 0x00f00000-0x01000000
Instruction Cache Enabled
Data Cache Enabled (write-through)
Built 1 zonelists. Total pages: 1778
Kernel command line: root=/dev/mtdblock3 rw earlyprintk=serial,uart0,57600
Configuring Blackfin Priority Driven Interrupts
PID hash table entries: 32 (order: 5, 128 bytes)
console handover: boot [early_BFuart0] -> real [ttyBF0]
Dentry cache hash table entries: 1024 (order: 0, 4096 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory available: 5288k/16384k RAM, (108k init code, 1058k kernel code, 429k data, 1024k dma, 8480k reserved)
Blackfin Scratchpad data SRAM: 4 KB
Blackfin Data A SRAM: 16 KB (15 KB free)
Blackfin Data B SRAM: 16 KB (16 KB free)
Blackfin Instruction SRAM: 48 KB (39 KB free)
Security Framework v1.0.0 initialized
Mount-cache hash table entries: 512
NET: Registered protocol family 16
Blackfin GPIO Controller
Blackfin DMA Controller
stamp_init(): registering device resources
Generic PHY: Registered new driver
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
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler cfq registered
PPI: PPI-EKC Driver INIT IRQ:23
Serial: Blackfin serial driver
bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 18) is a BFIN-UART
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
--------------------------------------------------------------------------------------------------------------------------------------------
Robin,
You say to cull things in /lib/modules. Can I just uncomment unrequired modules in the makefile? or the only way is to use modules in make menuconfig.
Also, When I burn my ext2 image to flash, does the image copy to ram and then uncompress, or does it uncompress itself from flash itself.
QuoteReplyEditDelete
2008-04-17 22:24:56 Re: Running out of memory.
Mike Frysinger (UNITED STATES)
Message: 54445 to disable modules properly, do it from the kernel configuration system
when booting a uImage out of flash, it is decompressed from flash into ram ... there is no intermediate copying
QuoteReplyEditDelete
2008-04-18 08:43:14 Re: Running out of memory.
blue hash (UNITED STATES)
Message: 54477 Thanks again.
Any ideas on why the boot is halting when it boots from flash. Its working well when I copy uImage to RAM and boot from there.
QuoteReplyEditDelete
2008-04-18 12:00:30 Re: Running out of memory.
Robin Getz (UNITED STATES)
Message: 54483 Blue:
You can't write ext2 to flash, you need to switch to JFFS2.
Have a look at:
http://docs.blackfin.uclinux.org/doku.php?id=enabling_jffs2
as for culling - just use "rm" - removing the files from the "romfs" directory - and then "make image".
-Robin
QuoteReplyEditDelete
2008-04-18 12:37:29 Re: Running out of memory.
blue hash (UNITED STATES)
Message: 54487 Hmm... how did this person do it?(first post)
This is what I tried:
I made an image without ext2.
Copied uImage.initramfs to flash and bootm'ed to there.
Is this right? I still cant fix the boot hang, when booting from flash, although it works alright when booting from ram.
I'll try the jffs2 later in the day.
QuoteReplyEditDelete
2008-04-21 15:29:52 Re: Running out of memory.
blue hash (UNITED STATES)
Message: 54642 "You can't write ext2 to flash, you need to switch to JFFS2."
I unable to understand why ext2 cannot be written to flash. If my compressed uImage(with ext2) is around 2MB(the board has 4Mb flash) and that's burned into flash, is that not the right way?
However, no matter what I try, the boot hangs as in post 4. Is there anything else to look out for?
It seems to hang just when it tries to partition the flash MTD.
QuoteReplyEditDelete
2008-04-21 16:51:39 Re: Running out of memory.
Robin Getz (UNITED STATES)
Message: 54644 Blue:
ext2 is not a flash based file system - it does not include the things flash needs (like bad block detection, and wear leveling). It will not work.
Go read the jffs2 page, and follow the directions.
-Robin
QuoteReplyEditDelete
2008-04-21 17:00:04 Re: Running out of memory.
blue hash (UNITED STATES)
Message: 54645 I just tried it.
The boot still halts at the same place.
QuoteReplyEditDelete
2008-04-21 17:05:15 Re: Running out of memory.
blue hash (UNITED STATES)
Message: 54646 In case it helps:
When the board is first burned with ext2 or jffs2, and I issue the "boot" command at u-boot prompt, it uncompresses into RAM from flash and does not halt. But if I restart the board, the boot hangs.
I have a thread running in the the u-boot forums about the saveenv command crashing u-boot. I wonder if they are related.
Thanks
QuoteReplyEditDelete
2008-04-21 17:15:28 Re: Running out of memory.
Robin Getz (UNITED STATES)
Message: 54649 Can you attach the bootlog?
Thanks
-Robin
QuoteReplyEditDelete
2008-04-21 17:21:39 Re: Running out of memory.
blue hash (UNITED STATES)
Message: 54650 ## Booting image at 20040000 ...
Image Name: Linux-2.6.22.18-ADI-2008R1orange
Created: 2008-04-21 20:24:15 UTC
Image Type: Blackfin Linux Kernel Image (gzip compressed)
Data Size: 930361 Bytes = 908.6 kB
Load Address: 00001000
Entry Point: 00188000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
Starting Kernel at = 188000
Linux version 2.6.22.18-ADI-2008R1orange-svn (bwiuser@localhost.localdomain) (gcc version 4.1.2 (ADI svn)) #272 PREEMPT Mon Apr 21 16:24:12 EDT 2008
Hardware Trace Active and Enabled
Warning: limiting memory to 15MB due to hardware anomaly 05000263
Blackfin support (C) 2004-2007 Analog Devices, Inc.
Compiled for ADSP-BF537 Rev 0.2
Blackfin Linux support by http://blackfin.uclinux.org/
Processor Speed: 400 MHz core clock and 100 MHz System Clock
Board Memory: 16MB
Kernel Managed Memory: 16MB
Memory map:
text = 0x00001000-0x00125e10
rodata = 0x00126000-0x00175694
data = 0x00176000-0x00188000
stack = 0x00176000-0x00178000
init = 0x00188000-0x001a3000
bss = 0x001a3000-0x001b273c
available = 0x001b273c-0x00eff000
DMA Zone = 0x00f00000-0x01000000
Instruction Cache Enabled
Data Cache Enabled (write-back)
Built 1 zonelists. Total pages: 3810
Kernel command line: root=/dev/mtdblock2 rw rootfstype=jffs2
Configuring Blackfin Priority Driven Interrupts
PID hash table entries: 64 (order: 6, 256 bytes)
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory available: 13332k/16384k RAM, (108k init code, 1171k kernel code, 454k data, 1024k dma, 296k reserved)
Blackfin Scratchpad data SRAM: 4 KB
Blackfin Data A SRAM: 16 KB (15 KB free)
Blackfin Data B SRAM: 16 KB (16 KB free)
Blackfin Instruction SRAM: 48 KB (39 KB free)
Security Framework v1.0.0 initialized
Mount-cache hash table entries: 512
NET: Registered protocol family 16
Blackfin GPIO Controller
Blackfin DMA Controller
stamp_init(): registering device resources
Generic PHY: Registered new driver
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
JFFS2 version 2.2. .. 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler cfq registered
PPI: PPI-EKC Driver INIT IRQ:23
Serial: Blackfin serial driver
bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 18) is a BFIN-UART
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
-------Boot stops here--------
QuoteReplyEditDelete
2008-04-21 18:11:44 Re: Running out of memory.
Graham Davies (UNITED STATES)
Message: 54654 Robin, I don't think you understand the OP's problem. Blue is not mounting an ext2 file system over flash, he is storing in flash a binary image of a compressed ext2 file system (plus the kernel) which u-boot is uncompressing into RAM. The ext2 file system is then in RAM. Correct me if I'm wrong, but isn't this the standard way of booting up uClinux? The OP's problem is that if he loads the binary image into RAM and tells u-boot to go from there everything is OK, but if he loads the binary image into Flash and tells u-boot to go from there it doesn't complete the boot. I think telling him not to use ext2 is a red herring.
Graham.
QuoteReplyEditDelete
2008-04-21 23:06:48 Re: Running out of memory.
Robin Getz (UNITED STATES)
Message: 54665 Graham:
The kernel does not support seperate ext2 file systems. If you want that - use a uImage. There is no other option today.
What Blue was asking for - was to use less ram - hense a flash based file system.
You are right - ext2 is silly to talk about in this context - I don't know why Blue keeps bringing it up - it is not me.
-Robin
QuoteReplyEditDelete
2008-04-22 16:42:43 Re: Running out of memory.
blue hash (UNITED STATES)
Message: 54738 The kernel now boots ok from flash.
I compiled and made changes to a fresh version of uClinux.
Thanks to all those who helped.