Docker images for petalinux
Dockerfile:
# 使用 Ubuntu 20.04 作为基础镜像
FROM ubuntu:20.04
# 设置环境变量
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Shanghai
ENV PETALINUX_INSTALLER=petalinux-v2021.2-final-installer.run
ENV PETALINUX_DIR=/data/working/peta
# 重新生成 sources.list 文件
RUN dpkg --add-architecture i386 && \
cat > /etc/apt/sources.list << 'EOF'
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted
deb http://mirrors.aliyun.com/ubuntu/ focal universe
deb http://mirrors.aliyun.com/ubuntu/ focal-updates universe
deb http://mirrors.aliyun.com/ubuntu/ focal multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse
EOF
# 更新并安装基础工具
RUN apt update && apt install -y \
sudo wget curl gnupg lsb-release software-properties-common \
locales tzdata
# 设置时区和 locale
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# 安装所有依赖(包括32位)
RUN apt install -y \
# 64位依赖
bc rsync file \
python3 python3-pip build-essential \
tofrodos iproute2 gawk xvfb git make net-tools \
libncurses5-dev tftpd zlib1g-dev libssl-dev flex bison \
libselinux1 gnupg wget diffstat chrpath socat xterm \
autoconf libtool tar unzip texinfo gcc-multilib g++-multilib \
libsdl1.2-dev libglib2.0-dev screen pax gzip cpio \
# 32位库
zlib1g:i386 libstdc++6:i386 libc6:i386 lib32z1 lib32stdc++6 \
tofrodos gawk xvfb git libncurses5-dev tftpd zlib1g-dev zlib1g-dev:i386 \
libssl-dev flex bison chrpath socat autoconf texinfo gcc-multilib libsdl1.2-dev libglib2.0-dev \
screen pax bc gperf texi2html help2man libtool build-essential automake \
device-tree-compiler qemu-user-static binfmt-support multistrap lib32z1 libncurses6:i386 \
libbz2-1.0 lib32stdc++6 libgnutls28-dev kpartx zerofree u-boot-tools rpm2cpio \
libtinfo5 vim \
&& apt clean && rm -rf /var/lib/apt/lists/*
# 创建 petalinux 用户
RUN useradd -m -s /bin/bash petalinux && \
echo 'petalinux:petalinux' | chpasswd && \
echo 'petalinux ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# 设置工作目录
WORKDIR /data/working/peta
VOLUME /data/working/
# 设置环境变量
RUN echo "source ${PETALINUX_DIR}/settings.sh" >> /home/petalinux/.bashrc && \
echo "export PATH=\${PATH}:${PETALINUX_DIR}/tools/xsct/bin" >> /home/petalinux/.bashrc
# 修复权限
RUN chown -R petalinux:petalinux /home/petalinux
# 设置入口点
CMD ["/bin/bash"]
Create images:
docker build -t peta2021 .
Run images:
docker run -it \ --name petalinux-dev \ --hostname petalinux-dev \ --privileged \ --memory=8g \ --cpus=4 \ -v /data/working:/data/working \ -v /opt/sstate-cache:/opt/sstate-cache \ -v /opt/downloads:/opt/downloads \ peta2021
标签: linux
日历
最新微语
- 有的时候,会站在分叉路口,不知道向左还是右
2023-12-26 15:34
- 繁花乱开,鸟雀逐风。心自宁静,纷扰不闻。
2023-03-14 09:56
- 对于不可控的事,我们保持乐观,对于可控的事情,我们保持谨慎。
2023-02-09 11:03
- 小时候,
暑假意味着无忧无虑地玩很长一段时间,
节假意味着好吃好喝还有很多长期不见的小朋友来玩...
长大后,
这是女儿第一个暑假,
一个半月...
2022-07-11 08:54
- Watching the autumn leaves falling as you grow older together
2018-10-25 09:45
分类
最新评论
- Goonog
i get it now :) - 萧
@Fluzak:The web host... - Fluzak
Nice blog here! Also... - Albertarive
In my opinion you co... - ChesterHep
What does it plan? - ChesterHep
No, opposite. - mojoheadz
Everything is OK!... - Josephmaigh
I just want to say t... - ChesterHep
What good topic - AnthonyBub
Certainly, never it ...
发表评论: