Can't boot basic OpenEmbedded-Core on Freescal

2020-07-10 05:20发布

问题:

I've been trying to build and boot OpenEmbedded-Core on the evaluation kit for Freescale's ARM i.MX28, using the Freescale ARM layer for OpenEmbedded-Core. Unfortunately, I can't find a basic "Getting Started" guide (though there is a Yocto getting-started guide). Unfortunately, I haven't been able to "get started", to the point of successfully booting to a basic command prompt on the board's debug serial port.

Here is what I've been able to piece together, and as far as I've managed to get so far.

Fetch sources

mkdir -p oe-core/freescale-arm
cd oe-core/freescale-arm
git clone git://git.openembedded.org/openembedded-core oe-core
git clone git://github.com/Freescale/meta-fsl-arm.git
cd oe-core
git clone git://git.openembedded.org/meta-openembedded
git clone git://git.openembedded.org/bitbake bitbake

Set up environment

. ./oe-init-build-env

That puts us in a new sub-directory build and sets certain environment variables.

Edit configuration

Edit the conf/bblayers.conf and local.conf files:

conf/bblayers.conf should have the meta-fls-arm and meta-oe layers added for BBLAYERS. E.g.:

BBLAYERS ?= " \
  /home/craigm/oe-core/freescale-arm/oe-core/meta \
  /home/craigm/oe-core/freescale-arm/oe-core/meta-openembedded/meta-oe \
  ${TOPDIR}/../../meta-fsl-arm \
  "

In conf/local.conf, I set:

BB_NUMBER_THREADS = "4"
PARALLEL_MAKE = "-j 4"
MACHINE = "imx28evk"

Build

bitbake core-image-minimal

I ran this build overnight, and it has completed successfully for me. Output files were in ~/oe-core/freescale-arm/oe-core/build/tmp-eglibc/deploy/images.

There are two boot options that I'd like to try, as described below. Boot from SD card is simpler, but takes quite a long time (~30 min) to write the image to the SD card. Booting from TFTP + NFS is faster, but requires more set-up.

Boot from SD Card

Write image to SD card:

sudo dd if=tmp-eglibc/deploy/images/core-image-minimal-imx28evk.sdcard of=/dev/sdc

It took something like 30 minutes (3.5 GB file). Then I put it in the board's SD card slot 0, and powered-up. It got as far as loading the kernel, then stopped:

U-Boot 2012.04.01-00059-g4e6e824 (Aug 23 2012 - 18:08:54)

Freescale i.MX28 family at 454 MHz
BOOT:  SSP SD/MMC #0, 3V3
DRAM:  128 MiB
MMC:   MXS MMC: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   FEC0, FEC1
Hit any key to stop autoboot:  0
reading boot.scr

** Unable to read "boot.scr" from mmc 0:2 **
reading uImage

2598200 bytes read
Booting from mmc ...
## Booting kernel from Legacy Image at 42000000 ...
   Image Name:   Linux-2.6.35.3-11.09.01+yocto-20
   Created:      2012-08-23   7:53:40 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2598136 Bytes = 2.5 MiB
   Load Address: 40008000
   Entry Point:  40008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

Boot from TFTP + NFS

First, I tried to write U-Boot onto an SD card:

sudo dd if=tmp-eglibc/deploy/images/u-boot-imx28evk.mxsboot-sdcard of=/dev/sdc

Then I put it in the board's SD card slot 0, and powered-up. But all I got in the debug serial port was:

0x8020a01d

So, I decided to use Freescale's distribution of U-Boot for i.MX28 (from their LTIB distribution) onto an SD card. I set suitable U-Boot parameters for NFS booting with parameters from DHCP.

setenv bootargs console=ttyAMA0,115200n8
setenv bootargs_nfs setenv bootargs ${bootargs} root=/dev/nfs ip=dhcp nfsroot=,v3,tcp fec_mac=${ethaddr}
saveenv

I connected to a DD-WRT router with the following DNSmasq settings:

dhcp-boot=,,192.168.250.106
dhcp-option=17,"192.168.250.106:/home/craigm/rootfs"

On my host PC, I set up a TFTP server to serve the uImage file from ~/oe-core/freescale-arm/oe-core/build/tmp-eglibc/deploy/images/.

I also set up a root NFS server to serve the root file system. I edited /etc/exports to serve /home/craigm/rootfs. I extracted the root file system:

bitbake meta-ide-support
rm -Rf ~/rootfs
runqemu-extract-sdk tmp-eglibc/deploy/images/core-image-minimal-imx28evk.tar.bz2 ~/rootfs

Then I put the U-Boot SD card in the board's SD card slot 0, and powered-up. It got as far as this, then stopped:

...
TCP cubic registered
NET: Registered protocol family 17
can: controller area network core (rev 20090105 abi 8)
NET: Registered protocol family 29
can: raw protocol (rev 20090105)
mxs-rtc mxs-rtc.0: setting system clock to 1970-01-01 00:03:33 UTC (213)
eth0: Freescale FEC PHY driver [Generic PHY] (mii_bus:phy_addr=0:00, irq=-1)
eth1: Freescale FEC PHY driver [Generic PHY] (mii_bus:phy_addr=0:01, irq=-1)
Sending DHCP requests .
PHY: 0:00 - Link is Up - 100/Full
., OK
IP-Config: Got DHCP answer from 192.168.250.106, my address is 192.168.250.142
IP-Config: Complete:
     device=eth0, addr=192.168.250.142, mask=255.255.255.0, gw=192.168.250.1,
     host=192.168.250.142, domain=, nis-domain=(none),
     bootserver=192.168.250.106, rootserver=192.168.250.106, rootpath=/home/craigm/rootfs
Looking up port of RPC 100003/3 on 192.168.250.106
Looking up port of RPC 100005/3 on 192.168.250.106
VFS: Mounted root (nfs filesystem) on device 0:15.
Freeing init memory: 160K

I'm not sure if it's running without a serial console, or some other problem. I can ping it on 192.168.250.142, but I can't Telnet or SSH to it.

Questions

  • Is there any sort of "getting started" guide for OpenEmbedded-Core on Freescale's i.MX28?
  • Is the Freescale ARM layer really intended for use with OpenEmbedded-Core, Yocto, or what? I don't really understand how those projects relate.
  • Has anyone else had success booting a minimal image of OpenEmbedded-Core on Freescale's i.MX28? If so, how did your procedure differ from mine?
  • I'm not sure at this stage whether the problem is just a non-functional serial console, or some other sort of issue. It's hard to diagnose these problems that prevent even getting a basic system running. Any pointers on how to diagnose at this point?
  • Why would the U-Boot be broken so it can't even boot?

回答1:

From the boot message it looks like U-boot is working fine. U-boot is not broken.

The following boot message

2598200 bytes read
Booting from mmc ...
## Booting kernel from Legacy Image at 42000000 ...
   Image Name:   Linux-2.6.35.3-11.09.01+yocto-20
   Created:      2012-08-23   7:53:40 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2598136 Bytes = 2.5 MiB
   Load Address: 40008000
   Entry Point:  40008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

By the above log u-boot has done its job. "Booting the kernel" is the point where bootloader given the control to the kernel.

I guess the problem might be in kernel image or in memory.

To eliminate the problem of memory, try to check the manual and try to read and write in the RAM using the board's reference manual.

From the boot log RAM looks like has no problem. It has been initialized.

DRAM:  128 MiB

Check if the following message is not causing any problem. * Warning - bad CRC, using default environment

Check if all the devices have been initialized and nothing is skipped after the bad crc warning.