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: 
Adventurer
Adventurer
2,910 Views
Registered: ‎02-14-2014

WARNING Petalinux deletes entire project directory

WARNING

 

A bug in petalinux-config will delete the entire petalinux project directory instantly.  Let this be a warning to all of us to make sure we're using source control and checking in often.

 

If the petalinux tools cannot find the intended hw-description directory, they will issue something like an "rm -rf *" in the CURRENT WORKING DIRECTORY which wipes out all of your work.

 

This is petalinux 2017.2. During an experiment (to force an update and try to work around another bug, for another post) I moved the hw-description directory.   Here's what happened next:

 

tactical@tactical-VirtualBox:~/projects/zcu102/zcu102-vivado-petalinux-scratch-2017.1/project-spec$ mv hw-description/ hw-description.old
tactical@tactical-VirtualBox:~/projects/zcu102/zcu102-vivado-petalinux-scratch-2017.1/project-spec$ cd ..
tactical@tactical-VirtualBox:~/projects/zcu102/zcu102-vivado-petalinux-scratch-2017.1$ petalinux-config --get-hw-description ../../trp-0043-workspace/hw/system.sdk/ --oldconfig
INFO: Getting hardware description...
petalinux-config: line 357: pushd: /home/tactical/projects/zcu102/zcu102-vivado-petalinux-scratch-2017.1/project-spec/hw-description/: No such file or directory
INFO: Rename system_wrapper.hdf to system.hdf
petalinux-config: line 362: popd: directory stack empty
[INFO] generating Kconfig for project
ERROR: Hardware description file "/home/tactical/projects/zcu102/zcu102-vivado-petalinux-scratch-2017.1/project-spec/hw-description/system.hdf" doesn't exist.
ERROR: Failed to generate /home/tactical/projects/zcu102/zcu102-vivado-petalinux-scratch-2017.1/build/misc/config/Kconfig.syshw
ERROR: Failed to Kconfig project
petalinux-yocto: line 404: /home/tactical/projects/zcu102/zcu102-vivado-petalinux-scratch-2017.1/.petalinux/usage_statistics_token: No such file or directory
cat: /home/tactical/projects/zcu102/zcu102-vivado-petalinux-scratch-2017.1/.petalinux/usage_statistics_token: No such file or directory
petalinux-yocto: line 404: /home/tactical/projects/zcu102/zcu102-vivado-petalinux-scratch-2017.1/.petalinux/usage_statistics_token: No such file or directory
cat: /home/tactical/projects/zcu102/zcu102-vivado-petalinux-scratch-2017.1/.petalinux/usage_statistics_token: No such file or directory
ERROR: Failed to generate System hardware Kconfig file.
petalinux-config: line 95: /home/tactical/projects/zcu102/zcu102-vivado-petalinux-scratch-2017.1/.petalinux/usage_statistics_token: No such file or directory
cat: /home/tactical/projects/zcu102/zcu102-vivado-petalinux-scratch-2017.1/.petalinux/usage_statistics_token: No such file or directory
^Cpetalinux-config: line 95: /home/tactical/projects/zcu102/zcu102-vivado-petalinux-scratch-2017.1/.petalinux/usage_statistics_token: No such file or directory
cat: /home/tactical/projects/zcu102/zcu102-vivado-petalinux-scratch-2017.1/.petalinux/usage_statistics_token: No such file or directory
^Ctactical@tactical-VirtualBox:~/projects/zcu102/zcu102-vivado-petalinux-scratch-2017.1$ ls
build  system.hdf
tactical@tactical-VirtualBox:~/projects/zcu102/zcu102-vivado-petalinux-scratch-2017.1$ ls -l
total 7984
drwxrwxr-x 3 tactical tactical    4096 Aug  9 14:43 build
-rw-rw-r-- 1 tactical tactical 8169835 Aug  9 14:43 system.hdf

 

Note the ^C ^C, but it was too late.  Days of work gone.  

 

I know error handling in tcl and shell scripting isn't easy but PLEASE FIX this.   If a script encounters an error please abort immediately and do not issue dangerous commands like rm in a detectable error state!

 

 

0 Kudos
7 Replies
Moderator
Moderator
2,759 Views
Registered: ‎12-04-2016

Re: WARNING Petalinux deletes entire project directory

Hi 

 

Thanks for catching up the issue. 

We will check to see if we can make this as a warning. Till then, what we recommend is to create an empty folder with hw-description instead of renaming. 

 

Also, may I know what exactly you are trying to acheive by removing this?

 

 

Best Regards

Shabbir

 

0 Kudos
Moderator
Moderator
2,742 Views
Registered: ‎04-24-2017

Re: WARNING Petalinux deletes entire project directory

The work around for this issue is to remove the workspace completely before updating with new hdf.
 
$ petalinux-create -t project -s xilinx-zcu102-v2017.2-final.bsp 
$ rm rf <plnx-porj-root>/components/plnx_workspace
$ petalinux-config --get-hw-description=<PATH_TO_HDF_DIRECTORY>
$ petalinux-build
Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
Highlighted
Adventurer
Adventurer
2,673 Views
Registered: ‎02-14-2014

Re: WARNING Petalinux deletes entire project directory

 

 

0 Kudos
Scholar ronnywebers
Scholar
2,028 Views
Registered: ‎10-10-2014

Re: WARNING Petalinux deletes entire project directory

@sandeepg, @lcameron can you please clarify the exact issue here?

 

I'm not following this completely ... : is the issue that when you run petalinux-config --get_hw_description, and you enter a wrong path to the .hdf file, the complete petalinux folder gets deleted?

 

also, what does the option --old-config exactly do? Does it keep any manual modifications to the config / kernel-config / ... you did with the previous .hdf? So if you omit the --old-config, all your manual work is gone too? 

** kudo if the answer was helpful. Accept as solution if your question is answered **
0 Kudos
Moderator
Moderator
1,995 Views
Registered: ‎04-24-2017

Re: WARNING Petalinux deletes entire project directory

Hi @ronnywebers,

 

Can you provide more details on this. Are you specifying the path where you don't hdf ? 

 

The --oldconfig option allows you to parse the edited config file onto Kconfig, so that it can pull the dependencies.

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
Scholar ronnywebers
Scholar
1,987 Views
Registered: ‎10-10-2014

Re: WARNING Petalinux deletes entire project directory

@sandeepg


I was probably not clear in my question, sorry :

 

I was just wondering if I understood the initial question from @lcameron correctly, that if you give a wrong path to the .hdf file, and thus petalinux does not find a .hdf, that it just wipes out the entire project with this command :

 

petalinux-config --get-hw-description ./wrong_path_to_hdf/

 or even with :

 

petalinux-config --get-hw-description ./wrong_path_to_hdf/ --oldconfig

 

regarding my second question :

 

so --oldconfig does not create a new KCONFIG file, but uses the existing one as is? And omitting --oldconfig just wipes out the existing KCONFIG file, and regenerates it based on the .hdf info ?

** kudo if the answer was helpful. Accept as solution if your question is answered **
0 Kudos
Adventurer
Adventurer
123 Views
Registered: ‎12-20-2017

Re: WARNING Petalinux deletes entire project directory

I was just bitten by this bug and I extremely upset.

I was changing that target hardware platform, and I was having trouble with the new platform in petalinux, so I deleted the hw-description directory.  Now, all my !@#$ is gone. 

0 Kudos