Tested to build E2000 yocto project in OBS machine

This commit is contained in:
root 2023-04-11 16:19:04 +08:00
commit 4c33f38b79
3 changed files with 160 additions and 0 deletions

42
Dockerfile Normal file
View File

@ -0,0 +1,42 @@
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
#Install depends PKGS & Add user AcoSailBuilder for non-root require.
#Set AcoSailBuilder passwd as "acosail"
#Sudo is needed for mounting host volume!
RUN apt-get update && \
apt-get install -y curl git gawk wget git-core diffstat unzip texinfo gcc-multilib \
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 libncursesw5-dev openssl libssl-dev zstd \
python2.7 locales sudo && \
rm -rf /var/lib/apt/lists/* && \
ln -s /usr/bin/python3 /usr/bin/python && \
useradd -ms /bin/bash AcoSailBuilder && \
usermod -aG sudo AcoSailBuilder && \
echo 'AcoSailBuilder:acosail' | chpasswd
USER AcoSailBuilder
RUN mkdir -p /home/AcoSailBuilder/bin && \
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo && \
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo' && \
chmod a+x ~/bin/repo
ENV PATH="/home/AcoSailBuilder/bin:${PATH}"
#Get project
#add host volume into docker
#Fix ssh unkonwn error
RUN mkdir ~/workspace && \
cd ~/workspace && \
repo init -u https://gitee.com/phytium_embedded/phytium-linux-yocto.git -m default.xml && \
repo sync --force-sync && \
mkdir ~/build_dir && \
mkdir ~/.ssh && \
ssh-keyscan gitee.com >> ~/.ssh/known_hosts
#Fix yocto fetch kernel error, but may not be the dest solution
COPY linux-phytium.inc ~/workspace/sources/meta-phytium/meta-bsp/recipes-kernel/linux/linux-phytium.inc

53
README.md Normal file
View File

@ -0,0 +1,53 @@
# E2000 builder Dockerfile
Useing FT Offical E2000 build system BASED on Ubuntu 20.04 and yocto project.
Make Sure your host volume has lager than 50GB free space.
# How to build Docker
~~~bash
sudo docker build -t ft-e2000-builder:1.1 .
~~~
# How to Init this docker for use
~~~bash
export BUILD_DIR=/data/build_dir
sudo docker run -it --rm -u 1000:1000 -v ${BUILD_DIR}:/home/AcoSailBuilder/build_dir ft-e2000-builder:1.1 /bin/bash
~~~
In the docker, then, for the first time, do as following.
~~~bash
cd ~
sudo chown AcoSailBuilder:AcoSailBuilder build_dir
#passed is "acosail".
cp -rdp workspace build_dir/
cd build_dir/workspace
source setup-env -m e2000
#Say "y" when dialog shows up.
#Then project is ready to go.
~~~
Or, do as following for other times.
~~~bash
cd ~/build_dir/workspace
source setup-env -m e2000
#This is for have build env
~~~
# How to build core-image-minimal
~~~bash
#After Init project,
#you should in dir /home/AcoSailBuilder/build_dir/workspace/build_e2000/
bitbake core-image-minimal
~~~
# Where to get builled files
Everything is placed in "${BUILD_DIR}/workspace/build_e2000/tmp/deploy/"
Kernel image is in "${BUILD_DIR}/workspace/build_e2000/tmp/deploy/images/e2000"
# FAQ
## bitbake error
If error is about kernel, you may need to change "linux-phytium.inc", to fix download error.
Like changing ssh to https for git clone.
If error is about other downloads, you may need to rerun "bitbake core-image-minimal".

65
linux-phytium.inc Normal file
View File

@ -0,0 +1,65 @@
SRC_URI = "git://git@gitee.com/phytium_embedded/phytium-linux-kernel.git;protocol=ssh;branch=${KERNEL_BRANCH} "
inherit kernel siteinfo
inherit phy-kernel-localversion
SUMMARY = "Linux Kernel for Phytium platforms"
SECTION = "kernel"
LICENSE = "GPLv2"
S = "${WORKDIR}/git"
DEPENDS_append = " libgcc u-boot-tools-native"
# not put Images into /boot of rootfs, install kernel-image if needed
RDEPENDS_${KERNEL_PACKAGE_NAME}-base = ""
KERNEL_CC_append = " ${TOOLCHAIN_OPTIONS}"
KERNEL_LD_append = " ${TOOLCHAIN_OPTIONS}"
KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
FILES_${KERNEL_PACKAGE_NAME}-base += " ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin.modinfo "
KERNEL_CONFIG_COMMAND = "oe_runmake_call -C ${S} CC="${KERNEL_CC}" O=${B} olddefconfig || oe_runmake -C ${S} O=${B} CC="${KERNEL_CC}" oldnoconfig"
ZIMAGE_BASE_NAME = "zImage-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
ZIMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
SCMVERSION ?= "y"
LOCALVERSION = ""
DELTA_KERNEL_DEFCONFIG ?= ""
DELTA_KERNEL_DEFCONFIG_prepend = "e2000_defconfig"
do_merge_delta_config[dirs] = "${B}"
do_merge_delta_config() {
# create config with make config
oe_runmake -C ${S} O=${B} ${KERNEL_DEFCONFIG}
# check if bigendian is enabled
if [ "${SITEINFO_ENDIANNESS}" = "be" ]; then
echo "CONFIG_CPU_BIG_ENDIAN=y" >> .config
echo "CONFIG_MTD_CFI_BE_BYTE_SWAP=y" >> .config
fi
# add config fragments
for deltacfg in ${DELTA_KERNEL_DEFCONFIG}; do
if [ -f ${S}/arch/${ARCH}/configs/${deltacfg} ]; then
oe_runmake -C ${S} O=${B} ${deltacfg}
elif [ -f "${WORKDIR}/${deltacfg}" ]; then
${S}/scripts/kconfig/merge_config.sh -m .config ${WORKDIR}/${deltacfg}
elif [ -f "${deltacfg}" ]; then
${S}/scripts/kconfig/merge_config.sh -m .config ${deltacfg}
fi
done
cp .config ${WORKDIR}/defconfig
}
do_uboot_mkimage() {
uboot-mkimage -A arm64 -O linux -T kernel -C none -a 0x80080000 -e 0x80080000 -n "4.19" -d ${DEPLOY_DIR_IMAGE}/Image ${DEPLOY_DIR_IMAGE}/uImage
}
addtask merge_delta_config before do_preconfigure after do_patch do_prepare_recipe_sysroot
addtask uboot_mkimage before do_package_write_rpm after do_deploy
FILES_${KERNEL_PACKAGE_NAME}-image += "/boot/zImage*"