UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor markalbers
Visitor
4,212 Views
Registered: ‎02-06-2015

Customize petalinux kernel and rootfs generated from SDSOC

Hallo,

 

is there a possibility to customize the linux kernel and rootfs automatically generated by SDSOC? Would be nice if there was something like the config menus petalinux has got.

 

Regards

Mark

0 Kudos
3 Replies
Highlighted
Xilinx Employee
Xilinx Employee
4,200 Views
Registered: ‎08-01-2008

Re: Customize petalinux kernel and rootfs generated from SDSOC

The PetaLinux Tools offers everything necessary to customize, build and deploy Embedded Linux solutions on Xilinx processing systems. Tailored to accelerate design productivity, the solution works with the Xilinx hardware design tools to ease the development of Linux systems for Zynq-7000 All Programmable SoCs, and MicroBlaze.

 

The Yocto Project is an open source collaboration project that provides templates, tools and methods to help you create custom Linux-based systems for embedded products regardless of the hardware architecture. It's not an embedded Linux distribution  it creates a custom one for you!

 

Building the rootfs with Yocto

 

--------------Contents------------------

 

....................................System requirements

....................................Steps to follow

....................................Creating u-boot image

....................................Adding Custom packages in Yocto

....................................Creating fitimg.its and fitimg.itb files

....................................Creating fitimg.its

....................................Creating fitimg.itb

....................................Booting the system with BOOT.bin and fitimg.itb

....................................PetaLinux files

....................................Yocto files

....................................Commands to boot the system

....................................Useful URLs

 

System requirements:

We need following utilities to be installed on the system where we are generating the image using Yocto:

  1. 1.        Mkimage
  2. DTC

 

Steps to follow:

Creating u-boot image:

Following steps provide information on how to create a Yocto compiled image:

 

  1. Clone to poky: This will create a folder named poky in current dir.

Command: git clone git://git.yoctoproject.org/poky.git

  1. Clone to meta-xilinx layer: Go into poky directory created above and then fire clone command

Commands:  cd poky

                         git clone http://github.com/Xilinx/meta-xilinx

  1. Check out a certain version:

Commands: in poky dir : git checkout -b fido origin/fido 

                        cd meta-xilinx

                        git checkout -b fido origin/fido

                        cd ..

  1. Run the  setup file to create a build environment : This creates a folder named build-zc702-zynq7 in poky directory

Command: . ./oe-init-build-env build-zc702-zynq7

 

  1. Modify conf/bblayers.conf file and conf/local.conf file: Add the meta-xilinx layer information in the bblayers.conf file and machine information in local.conf file

  In conf/bblayers.conf : After the last value present for BBLAYERS ?= add

                /home/xilinxfae/myData/proj/zc7000/sandbox/yocto/poky/meta-xilinx \

  In conf/local.conf :  After # Machine Selection add

MACHINE ??= "zc702-zynq7"

 

 

  1. Create final image: From build-zc702-zynq7 folder, fire below command. It will create image of the format core-image-minimal****rootfs.cpio.gz.u-boot under folder tmp/deploy/images

Command:  bitbake core-image-minimal


Adding Custom packages in Yocto:

1.       If you want to add custom packages in Yocto do the following. In below example we have added smart tool:

  1. In poky dir create a layer called mylayer (meta-keyword gets attached by default to the layer name). Below command creates meta-mylayer folder in poky dir.

Command: yocto-layer -create mylayer

 

  1. Create dir structure recipes-core/images/ inside the meta-mylayer dir. Create one file called  myimage-image-minimal.bb inside it and add the patch of code mentioned below to the file:

Command:  Create dir structure meta-mylayer/recipes-core/images

Vim myimage-image-minimal.bb inside images folder

Add below lines to the myimage-image-minimal.bb file :

                  SUMMARY = "extended image with some extra packages"

    inherit core-image

    IMAGE_INSTALL = " packagegroup-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP}                               

    ${CORE_IMAGE_EXTRA_INSTALL} "

                  CORE_IMAGE_EXTRA_INSTALL += "smartpm"

  1. For smartpm we need to download package meta-openembedded

Command: git://git.openembedded.org/meta-openembedded

 

  1. Add the meta-mylayer and meta-openembedded information in bblayers.conf file
    In conf/bblayers.conf file add :

/home/xilinxfae/myData/proj/zc7000/sandbox/yocto/poky/meta-mylayer \

/home/xilinxfae/myData/proj/zc7000/sandbox/yocto/poky/meta-openembedded/meta-oe \

  1. Make sure the conf/local.conf file contains the necessary machine information.

MACHINE ??= "zc702-zynq7"

 

  1. Create Image by firing following command from build-zc702-zynq7 folder which will create image in the myimage-image-minimal*****rootfs.cpio.gz.u-boot format

Command:  bitbake myimage-image-minimal

 

Creating fitimg.its and fitimg.itb files:

Creating fitimg.its:

    Create file named fitimg.its and paste the following in the file:

 

    /*

* fit2015_2.its

* If you cut and paste:

* - beware of dos/linux line endings

* - watch how special characters like double quotes copy over

*/

/dts-v1/;

/ {

description = "fit 2015.2 its";

/*timestamp = <12345678>; # Added by mkimage; do not add manually*/

#address-cells = <1>;

images {

kernel@1 {

description = "OSL 2015.2 kernel";

data = /incbin/("./zImage.gz");

type = "kernel";

arch = "arm";

os = "lin

ux";

compression = "gzip

";

load = <0x8000>;

entry = <0x8000>;

};

ramdisk@1 {

description = "OSL 2015.2 ramd

isk";

data = /incbin/("./ramdisk.image.gz");

type = "ramd

isk";

arch = "arm";

os = "lin

ux";

compression = "gzip

";

};

fdt@1 {

description = "OSL 2015.2 device tree blob";

data = /incbin/("./devicetree.dtb");

type = "flat

_dt";

arch = "arm";

compression = "none";

};

};

configurations {

default = "conf@1";

conf@1 {

description = "default configuration";

kernel = "kernel@1";

ram

disk = "ramdisk@1";

fdt = "fdt@1";

};

};

};

 

Creating fitimg.itb:

Create folder named FITImage and copy the following in the folder->

m

kdir FITImag

e

cp fitim

g.its FITimage/. /*The one we created in above step*/

cp

zImage FITimage/.   /*The one we created using peta-linux command in PetaLinux project*/

cp sys

tem.dtb FITimage/devicetree.dtb  /*From PetaLinux project*/

cp  core-image-minimal****rootfs.cpio.gz .u-bootFITimag/urootfs.cpio.gz  /*The one we

created using bitbake command*/

 

cd F

ITimage

gzip -9 < zImage > zImage.gz

dd if=urootfs.cpio.gz of=ramdisk.image.gz ibs=64 sk

ip=1

mkimage -f fitimg.its fitimg.itb

cp fit

img.itb  <to sdcard. For us under /mnt/sdCard1 partition>

sync

Booting the system with BOOT.bin and fitimg.itb:

PetaLinux files:

Place the BOOT.bin from the PetaLinux project in the sdcard to boot.

 

Yocto files:

Place the fitimg.itb created above in the sdcard.

 

Commands to boot the system:

Place the sdcard on board.

Halt the autoboot process

On u-boot prompt execute:  fatload mmc 0 0x3000000 fitimg.itb

 E

xectue:  bootm 0x3000000

This will boot the system with support for large files and smart support.


Useful URLs:

1.       Yocto Project Information :

https://github.com/kratsg/meta-l1calo/wiki/Building-and-Deploying-an-OS

  1. Layers and recipes information

http://layers.openembedded.org/layerindex/branch/master/layers/

 

System booted

 

Here you can see some additional packages that were added to the filesystem:


Figure 1 - Large filesystem support

 


Figure 2 - NFS support

 


Figure 3 - Package manager smart

 

Thanks and Regards
Balkrishan
--------------------------------------------------------------------------------------------
Please mark the post as an answer "Accept as solution" in case it helped resolve your query.
Give kudos in case a post in case it guided to the solution.
Visitor markalbers
Visitor
4,195 Views
Registered: ‎02-06-2015

Re: Customize petalinux kernel and rootfs generated from SDSOC

What I exactly mean:

 

I have a custom platform developed with Vivado and a Linux running on it created with Petalinux Tools. It would be very nice now, if I was able to use SDSoC to create an application with some additional automatically generated hardware. The "problem" is sticking the results from SDSoc together with my custom Linux. So I wondered if there was a possibility to tell SDSoC to generate the Linux like I told the Petalinux Tools before.

0 Kudos
Xilinx Employee
Xilinx Employee
4,184 Views
Registered: ‎07-13-2012

Re: Customize petalinux kernel and rootfs generated from SDSOC

You can use your custom Vivado design and Linux to create an SDSoC platform, using the processes and tools

described in the document "SDSoC Environment User Guide: Platforms and Libraries" http://www.xilinx.com/support/documentation/sw_manuals/xilinx2016_2/ug1146-sdsoc-platforms-and-libraries.pdf

 

An SDSoC platform includes hardware (Vivado design, XML metadata) and software (include files, libraries,

Linux kernel/filesystem/devicetree, XML metadata, etc) required to compile and link both the generated hardware

system and applications that use functions accelerated in the programmable logic (PL). The Linux you build using

PetaLinux just needs to be included as part of your custom platform's software data and SDSoC copies it into the SD card

image produced for applications built using your custom platform. The Linux included with SDSoC provided platforms are

not generated dynamically by SDSoC running PetaLinux, but are included in the form of pre-generated kernel, ramdisk

and devicetree files residing in individual platform folders in the installation.

 

The Linux you build does need to include kernel drivers required by SDSoC, and UG1146 provides documentation describing

how to do that.