154 lines
5.1 KiB
Plaintext
Raw Normal View History

#
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com
#
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
#
extensions framework + UEFI aarch64/x86 + rpi4b + core changes/fixes (#3300) * extensions framework (née "fragments") - this should actually change nothing at this point, just add capabilities - the framework is implemented in lib/extensions.sh - the "if function x exists then call x" replaced with call_extension_method() - +inline documentation - +compatibility names Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * extensions framework; meta-extensions: auto-docs and sample extension gen - 2 extensions dealing with extensibility itself - detect-unused-extensions: shows which extensions are enabled, but never called. - gen-sample-extension-docs: generates a sample empty extension & Markdown documentation for extensions Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * new extension methods and features via config variables in core Armbian - `SKIP_EXTERNAL_TOOLCHAINS=yes` - does not download or use any linaro toolchains, only build host-installed ones - `SKIP_BOOTSPLASH=yes` - does not patch kernel for splash file - `EXTRA_BSP_NAME=xyz` - allows for BSP variants, useful for when extensions modify the BSP - `EXTRA_ROOTFS_MIB_SIZE=x` - add x mib's to rootfs size, for use with very small images - `KERNEL_EXTRA_TARGETS` - what extra targets to make kernel for, default to "modules dtbs" - `BOOTCONFIG=none` - does not build nor install u-boot; also doesn't handle bootscripts et al - `unset KERNELSOURCE` - does not build nor install kernel, nor build initrd, nor build nor install firmware - `ARMHF_ARCH=skip` - does not add armhf to apt/dpkg, thus pure arm64 - `SKIP_ARMBIAN_REPO=yes` - results in armbian.list.disabled in the final image - define `APT_EXTRA_DIST_PARAMS` with apt-cacher-ng options and use it for `PACKAGE_LIST_INSTALL/REMOVE` et al - initial support for targeting x86/amd64 UEFI and BIOS - some do's/don'ts for x86/amd64, like a different `UBUNTU_MIRROR` default - GPT/EFI(ESP) partitions (fat, `UEFISIZE=256` to enable, mount `UEFI_MOUNT_POINT=/boot/efi`, first on disk but ends up at `$uefipart`=15) - GPT/BIOS partitions (fat, `BIOSSIZE=1` to enable, second on disk but ends up at partition 14) - `UEFI_FS_LABEL="armbiefi"` - to set the FAT label for the EFI partition, visible in Win/Mac - hard-requires gdisk package host-side - add add_host_dependencies() extension method; fill `EXTRA_BUILD_DEPS="pkg pkg2"` to install to host before toolchains download - add pre_prepare_partitions() extension method, for custom partition size calculations - add create_partition_table() extension method, used to do full-custom partitioning if `USE_HOOK_FOR_PARTITION=yes` - add post_create_partitions() extension method, mostly for easy debugging - add post_write_sdcard() extension method, where you can also set `SKIP_VERIFY=yes` to skip sdcard verification - add post_install_kernel_debs() extension method. - multiple fixes to bsp to avoid spurious errors when files are not where it expects - v4: detect `update-initramfs` failure and abort build with useful message if it does - v4: show useful stacktrace in `exit_with_error` - if `ERROR_DEBUG_SHELL=yes`, drop into a shell before unmounting/deleting everything, so we can inspect what went wrong - v4: display a message before `apt-get remove PACKAGE_LIST_BOARD_REMOVE` packages, so any errors while removing are easy to understand - v4: preserve kernel .config's dates when copying Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * extensions framework; refactor tool fetching/building into extensions - a few examples of core refactoring using extensions - sunxi-tools extension, enabled by 2 different sunxi family includes ("reuse" example) - marvel-tools extension, enabled by 2 different mvebu family includes - rkbin-tools extension, enabled by rockship64_common family include - amlogic-fip/c2-blobs stuff refactored directly into meson64_common.inc ("single-use" example) - removed the 'testings' fetch_from_repo completely since not used anywhere. Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * .wip's for UEFI arm64 and UEFI/BIOS x86 via new GRUB extension - v3: added `growroot`-awareness to `armbian-resize-filesystem` - the partition-growing part of `armbian-resize-filesystem` does not deal correctly with the UEFI layout - `growroot` is installed on UEFI images by default, that handles growing partition during initramfs - now `armbian-resize-filesystem` handles `resize2fs` only, and works. - v4: reworked UEFI board/family/include structure: - use Distro's `linux-generic` kernel only for `current` - `edge` now builds it's own pure-mainline `5.15.y` kernel, for both x86 and arm64 - `.config` taken from Ubuntu, probably needs tuning for EXTRAWIFI=yes et al - v4: introduce `SKIP_KERNEL_SYMLINK=yes`, tested in `builddeb` - to avoid symlinking kernel; u-boot likes it, but grub and flash-kernel hates it - v5: many fixes - v7: more small fixes. Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * .wip for the RaspberryPi 4B via new flash-kernel extension - this does not build it's own kernel "yet", but uses default linux-raspi kernel from Ubuntu - flash-kernel is not really a bootloader - it just prepares kernel et al a FAT partition for booting by the RPi4b bootloader - flash-kernel is standard Debian package, but has only been tested on Ubuntu releases - it is really only known-working since Hirsute release. - Debian's rpi kernel is armhf only, so out of scope here, at least until we add source-built kernels. - v3: fixed focal rootfs build. untested. - v3: better variable names, preparing for source-built kernel. - v5: new edge build with pure mainline kernel. - v6: many fixes and some hacks for packaging and layout, also firmware (using Ubuntu's) Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * Added first patch to edge x86 related to wifi drivers * extensions: leave hostapd alone; remove hackish ext; block reentrancy - package-list-utils does not belong in this PR - grub or bcm2711 is not the place to remove hostapd - block recursive enable_extension() calls, for now. Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * gen-sample-extension-docs: fix: avoid counter in generated sample Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * extensions: dependencies: enable_extension() in extensions with a stack - and better stacktraces, I hope Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * Remove code from package list since we don't have it in repository Adjust kernel config to disable driver that needs further polishing. * Allow amd64 to build the same desktops as aarch64. We only have this limit for armhf, where some desktops don't work * amd64: allow building amd64 on aarch64 with system toolchain - conditionally add gcc-x86-64-linux-gnu to hostdeps Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * add libelf-dev directly to hostdeps (and Dockerfile), remove extension Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * packaging: remove SKIP_KERNEL_SYMLINK hack, fix the root cause - which was the missing $image_name for non-arm64 & non-arm, so: x86 for example Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * grub: really obliterate u-boot stuff from BSP - for now. soon we'll refactor u-boot so not have to do this Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * flash-kernel: really obliterate u-boot stuff from BSP - for now. soon we'll refactor u-boot so not have to do this Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * extensions: add host_dependencies_ready() hook - this passes FINAL_HOST_DEPS containing all hostdeps for the run after they're installed Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * Add verification functions for correct selection. * If UEFI Skip symlink creation * Do not create dtb package for amd64 * Skip scripts folder cleaning if build process native. Skip creating postinst prerm scripts for headers. * Skip applying headers-debian-byteshift.patch if build native * Fix architecture syntax as x86_64 * Revert "amd64: allow building amd64 on aarch64 with system toolchain" This reverts commit 0c5ee20bb1b33a133e6e359476082d43d5ad457c. * Compare architectures before starting compilation. Signed-off-by: The-going <48602507+The-going@users.noreply.github.com> * extensions: cleanups after fixes by the-Going - packaging: - there is _no need_ anymore for the symlink hack, CONFIG_EFI or no. But check is great, see below - it's not `amd64` that has no DTB's, it's all UEFI, thus: `is_enabled CONFIG_EFI`, thanks! - Explicitly disallow "reverse cross compile" in amd64.conf. - whitespace-only-deletions: revert. we shall shellfmt the whole thing one day, but not today. - fix a few syntax warnings in newly introduced code (floating `$ARCH` vs `"${ARCH}`) - blame shellcheck Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * packaging: fix: turns out a lot of boards have CONFIG_EFI=y, can't use that for dtb/no-dtb decision. Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * grub: remove debug Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * firmware: allow installing `armbian-firmware-full`; make it really full - can now use `BOARD_FIRMWARE_INSTALL="-full"` to install full firmware for the board. enable for UEFI. - don't rely on KERNELSOURCE for firmware-related decisions. introduce `INSTALL_ARMBIAN_FIRMWARE` which defaults to `yes` - rpi4b/flash-kernel: disable Armbian firmware; we need linux-firmware-raspi2, which conflicts. Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * extensions: log to /${LOG_SUBPATH}/ instead of fixed /debug/ Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * extensions: introduce cleanup_extension_manager() called by build-all-ng's unset_all() - to reset/unset everything done by the the initializer, so build can run again Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * extensions: remove 'global' logging, for use with build_all_ng - enable_extensions() will have to live on without logging to file. it's just too early. - now init EXTENSION_MANAGER_TMP_DIR in initialize_extension_manager() - now init EXTENSION_MANAGER_LOG_FILE in initialize_extension_manager() Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * extensions: build-all-ng.sh bugfix due to extension's debug to stdout - extensions (among other things) can produce output to stdout when activated - fix: check_hash() produced "idential" (sic, now changed to IDENTICAL) to stdout as a trigger - debugging output got mixed with "idential", rendering hash cache void for families that used extensions - eg: sunxi, others - fix is to send stdout to the bitbucket when sourcing the board & arch config files - proper fix would be stop using stdout in this case and use return code for check_hash() - one day soon Signed-off-by: Ricardo Pardini <ricardo@pardini.net> * Add CI build targets Co-authored-by: Igor Pecovnik <igor.pecovnik@gmail.com> Co-authored-by: The-going <48602507+The-going@users.noreply.github.com>
2021-12-06 09:49:49 +01:00
enable_extension "marvell-tools"
ARCH=arm64
BOOTBRANCH='tag:v2022.04'
BOOTPATCHDIR="v2022.07"
BOOTENV_FILE='mvebu64.txt'
BOOTSCRIPT_OUTPUT='boot.scr'
ATFSOURCE='https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git'
ATFDIR='arm-trusted-firmware-espressobin'
ATFBRANCH='branch:master'
ATF_USE_GCC='> 7.2'
if [[ "${SKIP_EXTERNAL_TOOLCHAINS}" == "yes" ]]; then
ATF_COMPILER='aarch64-linux-gnu-'
else
ATF_COMPILER='aarch64-none-linux-gnu-'
fi
if [[ $BOARD = macchiatobin-doubleshot ]]; then
export SCP_BL2=$SRC/cache/sources/marvell-binaries/mrvl_scp_bl2.img
ATF_TARGET_MAP="USE_COHERENT_MEM=0 LOG_LEVEL=20 MV_DDR_PATH=$SRC/cache/sources/marvell-ddr SECURE=0 PLAT=a80x0_mcbin;;build/a80x0_mcbin/release/bl31.bin"
UBOOT_TARGET_MAP="DEVICE_TREE=armada-8040-mcbin ;;flash-image.bin"
BOOTSCRIPT="boot-macchiatobin-doubleshot.cmd:boot.cmd"
SERIALCON='ttyS0'
else
ATF_TARGET_MAP="USE_COHERENT_MEM=0 LOG_LEVEL=20 SECURE=0 CLOCKSPRESET=CPU_800_DDR_800 DDR_TOPOLOGY=2 BOOTDEV=SPINOR PARTNUM=0 PLAT=a3700;;build/a3700/release/bl31.bin"
UBOOT_TARGET_MAP="DEVICE_TREE=armada-3720-espressobin ;;flash-image-*.bin"
BOOTSCRIPT="boot-espressobin.cmd:boot.cmd"
SERIALCON='ttyMV0'
fi
case $BRANCH in
current)
Remove K<4, change branches, new features (#1586) AR-1 - Adding support category for distributions AR-4 - Remove Allwinner legacy AR-5 - Drop Udoo family and move Udoo board into newly created imx6 family AR-9 - Rename sunxi-next to sunxi-legacy AR-10 - Rename sunxi-dev to sunxi-current AR-11 - Adding Radxa Rockpi S support AR-13 - Rename rockchip64-default to rockchip64-legacy AR-14 - Add rockchip64-current as mainline source AR-15 - Drop Rockchip 4.19.y NEXT, current become 5.3.y AR-16 - Rename RK3399 default to legacy AR-17 - Rename Odroid XU4 next and default to legacy 4.14.y, add DEV 5.4.y AR-18 - Add Odroid N2 current mainline AR-19 - Move Odroid C1 to meson family AR-20 - Rename mvebu64-default to mvebu64-legacy AR-21 - Rename mvebu-default to mvebu-legacy AR-22 - Rename mvebu-next to mvebu-current AR-23 - Drop meson64 default and next, current becomes former DEV 5.3.y AR-24 - Drop cubox family and move Cubox/Hummingboard boards under imx6 AR-26 - Adjust motd AR-27 - Enabling distribution release status AR-28 - Added new GCC compilers AR-29 - Implementing Ubuntu Eoan AR-30 - Add desktop packages per board or family AR-31 - Remove (Ubuntu/Debian) distribution name from image filename AR-32 - Move arch configs from configuration.sh to separate arm64 and armhf config files AR-33 - Revision numbers for beta builds changed to day_in_the_year AR-34 - Patches support linked patches AR-35 - Break meson64 family into gxbb and gxl AR-36 - Add Nanopineo2 Black AR-38 - Upgrade option from old branches to new one via armbian-config AR-41 - Show full timezone info AR-43 - Merge Odroid N2 to meson64 AR-44 - Enable FORCE_BOOTSCRIPT_UPDATE for all builds
2019-11-19 23:25:39 +01:00
export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
2022-03-01 15:10:04 +01:00
KERNELBRANCH='branch:linux-5.15.y'
;;
edge)
export KERNEL_MAJOR_MINOR="6.1" # Major and minor versions of this kernel.
KERNELBRANCH='branch:linux-6.1.y'
;;
Changes to build script and patches adjustment (#1423) - change console welcome text - changed display manager to lightdm by default and remove nodm completly - desktop login manager enabled by default, toogle can be done with armbian-config - added URL to the build script and commit hash to /etc/armbian-release file - added debconf-utils,html2text,mmc-utils,sunxi-tools to the base and additional pkg list - added synaptic package manager and onboard keyboard to the desktop base - changed motd console welcome text to: Welcome to Debian Stretch with Armbian Linux 5.1.6-sunxi - added "logout" to the panel/menu - added normal users to additional groups: disk tty users games * Adjust tabs and alter displaying build options at the end - hide empty ones * Fix wrong MOTD message, adjust logic to autologin by default and request login for both notebooks * Making fs cache naming more intuitive, rename script * Move additional kernel drivers into separate file. Add AUFS for K5.1 this way, attach wireguard sources to last known working tag. master is broken atm * Add two more extra wireless drivers 88x2BU, (improved) 8811EU and introduce switch EXTRAWIFI which is enabled by default * Move 8812AU to the same version we have now. More recent has some performance issues in AP mode. Adjust configuration, add mvebut-dev 5.1.y kernel * Enable Wireguard also on 3.10.y since it was fixed upstream. Attach bach to master branch since its working now * Rockchip64 & RK3399 - upstream patches and remove deprecated patches, mvebu64 add DEV kernel attached to 5.1.y * Enable BT on Tinkerboard CLI images as well * cubox-i move to 5.1.y and enable missing HDMI * Bugfixes for adding wireless driver to Kconfig. Adjusted RK3399 kernel due to upstream changes at FriendlyARM - does not boot yet. Changes has to be extract from their commits. Removed patches with RTL8188EU since we add more recent driver with a new precedure. Small fixes mvebu-default, udoo-next, s56818-next, ... remove deprecated patches. * Boot-able RK3399-default config, add upstream patches for K4.4.y mvebu-default/udoo-next * Adjust overclocking patch to meet upstream changes * Odroid XU4 - remove deprecated kernel patches
2019-06-26 07:31:11 +02:00
esac
CPUMIN=200000
CPUMAX=1300000
GOVERNOR=ondemand
NM_IGNORE_DEVICES="interface-name:eth*,interface-name:wan*,interface-name:lan*,interface-name:br*"
write_uboot_platform() {
if [[ $BOARD = macchiatobin-doubleshot ]]; then
dd if=$1/flash-image.bin of=$2 bs=512 seek=1 status=noxfer > /dev/null 2>&1
else
# flashing process via u-boot only for now https://www.armbian.com/espressobin/
/bin/true
fi
}
family_tweaks() {
chroot_sdcard_apt_get remove --auto-remove linux-sound-base alsa-base alsa-utils bluez
2018-05-24 15:40:20 +02:00
[[ -f $SDCARD/etc/netplan/armbian-default.yaml ]] && sed -i "s/^ renderer.*/ renderer: networkd/" $SDCARD/etc/netplan/armbian-default.yaml
cp $SRC/packages/bsp/mvebu64/networkd/10* $SDCARD/etc/systemd/network/
if [[ $BOARD = "espressobin" ]]; then
echo "#Marvell Espressobin Console" >> $SDCARD/etc/securetty
echo "ttyMV0" >> $SDCARD/etc/securetty
fi
}
family_tweaks_bsp() {
if [[ $BOARD = "espressobin" ]]; then
cp "$SRC/packages/bsp/mvebu64/initramfs/99-uboot-fit" "$destination/etc/initramfs/post-update.d/"
fi
}
atf_custom_postprocess() {
# prepare compilers for postprocess
ubootdir="$SRC/cache/sources/$BOOTDIR/${BOOTBRANCH##*:}"
export ATF1=$toolchain/$ATF_COMPILER
if [[ "${SKIP_EXTERNAL_TOOLCHAINS}" == "yes" ]]; then
export TOOLCHAIN_NAME="arm-linux-gnueabi-"
else
export TOOLCHAIN_NAME="arm-none-linux-gnueabihf-"
fi
export ATF2=$(find_toolchain "$TOOLCHAIN_NAME" "> 10.0")/$TOOLCHAIN_NAME
export BL33=$ubootdir"/u-boot.bin"
}
uboot_custom_postprocess() {
# clean previous
rm $ubootdir/flash-image*
local atfdir="$SRC/cache/sources/$ATFDIR/${ATFBRANCH##*:}"
local ubootdir="$SRC/cache/sources/$BOOTDIR/${BOOTBRANCH##*:}"
local moxbootdir="$SRC/cache/sources/mox-boot"
cd $atfdir
if [[ $BOARD = macchiatobin-doubleshot ]]; then
run_host_command_logged make distclean
FILENAME="flash-image.bin"
display_alert "Building $FILENAME" "" "info"
# http://wiki.macchiatobin.net/tiki-index.php?page=Build+from+source+-+Bootloader#Building_ATF
run_host_command_logged make distclean
run_host_command_logged make USE_COHERENT_MEM=0 LOG_LEVEL=20 MV_DDR_PATH=$SRC/cache/sources/marvell-ddr PLAT=a80x0_mcbin CROSS_COMPILE=$ATF1 BL33=$BL33 mrvl_flash $CTHREADS
run_host_command_logged cp -pv build/a80x0_mcbin/release/flash-image.bin $ubootdir/$FILENAME
else
cd $moxbootdir
make clean # @TODO: rpardini: why?
run_host_command_logged make CROSS_CM3=$ATF2 wtmi_app.bin
cd $atfdir
clocks=(600_600 800_800 1000_800 1200_750)
topology=(512m_1cs_0 1g_2cs_2 1g_1cs_4 2g_2cs_7 1g_1cs_5 2g_2cs_6)
for i in "${clocks[@]}"; do
for j in "${topology[@]}"; do
if [[ $j = *cs_5 || $j = *cs_6 ]]; then local ddrname="DDR4"; else ddrname="DDR3"; fi
FILENAME="flash-image-$ddrname-$j-$i.bin"
DDR_TOPOLOGY="${j##*_}"
CLOCKSPRESET="CPU_${i%_*}_DDR_${i##*_}"
display_alert "Building $FILENAME" "" "info"
run_host_command_logged make distclean
run_host_command_logged make CROSS_COMPILE=$ATF1 \
CROSS_CM3=$ATF2 \
USE_COHERENT_MEM=0 \
PLAT=a3700 \
CLOCKSPRESET=$CLOCKSPRESET DDR_TOPOLOGY=$DDR_TOPOLOGY \
MV_DDR_PATH=$SRC/cache/sources/marvell-ddr \
WTP=$SRC/cache/sources/marvell-tools \
CRYPTOPP_PATH=$SRC/cache/sources/cryptopp \
BL33=$BL33 \
WTMI_IMG=$moxbootdir/wtmi_app.bin \
BOOTDEV=SPINOR PARTNUM=0 \
LOG_LEVEL=20 all fip mrvl_flash $CTHREADS
run_host_command_logged cp -pv build/a3700/release/flash-image.bin $ubootdir/$FILENAME
done
done
fi
cd $ubootdir
}