MPC8309 kernel boot from NOR (XIP)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MPC8309 kernel boot from NOR (XIP)

2,132 Views
ajaybhargav
Contributor I

I have MPC8309 Kit with me. I want to tell u-boot to boot kernel directly from NOR rather than u-boot copy kernel to RAM and then boot. Is it possible in PowerPC? If yes please provide any helpful information.

Tags (3)
0 Kudos
Reply
5 Replies

1,373 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Ajay Bhargav,


It is possible, please try the following method.

On MPC8309SOM, the NOR Flash is allocated as the following.

Range Start Range End Definition

0xfe00_0000 0xfe05_ffff  U-Boot

0xfe0a_0000 0xfe2f_ffff    Kernel

0xfe30_0000 0xfe7e_ffff  Ramdisk file system

0xfe7f_0000 0xfe7f_3fff    DTB

Under u-boot after deploying uImage, rootfs.ext2.gz.uboot and dtb file at the specific addresses, and configure u-boot environment as the following.

setenv ramargs 'setenv bootargs root=/dev/ram rw  console=ttyS0,115200'

setenv bootcmd 'run ramargs; bootm 0xfe0a0000 0xfe300000 0xfe7f0000'


Have a great day,
Yiping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,373 Views
ajaybhargav
Contributor I

Hi Yiping,

even if I run uImage from NOR (which I am doing already), U-Boot relocates kernel to RAM before running it from Flash.

Display message "Loading Kernel Image... OK"

and after that dtb gets relocated to ram at a different address and then booting starts.

So "Loading Kernel Image... OK" itself takes around ~1sec. which I want to eliminate here. Any suggestions?

Regards,

Ajay Bhargav

0 Kudos
Reply

1,373 Views
scottwood
NXP Employee
NXP Employee

This is not normally supported by U-Boot with bootm, though you might be able to do it without U-Boot changes by using the bootm subcommands and skipping loados, with the uImage specifying the flash address as the entry point.

However, that isn't going to make Linux run out of flash -- it just means that early Linux code will do the copy instead.

0 Kudos
Reply

1,373 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Ajay Bhargav,


Would you please attach the whole Kernel boot log?

Thanks,

Yiping

0 Kudos
Reply

1,373 Views
ajaybhargav
Contributor I

Here is the u-boot + kernel log.

My kernel and u-boot is ported from stock MPC8309 kernel v2.6.34 that comes with Ltib. I am testing it on MPC8309 KIT.

U-Boot 2014.04-g678d3b1 (Dec 17 2014 - 17:12:45)MPC83XX

Reset Status:

CPU:   e300c3, MPC8309E, Rev: 1.1 at 333.333 MHz, CSB: 133.333 MHz

Board: MPC8309 Test Board

       Watchdog enabled

I2C:   ready

DRAM:  256 MiB (DDR2, 32-bit, ECC off, 266.667 MHz)

Flash: 32 MiB

Firmware 'Microcode version 0.0.0 for MPC8306 r1.0' for 8306 V1.0

QE: uploading microcode 'Microcode for MPC8306 r1.0'

NAND:  512 MiB

MMC:  FSL_SDHC: 0

In:    serial

Out:   serial

Err:   serial

Net:   UEC0, UEC1

Hit any key to stop autoboot:  0

MPC8309> mtdparts

device nor0 <nor>, # parts = 7

#: name                size            offset          mask_flags

0: UBoot               0x00100000      0x00000000      0

1: env                 0x00020000      0x00100000      0

2: ucode               0x00020000      0x00120000      0

3: dtb                 0x00020000      0x00140000      0

4: reserved            0x000a0000      0x00160000      0

5: kernel              0x00800000      0x00200000      0

6: fs                  0x01600000      0x00a00000      0

device nand0 <nand>, # parts = 4

#: name                size            offset          mask_flags

0: UBoot-nand          0x00180000      0x00000000      0

1: DTB-nand            0x00080000      0x00180000      0

2: Kernel-nand         0x00800000      0x00200000      0

3: fs-nand             0x1f600000      0x00a00000      0

active partition: nor0,0 - (UBoot) 0x00100000 @ 0x00000000

defaults:

mtdids  : nor0=nor,nand0=nand

mtdparts: mtdparts=nor:1M(UBoot),128K(env),128K(ucode),128K(dtb),640K(reserved),8M(kernel),-(fs);nand:1536K(UBoot-nand),512K(DTB-nand),8M(Kernel-nand))

MPC8309> boot

## Booting kernel from Legacy Image at fe200000 ...

   Image Name:   MPC8309 Linux 2.6.39

   Image Type:   PowerPC Linux Kernel Image (uncompressed)

   Data Size:    4133632 Bytes = 3.9 MiB

   Load Address: 00000000

   Entry Point:  00000000

## Flattened Device Tree blob at fe140000

   Booting using the fdt blob at 0xfe140000

   Loading Kernel Image ... OK

   Loading Device Tree to 007fa000, end 007ff46b ... OK

setup_arch: bootmem

mpc8309_setup_arch()

arch: exit

            

rtc-m41t80 0-0068: hctosys: unable to read the hardware clock

Creating mount points

Starting logging: OK

Initializing random number generator... done.

Starting network...

sd 0:0:0:0: [sda] Assuming drive cache: write through

sd 0:0:0:0: [sda] Assuming drive cache: write through

sd 0:0:0:0: [sda] Assuming drive cache: write through

udhcpc (v1.22.1) started

Sending discover...

Sending discover...

Sending discover...

No lease, failing

udhcpc (v1.22.1) started

Sending discover...

Sending discover...

Sending discover...

No lease, failing

Starting dropbear sshd: OK

Mounting USB Storage Device: OK

Welcome to Buildroot

mpc8309 login:

My Bootargs and bootcommand is:

bootargs=console=ttyS0,115200n8 root=ubi0:rootfs rw ubi.mtd=10,2048 noinitrd rootfstype=ubifs rootwait quiet

bootcmd=bootm 0xfe200000 - 0xfe140000

As you can see both kernel and dtb gets relocated before booting:

   Loading Kernel Image ... OK

   Loading Device Tree to 007fa000, end 007ff46b ... OK


Thanks in advance.

0 Kudos
Reply