Hello!
I have been following the guide provided by NXP on how to create an image but cannot get it working. I also used the docker image available with the guide but I end up having to use sudo where it's not even mentioned in the guide due to permission being denied and when I reach bitbake, it cannot connect to the server due to again, permission denied. I tried getting around this using sudo -s {} but it then says, unknown command: bitbake
Hi @Sousa!
Thank you for contacting NXP Support!
You have to refer to Yocto User Guide to get the full explanation.
https://www.nxp.com/docs/en/user-guide/IMX_YOCTO_PROJECT_USERS_GUIDE.pdf
The reduced steps are:
Install the repo utility:
$: mkdir ~/bin
$: curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$: chmod a+x ~/bin/repo
$: PATH=${PATH}:~/bin
Download the Yocto Project BSP
$: mkdir <release>
$: cd <release>
$: repo init -u https://github.com/nxp-imx/imx-manifest -b <branch name> [ -m <release manifest>]
$: repo sync
To download the 6.6.3-1.0.0 release
$: repo init -u https://github.com/nxp-imx/imx-manifest -b imx-linux-nanbield -m imx-6.6.3-1.0.0.xml
Setup the build folder for a BSP release:
Setup for XWayland.
$: MACHINE=imx8mpevk DISTRO=fsl-imx-xwayland source ./imx-setup-release.sh -b bld-xwayland
Build an image:
$: bitbake <image recipe>
Some image recipes:
imx-image-core
imx-image-multimedia
imx-image-full
Best Regards!
Chavira
If you could help me understand why this is happening I would be very thankful! As I need to get a prototype for a project and also incorporate some custom meta data
Hello @Chavira and thank you for your answer!
However I keep encountering the same error as I provided while following your steps.
When using mkdir, I had to use, sudo mkdir, likewise with repo sync (sudo repo sync). When reaching the bitbake part, I get the following:
Unable to create 'pyshtables.py'
[Errno 13] Permission denied: 'pyshtables.py'
ERROR: Unable to acquire lock '/opt/yocto/nanbield/bld-xwayland/bitbake.lock', directory is not writable
You can also see with the following image:
Hi @Sousa!
What OS are you using?
Do you have the needed packages to compile in Yocto?
Essential Yocto Project host packages are:
$ sudo apt install 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 python3-subunit zstd liblz4-tool file
locales libacl1
Best Regards!
Chavira
Yes, I start by always running
sudo apt update && sudo apt upgrade -y
followed by:
sudo apt install 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 python3-subunit zstd liblz4-tool file
locales libacl1 -y
Hi @Sousa!
Maybe is the directrory where are you creating the Yocto project, I recommend to try it under directory /home/your_user/yocto_project
Best Regards!
Chavira
Hello @Chavira
When facing with those issues I try under root. But normally I try to create a user with:
sudo useradd -m <user_name>
Then log in onto that user and follow the steps in the guide
Hi @Sousa!
I think you have a permission issues, you should solve the issue by your side or try to re-install the OS.
Best Regards!
Chavira
Hello @Chavira
Maybe it's due to the docker and how I am using it. So if we could go over that before,
I am doing,
git clone https://github.com/nxp-imx/imx-docker.git
Which then creates the imx-docker folder, I walk into it (cd imx-docker) and set the env.sh to use the imx-5.15.71-2.2.0 (Kirkstone). After that, I run:
./docker-build.sh Dockerfile-Ubuntu-22.04
To create the docker image based on ubuntu 22, after that I run:
./docker-run.sh
And I have to do it this way, because if I try to use
./docker-run.sh ${imx-5.15.71-2.2.0}/yocto-build.sh
returns:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:377: starting container process caused: exec: "5.15.71-2.2.0/yocto-build.sh": stat 5.15.71-2.2.0/yocto-build.sh: no such file or directory: unknown.
and if I use
./docker-run.sh imx-5.15.71-2.2.0/yocto-build.sh
mkdir: cannot create directory ‘/opt/yocto/imx-5.15.71-2.2.0-build’: Permission denied
imx-5.15.71-2.2.0/yocto-build.sh: line 11: cd: /opt/yocto/imx-5.15.71-2.2.0-build: No such file or directory
fatal: cannot make .repo directory: Permission denied
error: command 'sync' requires repo to be installed first.
Use "repo init" to install it here.
imx-5.15.71-2.2.0/yocto-build.sh: line 24: imx-setup-release.sh: No such file or directory
imx-5.15.71-2.2.0/yocto-build.sh: line 28: bitbake: command not found
So once I have run the 3rd command (./docker-run.sh) I am now inside the docker container with a folder with the name imx-5.15.71-2.2.0.
My question now is, should I start the process from here? or just use the commands like the guide says, so the ones you provided?
Hi @Sousa!
For docker compilation:
This setup helps to build i.MX BSP in an isolated environment with docker.
There are various methods of installing docker, i.e. by docker script:
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
To work better with docker, without sudo
, add your user to docker group
.
$ sudo usermod -aG docker <your_user>
Log out and log back in so that your group membership is re-evaluated.
Create a docker config file at ~/.docker/config.json
and enter the following:
{
"proxies":
{
"default":
{
"httpProxy":"http://proxy.example.com:80"
}
}
}
Note: replace the 'example' proxy with your proxy info.
$ sudo mkdir -p /etc/systemd/system/docker.service.d
$ sudo vim /etc/systemd/system/docker.service.d/http-proxy.conf
add the following:
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"
Environment="NO_PROXY=localhost,someservices.somecompany.com"
Restart Docker
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
.
├── Dockerfile-Ubuntu-18.04
├── Dockerfile-Ubuntu-20.04
├── Dockerfile-Ubuntu-22.04
├── README.md
├── docker-build.sh
├── docker-run.sh
├── env.sh -> imx-6.6.3-1.0.0/env.sh
└── imx-6.6.3-1.0.0
├── env.sh
└── yocto-build.sh
Use env.sh
to set variables for your build setup. Make sure you have created a working directory, owned by current user, on a larger partition.
Run docker-build.sh
with one argument, related to Dockerfile, corresponding to the operating system, for example the Dockerfile for Ubuntu version 22.04:
$ ./docker-build.sh Dockerfile-Ubuntu-22.04
$ ./docker-run.sh ${IMX_RELEASE}/yocto-build.sh
i.e IMX_RELEASE=imx-6.6.3-1.0.0
or just go to the docker container prompt (and run the build script from there):
$ ./docker-run.sh
When running, volumes are used to save the build artifacts on host.
{DOCKER_WORKDIR}
as the main workspace{DOCKER_WORKDIR}/${IMX_RELEASE}
to make available the yocto build scripts into container{HOME}
to mount the current home user, to make available the user settings inside the container (ssh keys, git config, etc)
If you want to compile witouth docker you can refer to the Yocto User Guide.
But you have permission problems.
Best regards!
Chavira
Hello @Chavira
I was able to get an image to compile and work! But now I come with other unfortunate news, I was trying to add my custom meta-custom to the sources folder, but I got the following error:
ERROR: twin-1.0-r0 do_fetch: Bitbake Fetcher Error: FetchError("Please set a valid SRCREV for url ['SRCREV_default:pn-twin', 'SRCREV_default', 'SRCREV:pn-twin', 'SRCREV'] (possible key names are git://github.com/eclipse-ditto/ditto.git;protocol=https;branch=main, or use a ;rev=X URL parameter)", 'git://github.com/eclipse-ditto/ditto.git;protocol=https;branch=main')
ERROR: Logfile of failure stored in: /opt/yocto/imx-5.15.71-2.2.0/kirkstone/bld-xwayland/tmp/work/armv8a-poky-linux/twin/1.0-r0/temp/log.do_fetch.871303
ERROR: Task (/opt/yocto/imx-5.15.71-2.2.0/kirkstone/sources/meta-custom/recipes-apps/twin/twin.bb:do_fetch) failed with exit code '1'
I tried to set the tag in SRC_URI to Head or the hash of the latest commit and tried using the SRCREV_<name> with the same rules, Head or the hash. But to no avail, are you able to help me with it?
Hi @Sousa!
We don´t support custom software.
I recommend to check the Yocto documentation in the link below:
https://docs.yoctoproject.org/dev/dev-manual/layers.html
Best Regards!
Chavira
Hello @Chavira
Is the proxy needed? Because I cannot alter the docker settings on one end to allow for proxy especially because the proxy used in the example is an example and I assumed it would not be mandatory, otherwise a specific one would have been used. But assuming it's not, I can use docker without sudo in the environment and it's fine as I can use docker run hello-world and it provides the basic, hello world docker lines. But my issue is afterwards, in the docker itself.
Hello @Chavira
I was also thinking that could be a possibility. How would you recommend creating a user and what permissions to assign it?
Regarding the OS, I can create VMs and/or containers so that's not an issue.