Create a new PetaLinux software platform


2012-05-14Publicerad av Sven-Åke Andersson

Introduction


The next step is to create a new PetaLinux software platform ready for building a Linux system customized to our hardware platform. Here is a link to the PetaLogix webpage describing the different tools available to support the building of a new software platform. We will follow the instructions in the document Board Bring Up with PetaLinux SDK.

The <petalinux-new-platform> command is used to achieve this:

--> cd $PETALINUX
--> petalinux-new-platform -c microblaze -v RTE -p sp605_mb





The parameters are as follows:
 
  • -c <CPU TYPE>    CPU type. Supported types are microblaze and ppc440
  • -v <VENDOR>       This the vendor name - we will use our company name
  • -p <PLATFORM>  The name of the platform or product we are buildning

Here is the result:

 



Configure the software platform


The final step is to customise the software platform template to precisely match our unique hardware system. This is done by copying and merging the platform configuration files generated during the hardware build phase, into the newly created software platform, as described below:

Navigate to the fs-boot_bsp0 directory:

 


Execute the command: petalinux-copy-autoconfig

--> cd ...../hardware/user-platforms/SP605_MB/workspace/fs-boot_bsp_0
--> petalinux-copy-autoconfig




This could take a while. This is because it merges the existing platform configuration to Kernel configuration and enables the appropriated drivers in the Kernel configuration. This tool generate the hardware configuration files if they not generated yet and copy the files to the right place in PetaLinux. The DTS (Device Tree Source) file will be placed here:

 


Configure the Linux kernel


We will launch the Linux kernel configuration menu and configure it to meet our requirements.


--> cd $PETALINUX
--> petalinux-config-kernel





 
For the time being we will leave all settings untouched.


Configure user applications and system settings


Launch the user applications and system settings configuration menu and configure it to meet our requirements:

--> petalinux-config-apps
 


 
Here we will add the peekpoke application. Select PetaLogix Demo Applications and enable peekpoke.


Update the default configuration


Once we are satisfy with the configurations and it is properly tested, it is recommended to update our default configurations so we do not loose our configuration when switching from one software platform to another.

--> petalinux-platform-config --update

Build PetaLinux


It is time to build our new platform. Run the <make> command in the petalinux-dist directory to build the PetaLinux system image.

--> cd $PETALINUX/software/petalinux-dist
--> make








 
The output from the system image build is stored in the images directory.
 


Here is a table describing the usage of the files in the image directory.

 

 

Test Petalinux on the board


After the hardware bitstream and the PetaLinux have been built, we can now test our new PetaLinux platform.


Direct kernel boot via JTAG


  1. Program the FPGA using the Xilinx JTAG programming tools in XPS or SDK
  2. Make sure we have a console connected to the board (GTKTerm)
  3. Use the command petalinux-jtag-boot to download the software image to the board and boot it.

--> cd $PETALINUX/software/petalinux-dist
--> petalinux-jtag-boot -i images/image.elf

 

 

 After more than five minutes the system boots and the following text is displayed on the console.



 
 We have PetaLinux running in our system.
 

Indirect kernel boot via u-boot


Because we have configured ethernet in our hardware and connected the board to the netwoork, we can use u-boot to boot PetaLinux. This is much faster than loading everything using JTAG.

First bootstrap the system by downloading u-boot via JTAG.

--> cd $PETALINUX/software/petalinux-dist
--> petalinux-jtag-boot -i images/u-boot.elf

 



 
  • After u-boot boots, stop the autoboot
  • Use the command /sbin/ifconfig on the host to find the server IP address <HOST IP ADDRESS>.
  • In the PetaLinux console type: set serverip <HOST IP ADDRESS>
  • Confirm the IP address of the board: print ipaddr
  • Run netboot to download the PetaLinux image with the TFTP server and boot it: run netboot
  • PetaLinux will boot in a much shorter time.