GrabDuck

How to make a yocto rootfs for MIPS CI20 - eLinux.org

:

Setup the build environment

If the host system doesn't have git-1.7.5 or higher, tar-1.24 or higher and python-2.7.3 or higher, then your best choice is to use the buildtools tarball provided for that kind of situation. Download it from here:

http://downloads.yoctoproject.org/releases/yocto/yocto-1.6.1/buildtools/

Install the buildtools by running the .sh file (/opt/ could be a good place to install it) and then source the environment setup file:

chmod +x poky-eglibc-x86_64-buildtools-tarball-core2-64-buildtools-nativesdk-standalone-1.6.1.sh
./poky-eglibc-x86_64-buildtools-tarball-core2-64-buildtools-nativesdk-standalone-1.6.1.sh
source /opt/poky/1.6.1/environment-setup-x86_64-pokysdk-linux

Downloading YP Core - Daisy

Download the "YP Core - Daisy" tarball from here:

http://downloads.yoctoproject.org/releases/yocto/yocto-1.6.1/poky-daisy-11.0.1.tar.bz2

Building Yocto

Unpack the tarball and "cd" into the "poky-daisy-11.0.1" directory.

tar xf poky-daisy-11.0.1.tar.bz2
cd poky-daisy-11.0.1

Since in this example we are creating an image for the CI20, we need to build it for MIPS32r2 LittleEndian Hard-Float. We will need to specify a target machine, but unfortunately there isn't any target machine for the CI20 in YP Core - Daisy. In fact, there isn't support for MIPS32r2 either. We are going to change that.

Adding support for MIPS32r2

Create the "meta/conf/machine/include/tune-mips32r2.inc" to add support for MIPS32r2:

cat > meta/conf/machine/include/tune-mips32r2.inc << "EOF"
DEFAULTTUNE ?= "mips32r2"

require conf/machine/include/tune-mips32.inc

TUNEVALID[mips32r2] = "Enable mips32r2 specific processor optimizations"
TUNECONFLICTS[mips32r2] = "n64 n32"
TUNE_CCARGS .= "${@bb.utils.contains("TUNE_FEATURES", "mips32r2", " -march=mips32r2", "", d)}"

AVAILTUNES += "mips32r2 mips32r2el"

TUNE_FEATURES_tune-mips32r2 = "${TUNE_FEATURES_tune-mips} mips32r2"
MIPSPKGSFX_VARIANT_tune-mips32r2 = "mips32r2"
PACKAGE_EXTRA_ARCHS_tune-mips32r2 = "mips mips32 mips32r2"

TUNE_FEATURES_tune-mips32r2el = "${TUNE_FEATURES_tune-mipsel} mips32r2"
MIPSPKGSFX_VARIANT_tune-mips32r2el = "mips32r2el"
PACKAGE_EXTRA_ARCHS_tune-mips32r2el = "mipsel mips32el mips32r2el"
EOF

Creating a new layer

Now you need to source the environment file:

source oe-init-build-env

That will create a build directory for you and "cd" automatically into it.

Now create the BSP layer issuing this command:

yocto-bsp create ci20 mips

It will ask some questions; just choose the default option for all of them.

Now we need to edit the "conf/local.conf" file to specify how we want our image to be built. Modify the value of the target machine and set it to "ci20":

MACHINE = "ci20"

Adding the CI20 machine

Create the "conf/machine/ci20.conf" file:

mkdir conf/machine
cat > conf/machine/ci20.conf << "EOF"
#@TYPE: Machine
#@NAME: CI20
#@DESCRIPTION: MIPS Creator CI20

require conf/machine/include/tune-mips32r2.inc

DEFAULTTUNE = "mips32r2el"
MACHINE_FEATURES = "serial"
SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS4"
IMAGE_FSTYPES ?= "tar.bz2"
EOF

Building the rootfs

Now create the image using this command:

bitbake core-image-sato

When the build process finishes you will find your rootfs image in the "tmp/deploy/images/ci20/" directory.

tmp/deploy/images/ci20/core-image-sato-ci20-<creation-date>.rootfs.tar.bz2