z4yx / petalinux-docker

Dockerfile to build docker images with Petalinux (Tested on version 2018.3~2021.1)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ownership of /opt/Xilinx folder

Fraxsys-Engineering opened this issue · comments

I extended the installation of Petalinux v2021.2 into: /opt/Xilinx/petalinux/v2021.2/
Dockerfile changed to recursively set chmod on above folder, starting at Xilinx/

[Dockerfile]
RUN chmod a+rx /${PETA_RUN_FILE} &&
chmod a+rx /accept-eula.sh &&
mkdir -p /opt/Xilinx/petalinux/${PETA_VERSION} &&
mkdir -p /opt/Xilinx/petalinux/bsps &&
chmod 777 /tmp &&
chmod -R 777 /opt/Xilinx &&
find / -maxdepth 1 -name *.bsp -exec mv {} /opt/Xilinx/petalinux/bsps ; &&
cd /tmp &&
sudo -u vivado -i /accept-eula.sh /${PETA_RUN_FILE} /opt/Xilinx/petalinux/${PETA_VERSION} &&
rm -f /${PETA_RUN_FILE} /accept-eula.sh
($PETA_VERSION = "v2021.2", note: also pulled in a .bsp file...)

The install fails though, some errors generated prior to an expect line failing:
[Docker Output]
(all fine up to here)
Step 11/20 : COPY accept-eula.sh ${PETA_RUN_FILE} *.bsp /
---> acf92fc1669f
Step 12/20 : RUN chmod a+rx /${PETA_RUN_FILE} && chmod a+rx /accept-eula.sh && mkdir -p /opt/Xilinx/petalinux/${PETA_VERSION} && mkdir -p /opt/Xilinx/petalinux/bsps && chmod 777 /tmp && chmod -R 777 /opt/Xilinx && find / -maxdepth 1 -name *.bsp -exec mv {} /opt/Xilinx/petalinux/bsps ; && cd /tmp && sudo -u vivado -i /accept-eula.sh /${PETA_RUN_FILE} /opt/Xilinx/petalinux/${PETA_VERSION} && rm -f /${PETA_RUN_FILE} /accept-eula.sh
---> Running in b407c32a0b72
spawn /petalinux-v2021.2-final-installer.run /opt/Xilinx/petalinux/v2021.2
ERROR: Invalid options: /opt/Xilinx/petalinux/v2021.2
spawn /petalinux-v2021.2-final-installer.run -d /opt/Xilinx/petalinux/v2021.2
INFO: Checking installation environment requirements...
WARNING: This is not a supported OS
INFO: Checking free disk space
INFO: Checking installed tools
INFO: Checking installed development libraries
INFO: Checking network and other services
WARNING: No tftp server found - please refer to "UG1144 PetaLinux Tools Documentation Reference Guide" for its impact and solution
INFO: Checking installer checksum...
INFO: Extracting PetaLinux installer...

LICENSE AGREEMENTS

PetaLinux SDK contains software from a number of sources. Please review
the following licenses and indicate your acceptance of each to continue.

You do not have to accept the licenses, however if you do not then you may
not use PetaLinux SDK.

Use PgUp/PgDn to navigate the license viewer, and press 'q' to close

Press Enter to display the license agreements
WARNING: terminal is not fully functional
Do you accept Xilinx End User License Agreement? [y/N] > y
WARNING: terminal is not fully functional
Do you accept Third Party End User License Agreement? [y/N] > yment.txt (press RETURN)
INFO: Installing PetaLinux...
qqINFO: Checking PetaLinux installer integrity...
qqINFO: Installing PetaLinux SDK to "/opt/Xilinx/petalinux/v2021.2/."
qq*********************************************
ERROR: Failed to install PetaLinux SDK into "/opt/Xilinx/petalinux/v2021.2/."


Please refer to the PetaLinux Tools Installation Guide.

Check the troubleshooting guide at the end of that manual, and if you are
unable to resolve the issue please contact customer support with file:
/home/vivado/petalinux_installation_log

expect: spawn id exp6 not open
while executing
"expect "INFO: Checking PetaLinux installer integrity...""
(file "/accept-eula.sh" line 32)
The command '/bin/sh -c chmod a+rx /${PETA_RUN_FILE} && chmod a+rx /accept-eula.sh && mkdir -p /opt/Xilinx/petalinux/${PETA_VERSION} && mkdir -p /opt/Xilinx/petalinux/bsps && chmod 777 /tmp && chmod -R 777 /opt/Xilinx && find / -maxdepth 1 -name *.bsp -exec mv {} /opt/Xilinx/petalinux/bsps ; && cd /tmp && sudo -u vivado -i /accept-eula.sh /${PETA_RUN_FILE} /opt/Xilinx/petalinux/${PETA_VERSION} && rm -f /${PETA_RUN_FILE} /accept-eula.sh' returned a non-zero code: 1

I generated a temporary image from b407c32a0b72 and ran it interactively.
$ docker commit b407c32a0b72 temp-failed-peta-env
$ docker run -ti --rm temp-failed-peta-env /bin/bash

All directories exist, but the /opt/Xilinx/petalinux/v2021.2/ folder is still own by root (more on this later)

Changing to user: vivado ..
$ su vivado
vivado@aa83c66a7ccf:/$ cd ~

And looking at the Petalinux install log:
vivado@aa83c66a7ccf:/$ less petalinux_installation_log

[LOG]
INFO: Checking installation environment requirements...
WARNING: This is not a supported OS
INFO: Checking free disk space
INFO: Checking installed tools
INFO: Checking installed development libraries
INFO: Checking network and other services
WARNING: No tftp server found - please refer to "UG1144 PetaLinux Tools Documentation Reference Guide" for its impact and solution
INFO: Checking installer checksum...
INFO: Extracting PetaLinux installer...
INFO: Installing PetaLinux...
INFO: Checking PetaLinux installer integrity...
INFO: Installing PetaLinux SDK to "/opt/Xilinx/petalinux/v2021.2/."
...................................................tar: .: Cannot utime: Operation not permitted
tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted
tar: Exiting with failure status due to previous errors


ERROR: Failed to install PetaLinux SDK into "/opt/Xilinx/petalinux/v2021.2/."


Please refer to the PetaLinux Tools Installation Guide.

Check the troubleshooting guide at the end of that manual, and if you are
unable to resolve the issue please contact customer support with file:
/home/vivado/petalinux_installation_log

Errors --------------------------------
(1) tar "Cannot utime: Operation not permitted"
tar wants to adjust timestamp but cannot because user vivado does not own /opt/Xilinx/petalinux/v2021.2/

So how was this working before? I would assume this is fixed by getting docker to change the ownership of the /opt/Xilinx/petalinux/v2021.2/ folder to user: vivado at either petalinux/ or v2021.2?

Or is there some other issue?

Thanks,

OBSERVATIONS
(1) "ERROR: Invalid options: /opt/Xilinx/petalinux/v2021.2"
Is normal. The expect script (for some reason) tries this command knowing it's incorrect and traps the error triggering it to generate the correct command.
(2) As of Petalinus 2021.2 (or earlier?) The LICENSE Agreements have dropped in count from 3 to 2.
The accept-eula.sh script has to have one of the "> " traps removed such there are only 2.
Otherwise the script never gets beyond trying to find the third "> " and fails to capture the successful install.

I've tested that the installer of 2021.1 works fine with this Expect script. I guess the behavior is changed since 2021.2. I will verify that and fix the script if necessary.

Please try the latest commit. The Expect script issue should be solved.
BTW, ERROR: Invalid options: /opt/Xilinx/petalinux/v2021.2 is not a problem. Just a trick for compatibility with the older installers.

Hey there,
just to say that I have succesfully built petalinux 2021.2 on my PC with your docker. Thank you very much guys for your work

Thanks for updating.