cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
7,280 Views
Registered: ‎08-08-2016

Scripting the petalinux build process

Jump to solution

I am in the process of writing a script to create a petalinux project, import our custom HDF, then build petalinux.  I was able to produce a script that completes all the build steps, but unfortunately one of the steps (i.e. "petalinux-config -c rootfs") requires manual user input to select a few additional components to add to the root filesystem.  Is there any way to automate this?  I know which three components I need to add, but I don't know how to add this step to the script.

 

STARTING_DIR=$(pwd)
PETALINUX_INSTALL_DIR=/opt/pkg/petalinux-v2016.2-final
BSP_FILE_PATH=$STARTING_DIR/Xilinx-ZCU102-v2016.2-final.bsp
HW_DESC_FILE_DIR=$STARTING_DIR/HardwareDesignExport/
SCRIPT_TITLE="PETALINUX_BUILD_SCRIPT"
 
#Script outputs
PETALINUX_PROJ_NAME=petalinux_build

printf "%s: Setting petalinux environemnt variables...\n" $SCRIPT_TITLE 
source $PETALINUX_INSTALL_DIR/settings.sh


if [ -d "$PETALINUX_PROJ_NAME" ]; then
     printf "%s: Removing previous Build...\n" $SCRIPT_TITLE
     rm -rf $PETALINUX_PROJ_NAME;
fi

printf "%s: Creating the petalinux project directory from the .bsp file...\n" $SCRIPT_TITLE 
petalinux-create --type project --source $BSP_FILE_PATH --name $PETALINUX_PROJ_NAME

#now that we created the project, change directory into the newly created project directory
cd $PETALINUX_PROJ_NAME

printf "%s: Importing the Firware from the Hardware Description File (HDF)...\n" $SCRIPT_TITLE 
petalinux-config --get-hw-description=$HW_DESC_FILE_DIR --oldconfig


printf "\n\n"
printf "$s:   The following step requires manual user input." $SCRIPT_TITLE 
printf "%s:   Use the menu in the next step to add the following packages to the kernel:\n" $SCRIPT_TITLE 
printf "%s:     - FilesystemPackages->base->gcc-runtime-xilinx->gcc-runtime-dbg\n" $SCRIPT_TITLE 
printf "%s:     - FilesystemPackages->base->gcc-runtime-xilinx->gcc-runtime-dbg\n" $SCRIPT_TITLE 
printf "%s:     - FilesystemPackages->base->tcf-agent->tcf-agent\n" $SCRIPT_TITLE 
printf "%s:   Press any key to launch the \"petalinux-config -c rootfs\" menu...\n"
read -rsp $'' -n1 key

petalinux-config -c rootfs

printf "%s: Building Petalinux...\n" $SCRIPT_TITLE 
petalinux-build

printf "%s: Creating the Petalinux Boot Image...\n" $SCRIPT_TITLE 
petalinux-package --boot --format BIN --fsbl ./images/linux/zynqmp_fsbl.elf --fpga ./images/linux/design_1_wrapper.bit --u-boo
0 Kudos
Reply
1 Solution

Accepted Solutions
Observer
Observer
12,698 Views
Registered: ‎11-25-2015

Hi,

 

Whatever manual changes you make, would be present in <petalinux_project>/subsystems/linux/configs/rootfs/config file.

So, you can think of directly adding your changes into this rootfs config file in your script.

View solution in original post

0 Kudos
Reply
5 Replies
Observer
Observer
12,699 Views
Registered: ‎11-25-2015

Hi,

 

Whatever manual changes you make, would be present in <petalinux_project>/subsystems/linux/configs/rootfs/config file.

So, you can think of directly adding your changes into this rootfs config file in your script.

View solution in original post

0 Kudos
Reply
7,211 Views
Registered: ‎08-08-2016
Thanks, That did it. I made the changes, then saved the config file you referenced in our version management repository. I updated the script to look for the version controlled 'config' file, and if it does not find one it will launch 'petalinux-config -c rootfs' as a fallback.
0 Kudos
Reply
5,024 Views
Registered: ‎02-07-2008

Hi,

 

In PetaLinux 2016.4 the config process has changed and there is no longer a config file in /subsystems/linux/kernel.

 

The PetaLinux reference guide is very brief when discussing the new process involving configuration fragments. Can anyone explain how to script the PetaLinux config process in the new version?

 

Thanks.

 

Jeff

0 Kudos
Reply
Moderator
Moderator
4,957 Views
Registered: ‎04-17-2011
In 2016.4, the kernel config are in <plnx-proj-root>/project-spec/meta-plnx-generated/recipes-kernel/linux/configs/plnx_kernel.cfg

Refer to Appendix-C for more details: https://www.xilinx.com/support/documentation/sw_manuals/xilinx2016_4/ug1144-petalinux-tools-reference-guide.pdf

Also, the commands have not changed, so the script can be modified.

Regards,
Debraj
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
4,898 Views
Registered: ‎02-07-2008

Thanks Debraj.

 

In my case, I would also like to add certain libraries to the rootfs. The user guide doesn't list the config file for the rootfs but I found one here:

 

<plnx-proj-root>/project-spec/configs/rootfs_config

 

Does this file apply to the auto config settings? Can I apply my changes to this file and expect the tools to accept them?

 

Thanks again.

 

Jeff

0 Kudos
Reply