cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Adventurer
Adventurer
3,736 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
Reply
10 Replies
Moderator
Moderator
3,585 Views
Registered: ‎12-04-2016

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
Reply
Moderator
Moderator
3,568 Views
Registered: ‎04-24-2017

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.
---------------------------------------------------------------------------
Adventurer
Adventurer
3,499 Views
Registered: ‎02-14-2014

 

 

0 Kudos
Reply
Advisor
Advisor
2,854 Views
Registered: ‎10-10-2014

@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
Reply
Moderator
Moderator
2,821 Views
Registered: ‎04-24-2017

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.
---------------------------------------------------------------------------
Advisor
Advisor
2,813 Views
Registered: ‎10-10-2014

@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
Reply
Explorer
Explorer
949 Views
Registered: ‎12-20-2017

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
Reply
Explorer
Explorer
684 Views
Registered: ‎03-21-2019

I am seeing something similar in 2019.1, only it only removes the project-spec directory. Annoying, but not as bad.

0 Kudos
Reply
Moderator
Moderator
666 Views
Registered: ‎04-24-2017

Hi @eliezer ,

In 2019.1 we removed --oldconfig as this was contradicting with open source make oldconfig hence it was renamed as silientconfig.

In terms of opensource  --oldconfig: Update current kernel configurations with your .config file and prompting for any new options that have been added to the kernel.

Silentconfig is used to configure the hdf parsing without GUI option.

Make sure you read 2019.1 petalinux docs(UG1144) and 2019.1 release notes AR https://www.xilinx.com/support/answers/72293.html 

 

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos
Reply
Explorer
Explorer
664 Views
Registered: ‎03-21-2019

Yeah I had copied my project-spec from a 2018 project, once I created it normally I no longer had this issue.

0 Kudos
Reply