Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PKGBUILD was missing quite a bit to successfully build. #4

Open
wants to merge 2 commits into
base: orangepi4
Choose a base branch
from

Conversation

EndlessEden
Copy link

  1. makedepends: Added dtc

  2. toolchain: x86_64 hosts fail to build with gcc-10 toolchain, only successful build i had against 2020.03, were against the arm-specific gcc-8.2-2019.01 (aarch64-linux-gnu + arm-eabi) toolchains. Since gcc-82 is not available for x86_64(archlinux) and building against aarch64-linux-gnu-10 + gcc-arm-none-eabi-bin-82 doesnt work (see Kernel wont boot #2 (comment) ) I added the arm toolchain into the source array, and build against it.

as Arm doesnt provide toolchains for aarch64 hosts, only x86 and x86_64, gcc-arm-none-eabi for aarch64 hosts was added to makedepends conditionally; ill add the gcc-arm-none-eabi package to the aur later, as im still working on it.

  1. flags: unset doesnt seem to actually unset makepkg.conf flags for some reason, added conditional statement to ensure that the flags are unset so it will build
    Also re-exported path update for toolchain(See 2.), as make was ignoring the globally exported path variable set earlier.

@EndlessEden EndlessEden mentioned this pull request Jan 25, 2021
PKGBUILD Outdated
url='http://www.denx.de/wiki/U-Boot/WebHome'
license=('GPL')
backup=('boot/boot.txt' 'boot/boot.scr')
makedepends=('bc' 'git')
makedepends=('bc' 'git' 'dtc')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good change, this is required by u-boot.

@@ -9,11 +9,12 @@ pkgver=2021.01
pkgrel=1
_srcname=u-boot-${pkgver}
pkgdesc="U-Boot for Orange Pi 4"
arch=('aarch64')
arch=('x86_64' 'aarch64')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arch specifies the architectures the PKGBUILD is "intended to build and work on." The RK3399 is aarch64 only.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this uboot version cannot be built in qemu for aarch64; there is a memory mapping error the compiler throws. (I don't have logs off-hand) | i can remove this, and further x86_64 relative flags. But there will be no way to compile it without the physical hardware. Without a updated and existing package to install, users will be left with no way to use this.

url='http://www.denx.de/wiki/U-Boot/WebHome'
license=('GPL')
backup=('boot/boot.txt' 'boot/boot.scr')
makedepends=('bc' 'git')
makedepends=('bc' 'git' 'dtc')
options=(!distcc !strip !ccache)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any reason to override the user's configs here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strip breaks cross compiling and provides no benefit outside of binary sizes afaik; Will remove, but advising my reason for admission.
distcc and ccache is a uncaught mistake, a leftover from the testing environment; will remove.

PKGBUILD Outdated
Comment on lines 32 to 94
PHOST="$CARCH"
case "$CARCH" in
aarch64) makedepends+=('gcc-arm-none-eabi' 'gcc')
;;
x86_64) source+=('gcc-arm-8.2-2019.01-x86_64-arm-eabi.tar.xz::https://developer.arm.com/-/media/Files/downloads/gnu-a/8.2-2019.01/gcc-arm-8.2-2019.01-x86_64-arm-eabi.tar.xz?revision=72b9b9ec-30c5-4543-ae95-3d840eb01dae&la=en&hash=C898D59AC42008ED0527538ADF200C11F3E8F53A'
'gcc-arm-8.2-2019.01-x86_64-aarch64-linux-gnu.tar.xz::https://developer.arm.com/-/media/Files/downloads/gnu-a/8.2-2019.01/gcc-arm-8.2-2019.01-x86_64-aarch64-linux-gnu.tar.xz?revision=21270570-4ec0-4bad-a9e1-09707614066a&la=en&hash=AFEDF645AF5B94336DB4E1E608806CEC87A02B8A')
md5sums+=('fc11c4f55085c613133d7527a00fed8a'
'ed467a18abc7cf81d53c0cf6014b1867')
_pkgarch="aarch64"
CARCH="aarch64"
CHOST="aarch64-linux-gnu-"
export PATH="${srcdir}/aarch64/bin:${PATH}"
export ARCH='aarch64'
export CROSS_COMPILE='aarch64-linux-gnu-'
;;
esac

