Phycore i.MX31 - eXecute-In-Place

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All, hope you are having a nice day!

  I'm not sure this this a proper place to ask this question. I tried
to ask it on a specialized maillist (OSELAS.PHytec) with no luck -
nobody answered. Mainly I'm interested in how to use XIP in practice
rather than reading that somebody/somwhere/somewhen succeded in what I'm
trying to do. 

  I use Phycore i.MX31 and my task is to reduce the time required for
booting Linux system. As one of the steps I'm trying to boot a xipImage
(an uncompressed Linux kernel image for running directly from NOR
memory).

  What I've reached is:
uboot> boot  
## Booting image at a0040000 ...
   Image Name:   xip-0xA0040040
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3418416 Bytes =  3.3 MB
   Load Address: a0040000
   Entry Point:  a0040040
   Verifying Checksum ... OK
   XIP Kernel Image ... OK

Starting kernel ...
(it hangs up at this position)

The kernel version is 2.6.19.2. The version of u-boot is 1.2.0

I think I'm doing something wrong. Therefore I'm gonna write in detail
every my step I've done to boot the kernel hoping that someone can
correct me.

Default eeprom variables are:
bootargs=console=ttymxc0,115200
mtdparts=mtdparts=phys_mapped_flash.0:128k(uboot)ro,128k(env),1792k(kernel),-(root)
root=/dev
/mtdblock3 rootfstype=jffs2

prg_kernel=tftpboot 0x80000000 $(uimage); erase 0xa0040000 +0x1C0000;
cp.b 0x80000000 0xa0040000 $(filesize)

The memory region starting at 0xA000_0000 is NOR.

I've built the xipImage with the following command:

make O=/usr/local/src/kernel/ xipImage ARCH=arm
CROSS_COMPILE=arm-none-linux-gnueabi-

and got:
Kernel: arch/arm/boot/xipImage is ready (physical address: 0xa0040040)

(note: it's 0xA004_0040. Id est the same area a compressed kernel
resided in + 0x40. Why 0x40? See further).

An experiment showed u-boot can't deal with raw images like xipImage.
It needs to be wrapped by a u-boot header. This is where mkimage comes
into action. 
An experiment showed that mkimage can't deal with raw xipImage either.
Thus I looked at its sources to understand why.

It checks the header of xipImage to see if there is enough space for
the u-boot header. The sign of "free space" is sizeof(image_header_t)
of 0xFF. Trying to make use of just generated xipImage leads to
appearing the following message:
printf(stderr, "%s: Bad file: \"%s\" has invalid buffer for
XIP\n", cmdname, datafile);

Thus I did the following:
$ for i in `seq 1 64`; do echo -n -e "\377" >>xipheader;done
to create a 64 byte length file named xipheader consisting of 0xFF.
64(0x40) is the size of image_header_t (in u-boot 1.2.0)

$ cat xipheader xipImage-0xa0040040 >xip-0xA0040040
to combine the space reserved for u-boot header with xImage

$ /usr/local/bin/mkimage -x -A arm -O linux -T kernel -C none -a
0xA0040000  -n "xip-0xA0040040" -d xip-0xA0040040 xip-0xA0040040.img

Image Name:   xip-0xA0040040
Created:      Thu Apr 10 14:52:15 2008
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    3418416 Bytes = 3338.30 kB = 3.26 MB
Load Address: 0xA0040000
Entry Point:  0xA0040040

Then I uploaded the newly created file xip-0xA0040040.img to the target
host:
uboot> tftpboot 0x80000000 xip-0xA0040040.img
uboot> erase 0xa0040000 +0x342970  
0x342970 is a size of xip-0xA0040040.img
uboot> cp.b 0x80000000 0xa0040000 $(filesize)  

I know I've overwritten a part of the root file system (as an
uncompressed kernel is larger than the previous compressed one)
but it doesn't matter now as I can flash rootfs to a higher address
once I managed to boot xipImage.

Then I changed bootargs to 
console=ttymxc0,115200
mtdparts=mtdparts=phys_mapped_flash.0:128k(uboot)ro,128k(env),3340k(kernel),-(root)
root=/dev /mtdblock3 rootfstype=jffs2
3340k is the size of xipImage (I rounded 3338.30k).

and tried to boot the kernel. The result is in the beginning of the
letter. 
What am doing wrong? I am not sure about Entry Point. Should it really 
be 0xA0040040?

Sincerely Yours, Eugene

Now it is safe to turn off your computer

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux