Preface
The goal of this write-up is to create an development environment for armhfp (arm 32bit) so one can get started with their own special projects.
I’m aware, to some extent, this will follow my personal workflow preferences and apologize for this upfront. (It makes the writ-up a bit easier )
Which brings us to the choice of distro the use as development environment. CentOS-el7 starts to show it’s age and that’s not funny when doing development. More over some packages (nodejs in particularly) can not be build on el7 armhfp. (long story about missing back-ports to gcc and missing SCL’s)
Instead of suggesting my personal choice (mageia) going to use Fedora 34 here.
Unfortunately could not find a fedora offical image running armhfp on a Raspberry PI4 so created a custom one with a homebuild kernel
First of all; Why still armhfp (32bit)?
On el7-arm we are between a rock and a hard place.
The rock: RHEL pulled the plug on el7 aarch64 (64bit) in 2019, hence epel-7 for aarch64 is not maintained since then. Centos SIG however maintains aarch64 including SCL’s.
The hard place: armhfp has no official epel-7 but a good maintained (unreleased) rebuild of it, however no SCL’s.
Lacking an epel-7 makes it unfeasible to fully support aarch64, hence armhfp is the preferred arch for ns7.
Setting up fc34
If you are using a RPI4 download the custom image, otherwise download the official FC34 minimal image, and flash it to a SD-card.
Using the custom RPI4 image: (ssh)login as root (password: fedora), change root password, set hostname and timezone: (as an example)
passwd
hostnamectl set-hostname <FQDN>
timedatectl set-timezone Europe/Amsterdam
grow the rootfs partition:
growpart /dev/mmcblk0 2
resize2fs /dev/mmcblk0p2
create a user
useradd -c "Full Name" -G wheel <user>
passwd <user>
and logout as root and login as <user>
(If using the official image you need to connect a monitor / keyboard and follow the instructions)
Installing minimal requirements
sudo dnf install -y wget which mc git mock rpm-build rpmdevtools
sudo dnf install http://packages.nethserver.org/nethserver/7/arm-base/armhfp/Packages/nethserver-mock-1.6.3-1.ns7.noarch.rpm
mc as an minimal requirement?
yep, you are going to love it inspecting the rpm’s you build
user setup
sudo usermod -a -G mock <user>
git config --global user.name "<user>"
git config --global user.email "email_adress"
If you are a sissy like me:
git config --global core.editor "nano -w"
Now you are pretty much good to go developing
First tests/builds
test 1 (check if mock is functional)
mkdir -p ~/development/nethserver
cd ~/development/nethserver
mock -r nethserver-7-armhfp --init
test 2 (rebuild a nethsever module)
cd ~/development/nethserver
git clone https://github.com/NethServer/nethserver-release
cd nethserver-release
make-rpms nethserver-release.spec
test 3 (rebuild a package)
cd ~/development/nethserver
mkdir -p nano/org && cd nano/org
wget http://vault.centos.org/8.4.2105/BaseOS/Source/SPackages/nano-2.9.8-1.el8.src.rpm
cd ..
mock -r nethserver-7-armhfp --resultdir=. org/nano-2.9.8-1.el8.src.rpm
SPOILER ALERT: the build fails (encourage you to try it to see / learn from the build log)
# it's very trivial, a unpackaged html doc we do not want anyways;
# so let's fix it
rpm -i org/nano-2.9.8-1.el8.src.rpm
nano ~/rpmbuild/SPECS/nano.spec
# On line 50 add ,faq to the html files to be removed
# 49 # remove installed HTML documentation
# 50 rm -f %{buildroot}%{_docdir}/nano/{nano,nano.1,nanorc.5,rnano.1,faq}.html
rpmbuild -bs ~/rpmbuild/SPECS/nano.spec
mv ~/rpmbuild/SRPMS/nano-2.9.8-1.fc34.src.rpm org/
# let's try agian
mock -r nethserver-7-armhfp --resultdir=. org/nano-2.9.8-1.fc34.src.rpm
Happy Hacking
(note this is wikified go improve this! )