先に紹介したUbuntu Mate 18.04 踊るデスクトップ上で、Intel SoC FPGA用のユーザランドを構築するメモ。組込の開発ではたいていガイド通りにはいかないので、柔軟に対応していく必要がある。
総合ガイド
Wiki:https://rocketboards.org/foswiki/Documentation/GSRDCompilingLinux
参考:https://service.macnica.co.jp/library/126489
踊るデスクトップ機能は封印。MATE Tweak => ウィンドウ => Marco (Adaptive compositor)
Wikiではホームにワークディレクトリを作っているが、仮想マシンを柔軟に使っていく私の流儀では/opt/alteraに100GB程度の仮想HDDをマウントし、そこに全てを入れる。つまり、ワークディレクトリは/opt/altera/angstrom-buildとなる。
開発に必要なパッケージ
Wikiでは「phablet-tools」も入れているが、repoコマンドかその依存物をあてにしたものであり、不要なはず。他にも不要なものはあるが、パッケージが存在しているものは入れておく。
sudo apt instlal sed wget cvs subversion git-core coreutils unzip texi2html texinfo libsdl1.2-dev docbook-utils gawk python-pysqlite2 diffstat help2man make gcc build-essential g++ desktop-file-utils chrpath libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf automake groff libtool xterm lib32z1 lib32ncurses5 lib32stdc++6
以下、ユーザ権限で操作している。Wikiから変えたところはコメントしている。
mkdir /opt/altera/angstrom-build
cd /opt/altera/angstrom-build
wget http://releases.rocketboards.org/release/2019.04/src/altera.xml
wget http://commondatastorage.googleapis.com/git-repo-downloads/repo
chmod 777 repo
export PATH=$PATH:/opt/altera/angstrom-build
repo init -u git://github.com/Angstrom-distribution/angstrom-manifest -b angstrom-v2018.12-thud
mkdir -p .repo/local_manifests
mv altera.xml .repo/local_manifests/
repo sync
MACHINE=cyclone5 . ./setup-environment
sed -i '/meta-altera/a \ \ ${TOPDIR}\/layers\/meta-altera-refdes \\' conf/bblayers.conf
sed -i '/meta-atmel/d' conf/bblayers.conf
sed -i '/meta-freescale/d' conf/bblayers.conf
echo "DISTRO_FEATURES_remove = \" wayland \"" >> conf/local.conf
echo "DISTRO_FEATURES_remove = \" alsa \"" >> conf/local.conf
export KERNEL_PROVIDER=linux-altera-ltsi
export KERNEL_TAG=refs/tags/ACDS19.1_REL_GSRD_PR
export KBRANCH=socfpga-4.14.73-ltsi
export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE KBRANCH KERNEL_TAG UBOOT_TAG KERNEL_PROVIDER"
rm -rf /opt/altera/angstrom-build/layers/meta-altera-refdes/recipes-altera/*
bitbake gsrd-console-image
あとはベーキング完了待ち。長いのは初回だけだが、気長に2時間〜約半日放置する。 待ち時間はホスト/ネットの環境次第。うまくいけば、
deploy/glibc/images/cyclone5/
に各種イメージファイルが生成される。
Kernelの構築
bitbakeでKernelを作ることもできるが、新しいtoolchainを使ってKernelを構築する。理由:MicroSDイメージに含まれているKernelについては新しいtoolchainで構築されている。
mkdir /opt/altera/toolchain
cd /opt/altera/toolchain
wget https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf.tar.xz
tar axf gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf.tar.xz
ln -s gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin
cd /opt/altera
git clone https://github.com/altera-opensource/linux-socfpga
cd linux-socfpga
git checkout socfpga-4.14.73-ltsi
vi Makefile
make socfpga_defconfig
make -j3 zImage