Skip to main content
Visitor II
August 19, 2022
Solved

SDK installation script

  • August 19, 2022
  • 8 replies
  • 6747 views

Hello,

I would like to setup environment for STM32MPU according this instruction:

https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP1_boards/STM32MP157x-DK2/Develop_on_Arm%C2%AE_Cortex%C2%AE-A7/Install_the_SDK

so I downloaded the SDK .tar

https://www.st.com/en/embedded-software/stm32mp1dev.html#get-software/SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15.tar.xz

and run the script and got an error

./st-image-weston-openstlinux-weston-stm32mp1-x86_64-toolchain-4.0.1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15.sh 
 
Extracting SDK............................................................................................................................................................................................................................done
Setting it up...xargs: file: No such file or directory
sed: no input files
Failed to replace perl. Relocate script failed. Abort!

I run this script in docker based on ubuntu. All necessary packet installed.

FROM ubuntu:20.04

What could be a problem?

I run this script with -D (debug mode) and got:

+ find /opt/st/stm32mp1/4.0.1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15 -maxdepth 1 -type f
+ xargs -n100 file
+ grep :.*\(ASCII\|script\|source\).*text
+ grep -Fv -e /opt/st/stm32mp1/4.0.1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/environment-setup- -e /opt/st/stm32mp1/4.0.1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/relocate_sdk -e /opt/st/stm32mp1/4.0.1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/post-relocate-setup -e /opt/st/stm32mp1/4.0.1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/st-image-weston-openstlinux-weston-stm32mp1-x86_64-toolchain-4.0.1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15.sh
+ xargs -n100 sed -i -e s:/usr/local/oe-sdk-hardcoded-buildpath:/opt/st/stm32mp1/4.0.1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15:g -e s:^#! */usr/bin/perl.*:#! /usr/bin/env perl:g -e s: /usr/bin/perl: /usr/bin/env perl:g
+ awk -F: {printf "\"%s\"\n", $1}
+ find /opt/st/stm32mp1/4.0.1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/sysroots/x86_64-ostl_sdk-linux -type f
xargs: file: No such file or directory
sed: no input files
+ [ 123 -ne 0 ]
+ echo Failed to replace perl. Relocate script failed. Abort!
Failed to replace perl. Relocate script failed. Abort!

    This topic has been closed for replies.
    Best answer by Kevin HUBER

    Hello @ZHala.1​ ,

    Thanks for the explanation and yes I understand your need.

    Can you make a try without "--no-install-recommends"

    apt-get install -y

    A dependency needed is maybe not installed due to this option.

    Regards,

    Kevin

    Regards,

    Kevin

    8 replies

    Technical Moderator
    August 22, 2022

    Hello @ZHala.1​ ,

    If you read again the wiki page, you can see that you have to specify the path of your working directory with the argument "-d":

     ./stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/sdk/st-image-weston-openstlinux-weston-stm32mp1-x86_64-toolchain-4.0.1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15.sh -d <working directory absolute path>/Developer-Package/SDK

    Please can you try again a test like this. I think this is a problem of missing permission to create file in "/opt"

    Hope it helps,

    Best Regards,

    Kevin

    In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

    ZHala.1Author
    Visitor II
    August 22, 2022

    The script has default path to install if you didn't provide explicitly:

    root@7c8ca4056194:/sdk/sdk# ./st-image-weston-openstlinux-weston-stm32mp1-x86_64-toolchain-4.0.1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15.sh 
    ST OpenSTLinux - Weston - (A Yocto Project Based Distro) SDK installer version 4.0.1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15
    ===================================================================================================================================
    Enter target directory for SDK (default: /opt/st/stm32mp1/4.0.1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15):

    But even though if I provide -d /home still get the same error

    root@7c8ca4056194:/sdk/sdk# ./st-image-weston-openstlinux-weston-stm32mp1-x86_64-toolchain-4.0.1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15.sh -d /home
    ST OpenSTLinux - Weston - (A Yocto Project Based Distro) SDK installer version 4.0.1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15
    ===================================================================================================================================
    You are about to install the SDK to "/home". Proceed [Y/n]? Y
    SDK............................................................................................................................................................................................................................done
    Setting it up...xargs: file: No such file or directory
    sed: no input files
    Failed to replace perl. Relocate script failed. Abort!

     Below there is a content of directory /home

    root@7c8ca4056194:/home# tree -L 2
    .
    |-- environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
    |-- post-relocate-setup.sh
    |-- relocate_sdk.py
    |-- relocate_sdk.sh
    |-- site-config-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
    |-- sysroots
    | |-- cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
    | `-- x86_64-ostl_sdk-linux
    `-- version-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi

    Generally I can see sysroot which I suppose is installed toolchain. Script crash at

    stage when it try

    # replace /usr/local/oe-sdk-hardcoded-buildpath with the new prefix in all text files: configs/scripts/etc.
    # replace the host perl with SDK perl.

    Technical Moderator
    August 22, 2022

    Hello @ZHala.1​ ,

    Yes, sysroot is the installed toolchain.

    I tried again the SDK script on my Ubuntu 20.04 and i didn't encounter an error.

    Since the error seems related to perl, can you type "apt-get remove perl" then hit tabulation tab, to see which package are installed on your Ubuntu. On mine I have:

    $ apt-get remove perl
    perl perl-base perl-depends perl-modules-5.30 perl-openssl-defaults

    In the PC prerequisite, libarchive-zip-perl is listed : https://wiki.st.com/stm32mpu/wiki/PC_prerequisites

    I currently have the version: libarchive-zip-perl is already the newest version (1.67-2).

    You can maybe try again to install all the packages of the PC_prerequisites page, maybe one was forget.

    Best regards,

    Kevin

    ZHala.1Author
    Visitor II
    August 22, 2022

    When I run this script on PC(virtual machine ubuntu 20.04) script works.

    The difference is that I use docker based on ubuntu 20.04.

    Dockerfile_a7_standalone is docker file provided below

    ├── Dockerfile_a7_standalone
    └── store
     └── en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15.tar.xz

    Here is docker. It has all necessary packets

    FROM ubuntu:20.04
     
    ARG DEBIAN_FRONTEND=noninteractive
     
    RUN apt-get update \
     && apt-get install --no-install-recommends -y \
     # common packet
     ca-certificates \
     git \
     ssh \
     curl \
     #STM packet required by stm
     # Packages required by OpenEmbedded/Yocto
     gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 xterm python3-subunit mesa-common-dev zstd liblz4-tool \
     make xsltproc docbook-utils fop dblatex xmlto \
     libmpc-dev libgmp-dev \
     # Packages needed for some "Developer Package" use cases:
     build-essential libncurses-dev libyaml-dev libssl-dev \
     # Packages needed for some "Developer Package" use cases:
     coreutils bsdmainutils sed curl bc lrzsz corkscrew cvs subversion mercurial nfs-common nfs-kernel-server libarchive-zip-perl dos2unix texi2html diffstat libxml2-utils \
     # extra packets
     && apt-get clean \
     && rm -rf /var/lib/apt/lists/*
     
     
    ENV TMP_WORK=/home/tmp
    RUN mkdir -p ${TMP_WORK}
    COPY "store/en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15.tar.xz" ${TMP_WORK}
    WORKDIR ${TMP_WORK}
    RUN tar xvf en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15.tar.xz

    When this script is run inside docker then it get an error.

    It would be good to have toolchain in docker istead of regural PC because it can be used in continous integration (like Jenkins)

    Technical Moderator
    August 22, 2022

    Hello @ZHala.1​ ,

    Thanks for the explanation and yes I understand your need.

    Can you make a try without "--no-install-recommends"

    apt-get install -y

    A dependency needed is maybe not installed due to this option.

    Regards,

    Kevin

    Regards,

    Kevin

    ZHala.1Author
    Visitor II
    August 22, 2022
     apt-get install -y

    Excellent, you are right.

    Docker works as PC

    Technical Moderator
    August 22, 2022

    Hello again @ZHala.1​ ,

    Good news :)

    Best Regards,

    Kevin

    Visitor II
    April 28, 2023

    The reason for the issue is in the error message: "xargs: file: No such file or directory".

    That is, the file command is missing. On Ubuntu you can install file as follows:

    apt install file

    I assume that removing the "--no-install-recommends" option from other install commands also resulted in file being installed.

    Visitor II
    April 28, 2023

    BTW: It's quite annoying that there is no guest login for this forum.