prepare() {
cd ${srcdir}/${_srcname}
patch -p1 -i ../add-board-orangepi-4.patch

if [ -e ${srcdir}/gcc-arm-8.2-2019.01-x86_64-aarch64-linux-gnu.tar.xz ]; then
if [ -d ${srcdir}/aarch64 ]; then
rm -r ${srcdir}/aarch64
fi
echo "Preparing Cross-Compilers"
cd ${srcdir}/
mkdir aarch64
cd aarch64
cp -r ../gcc-arm-8.2-2019.01-x86_64-aarch64-linux-gnu/* ./
cp -r ../gcc-arm-8.2-2019.01-x86_64-arm-eabi/* ./
echo "symbolic linking arm-eabi to arm-none-eabi"
cd bin
ln -s arm-eabi-addr2line arm-none-eabi-addr2line
ln -s arm-eabi-c++filt arm-none-eabi-c++filt
ln -s arm-eabi-gcc arm-none-eabi-gcc
ln -s arm-eabi-gcc-ranlib arm-none-eabi-gcc-ranlib
ln -s arm-eabi-gdb arm-none-eabi-gdb
ln -s arm-eabi-ld.bfd arm-none-eabi-ld.bfd
ln -s arm-eabi-ranlib arm-none-eabi-ranlib
ln -s arm-eabi-strip arm-none-eabi-strip
ln -s arm-eabi-ar arm-none-eabi-ar
ln -s arm-eabi-cpp arm-none-eabi-cpp
ln -s arm-eabi-gcc-8.2.1 arm-none-eabi-gcc-8.2.1
ln -s arm-eabi-gcov arm-none-eabi-gcov
ln -s arm-eabi-gfortran arm-none-eabi-gfortran
ln -s arm-eabi-nm arm-none-eabi-nm
ln -s arm-eabi-readelf arm-none-eabi-readelf
ln -s arm-eabi-as arm-none-eabi-as
ln -s arm-eabi-elfedit arm-none-eabi-elfedit
ln -s arm-eabi-gcc-ar arm-none-eabi-gcc-ar
ln -s arm-eabi-gcov-dump arm-none-eabi-gcov-dump
ln -s arm-eabi-gprof arm-none-eabi-gprof
ln -s arm-eabi-objcopy arm-none-eabi-objcopy
ln -s arm-eabi-size arm-none-eabi-size
ln -s arm-eabi-c++ arm-none-eabi-c++
ln -s arm-eabi-g++ arm-none-eabi-g++
ln -s arm-eabi-gcc-nm arm-none-eabi-gcc-nm
ln -s arm-eabi-gcov-tool arm-none-eabi-gcov-tool
ln -s arm-eabi-ld arm-none-eabi-ld
ln -s arm-eabi-objdump arm-none-eabi-objdump
ln -s arm-eabi-strings arm-none-eabi-strings
fi
Copy link
Owner

@jakogut jakogut Jan 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think downloading and configuring a cross compiler is out of the scope of this PKGBUILD. I personally create a separate makepkg config, such as /etc/makepkg-arm64.conf like so:

source /etc/makepkg.conf

CARCH="aarch64"
CHOST="aarch64-linux-gnu"

export ARCH='arm64'
export CROSS_COMPILE='aarch64-linux-gnu-'

CPPFLAGS=""
CFLAGS="-march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt"
CXXFLAGS="-march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt"
LDFLAGS=""

Then I make a little script to run makepkg with this config, such as /usr/bin/makepkg-arm64:

#!/bin/bash
makepkg --config "/etc/makepkg-arm64.conf" "$@"

This way the toolchain can be installed and updated from the Arch repos (aarch64-linux-gnu-gcc in this case), and you can cross compile other packages as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jakogut - The problem lies with it failing to compile for bare-metal with any other toolchain(See: ARM-software/tf-issues#650) on non-aarch64 hosts. This includes building the same toolchain from source.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologize, apparently my brain is mush with lack of sleep. | x86_64 hosts cannot compile without that toolchain for initial package creation, as qemu cannot create bare-metal binaries due to a memory mapping error(see above) | i have no problem removing these as it was exclusive for the cross-compiling, and they can be added to a custom makepkg config, as you specified.

Although, id recommend adding notes, as that specific version of the toolchain is the ONLY compatible compiler on x86_64/x86(i686)

Comment on lines +101 to +104
CPPFLAGS=""
CFLAGS=""
CXXFLAGS=""
LDFLAGS=""
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are already unset above.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unset doesnt work currently, its ignored.

…toolchain; moved to extlinux config; removed boot.txt/mkscr -- Some undocumented changes may exist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants