2023-03-09 18:30:40 +01:00
|
|
|
#
|
|
|
|
|
# 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 "rkbin-tools"
|
2019-11-19 23:25:39 +01:00
|
|
|
ARCH=arm64
|
|
|
|
|
KERNEL_IMAGE_TYPE=Image
|
|
|
|
|
OFFSET=16
|
|
|
|
|
BOOTSCRIPT='boot-rockchip64.cmd:boot.cmd'
|
2022-07-13 15:07:39 +00:00
|
|
|
BOOTENV_FILE='rockchip64.txt'
|
2019-11-19 23:25:39 +01:00
|
|
|
UBOOT_TARGET_MAP=";;idbloader.bin uboot.img trust.bin"
|
|
|
|
|
BOOTDELAY=0
|
|
|
|
|
OVERLAY_PREFIX='rockchip'
|
2020-06-14 20:51:25 +02:00
|
|
|
SERIALCON=${SERIALCON:=$([ $BRANCH == "legacy" ] && echo "ttyFIQ0:1500000" || echo "ttyS2:1500000")}
|
2019-11-19 23:25:39 +01:00
|
|
|
GOVERNOR="ondemand"
|
2021-10-27 21:45:22 +02:00
|
|
|
ATFPATCHDIR='atf-rockchip64'
|
2022-11-07 21:29:00 +01:00
|
|
|
BOOTPATCHDIR="${BOOTPATCHDIR:-"u-boot-rockchip64"}"
|
2020-09-19 22:35:21 +02:00
|
|
|
PACKAGE_LIST_FAMILY="ethtool"
|
2019-11-19 23:25:39 +01:00
|
|
|
|
2020-05-03 19:15:46 +02:00
|
|
|
RKBIN_DIR="$SRC/cache/sources/rkbin-tools"
|
2022-03-21 00:58:21 +03:00
|
|
|
|
2022-06-19 18:14:34 +00:00
|
|
|
# Common variables:
|
|
|
|
|
# BOOT_SCENARIO - determines which tpl (ddrbin), spl and ATF combination to use
|
|
|
|
|
#
|
|
|
|
|
# Different boot scenario can arrange:
|
|
|
|
|
# * Phase 1: DDR initialization (proprietary rockchip ddrbin or u-boot TPL)
|
|
|
|
|
# * Phase 2: Initial system and clock initialization (proprietary rockchip miniload or u-boot SPL)
|
|
|
|
|
# * Phase 3: Arm Trusted Firmware (proprietary rockchip or mainline opensource)
|
|
|
|
|
# * Phase 4: u-boot proper is always the mainline one
|
|
|
|
|
#
|
|
|
|
|
# Available options for BOOT_SCENARIO are:
|
|
|
|
|
# - only-blobs: proprietary rockchip ddrbin, miniloader and ATF
|
|
|
|
|
# - spl-blobs: proprietary rockchip ddrin and ATF, but uses mainline u-boot SPL in place of rockchip miniloader
|
2022-06-19 23:41:33 +02:00
|
|
|
# - tpl-spl-blob: uses mainline u-boot TPL and SPL with proprietary rockchip ATF blob
|
2022-06-19 18:14:34 +00:00
|
|
|
# - tpl-blob-atf-mainline: proprietary rockchip ddrbin + mainline u-boot SPL + mainline ATF
|
|
|
|
|
# - blobless: mainline u-boot TPL + mainline u-boot SPL + mainline ATF
|
|
|
|
|
|
2022-03-21 00:58:21 +03:00
|
|
|
#BOOT_SOC=`expr $BOOTCONFIG : '.*\(rk[[:digit:]]\+.*\)_.*'`
|
2022-10-01 13:10:50 +02:00
|
|
|
BOOT_SOC=${BOOT_SOC:=$(expr $BOOTCONFIG : '.*\(rk[[:digit:]]\+.*\)_.*' || true)}
|
|
|
|
|
|
|
|
|
|
if [[ "a${BOOT_SOC}a" == "aa" ]]; then
|
|
|
|
|
display_alert "Could not determine BOOT_SOC from BOOTCONFIG" "BOOTCONFIG: '${BOOTCONFIG}'" "warning"
|
|
|
|
|
else
|
|
|
|
|
display_alert "Determined BOOT_SOC from BOOTCONFIG" "BOOT_SOC: '${BOOT_SOC}'; BOOTCONFIG: '${BOOTCONFIG}'" "info"
|
|
|
|
|
fi
|
2020-05-03 19:15:46 +02:00
|
|
|
|
2021-12-26 18:37:49 +03:00
|
|
|
CPUMIN=${CPUMIN:="408000"}
|
|
|
|
|
|
2021-10-26 22:14:41 +02:00
|
|
|
if [[ $BOOT_SOC == rk3399 ]]; then
|
2020-08-07 10:06:24 +02:00
|
|
|
|
|
|
|
|
CPUMAX=${CPUMAX:="2016000"}
|
|
|
|
|
|
2021-12-26 18:37:49 +03:00
|
|
|
elif [[ $BOOT_SOC == rk3328 || $BOOT_SOC == rk3308 ]]; then
|
2020-08-07 10:06:24 +02:00
|
|
|
|
|
|
|
|
CPUMAX=${CPUMAX:="1296000"}
|
|
|
|
|
|
2021-12-26 18:37:49 +03:00
|
|
|
elif [[ "${BOOT_SOC}" == rk3566 ]]; then
|
|
|
|
|
|
|
|
|
|
CPUMAX=${CPUMAX:="1800000"}
|
|
|
|
|
|
|
|
|
|
elif [[ "${BOOT_SOC}" == rk3568 ]]; then
|
|
|
|
|
|
|
|
|
|
CPUMAX=${CPUMAX:="1992000"}
|
|
|
|
|
|
2020-08-07 10:06:24 +02:00
|
|
|
fi
|
|
|
|
|
|
2021-10-26 22:14:41 +02:00
|
|
|
if [[ $BOOT_SOC == rk3328 ]]; then
|
2020-05-05 21:20:31 +02:00
|
|
|
|
2021-10-26 22:14:41 +02:00
|
|
|
BOOT_SCENARIO="${BOOT_SCENARIO:=only-blobs}"
|
2022-06-19 18:14:34 +00:00
|
|
|
DDR_BLOB="${DDR_BLOB:=rk33/rk3328_ddr_333MHz_v1.16.bin}"
|
2020-05-05 21:20:31 +02:00
|
|
|
MINILOADER_BLOB='rk33/rk322xh_miniloader_v2.50.bin'
|
2020-10-06 02:34:11 -04:00
|
|
|
BL31_BLOB='rk33/rk322xh_bl31_v1.44.elf'
|
2020-05-05 21:20:31 +02:00
|
|
|
|
2021-10-26 22:14:41 +02:00
|
|
|
elif [[ $BOOT_SOC == rk3399 ]]; then
|
2020-10-05 21:22:57 +02:00
|
|
|
|
2021-10-26 22:14:41 +02:00
|
|
|
BOOT_SCENARIO="${BOOT_SCENARIO:=only-blobs}"
|
2022-11-07 03:28:19 +08:00
|
|
|
if [[ $BOARD_NAME == "Tinker Board 2" ]]; then
|
|
|
|
|
DDR_BLOB="${DDR_BLOB:=rk33/rk3399_ddr_800MHz_v1.27.bin}"
|
|
|
|
|
else
|
|
|
|
|
DDR_BLOB="${DDR_BLOB:=rk33/rk3399_ddr_933MHz_v1.25.bin}"
|
|
|
|
|
fi
|
2021-07-05 15:05:43 -04:00
|
|
|
MINILOADER_BLOB='rk33/rk3399_miniloader_v1.26.bin'
|
2021-10-26 22:14:41 +02:00
|
|
|
BL31_BLOB='rk33/rk3399_bl31_v1.35.elf'
|
2021-01-04 03:01:16 +03:00
|
|
|
|
2021-10-26 22:14:41 +02:00
|
|
|
elif [[ $BOOT_SOC == rk3399pro ]]; then
|
VENDOR, rock-pi-n10, RM_LIST for armbian-config/zsh, Static MAC for networkd (#2789)
* VENDOR, rock-pi-n10, RM_LIST for armbian-config/zsh
VENDOR parameter in configuration
zsh is the best of course...
Static MAC for networkd
ROCK Pi N10 (Radxa) - Initial support, knwon bugs:
- Problem with poweroff (kernel panic).
- DeviceTree is not fully verified, I suspect missing and unnecessary
entries.
- No support for NPU
- u-boot without NVME support
- I have doubts if I chose the right preboot loader for RK3399Pro, NPU
and installed DDR memory.
* New RK3399Pro boot preloaders.
* rootfs checksum, DEBOOTSTRAP_LIST fix, output.log fix
Repaired checksum for rootfs
Added use PACKAGE_LIST_RM to purge DEBOOTSTRAP_LIST
Better logging to output.log
Fix for new host distribution detection (ie Debian Bullseye).
ubootdebs as new cleaning option
2021-05-11 21:50:14 +02:00
|
|
|
|
2021-10-26 22:14:41 +02:00
|
|
|
BOOT_SCENARIO="${BOOT_SCENARIO:=only-blobs}"
|
2022-06-19 18:14:34 +00:00
|
|
|
DDR_BLOB="${DDR_BLOB:=rk33/rk3399pro_npu_ddr_933MHz_v1.02.bin}"
|
VENDOR, rock-pi-n10, RM_LIST for armbian-config/zsh, Static MAC for networkd (#2789)
* VENDOR, rock-pi-n10, RM_LIST for armbian-config/zsh
VENDOR parameter in configuration
zsh is the best of course...
Static MAC for networkd
ROCK Pi N10 (Radxa) - Initial support, knwon bugs:
- Problem with poweroff (kernel panic).
- DeviceTree is not fully verified, I suspect missing and unnecessary
entries.
- No support for NPU
- u-boot without NVME support
- I have doubts if I chose the right preboot loader for RK3399Pro, NPU
and installed DDR memory.
* New RK3399Pro boot preloaders.
* rootfs checksum, DEBOOTSTRAP_LIST fix, output.log fix
Repaired checksum for rootfs
Added use PACKAGE_LIST_RM to purge DEBOOTSTRAP_LIST
Better logging to output.log
Fix for new host distribution detection (ie Debian Bullseye).
ubootdebs as new cleaning option
2021-05-11 21:50:14 +02:00
|
|
|
MINILOADER_BLOB='rk33/rk3399pro_miniloader_v1.26.bin'
|
|
|
|
|
BL31_BLOB='rk33/rk3399pro_bl31_v1.35.elf'
|
|
|
|
|
|
2021-12-26 18:37:49 +03:00
|
|
|
elif [[ $BOOT_SOC == rk3566 ]]; then
|
|
|
|
|
|
|
|
|
|
BOOT_SCENARIO="${BOOT_SCENARIO:=spl-blobs}"
|
2022-06-19 18:14:34 +00:00
|
|
|
DDR_BLOB="${DDR_BLOB:=rk35/rk3566_ddr_1056MHz_v1.10.bin}"
|
2021-12-26 18:37:49 +03:00
|
|
|
BL31_BLOB='rk35/rk3568_bl31_v1.29.elf'
|
|
|
|
|
|
|
|
|
|
elif [[ $BOOT_SOC == rk3568 ]]; then
|
|
|
|
|
|
|
|
|
|
BOOT_SCENARIO="${BOOT_SCENARIO:=spl-blobs}"
|
2023-02-01 16:54:14 +08:00
|
|
|
DDR_BLOB="${DDR_BLOB:=rk35/rk3568_ddr_1560MHz_v1.13.bin}"
|
|
|
|
|
BL31_BLOB='rk35/rk3568_bl31_v1.32.elf'
|
2021-12-26 18:37:49 +03:00
|
|
|
|
2022-07-29 09:21:27 -07:00
|
|
|
elif [[ $BOOT_SOC == rk3588 ]]; then
|
|
|
|
|
|
|
|
|
|
BOOT_SCENARIO="${BOOT_SCENARIO:=spl-blobs}"
|
2022-10-29 00:18:22 +08:00
|
|
|
DDR_BLOB="${DDR_BLOB:=rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.08.bin}"
|
|
|
|
|
BL31_BLOB='rk35/rk3588_bl31_v1.28.elf'
|
2022-07-29 09:21:27 -07:00
|
|
|
|
2019-11-19 23:25:39 +01:00
|
|
|
elif [[ $BOARD == rockpi-s ]]; then
|
|
|
|
|
|
2021-10-26 22:14:41 +02:00
|
|
|
BOOT_SCENARIO="${BOOT_SCENARIO:=only-blobs}"
|
2020-05-06 23:45:09 +02:00
|
|
|
BOOT_SOC=rk3308
|
2022-06-19 18:14:34 +00:00
|
|
|
DDR_BLOB="${DDR_BLOB:=rk33/rk3308_ddr_589MHz_uart2_m1_v1.30.bin}"
|
2021-06-10 11:58:00 +02:00
|
|
|
MINILOADER_BLOB='rk33/rk3308_miniloader_v1.22.bin'
|
|
|
|
|
BL31_BLOB='rk33/rk3308_bl31_v2.22.elf'
|
|
|
|
|
|
|
|
|
|
if [[ ${BRANCH} == legacy ]]; then
|
|
|
|
|
DDR_BLOB='rk33/rk3308_ddr_589MHz_uart2_m0_v1.26.bin'
|
|
|
|
|
MINILOADER_BLOB='rk33/rk3308_miniloader_sd_nand_v1.13.bin'
|
|
|
|
|
BL31_BLOB='rk33/rk3308_bl31_v2.10.elf'
|
|
|
|
|
fi
|
2019-11-19 23:25:39 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
case $BRANCH in
|
|
|
|
|
|
2022-10-08 13:18:00 +02:00
|
|
|
current)
|
2019-11-19 23:25:39 +01:00
|
|
|
|
2022-10-08 13:25:04 +02:00
|
|
|
export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel.
|
2022-10-08 13:18:00 +02:00
|
|
|
KERNELBRANCH="branch:linux-5.15.y"
|
|
|
|
|
KERNELPATCHDIR='rockchip64-'$BRANCH
|
|
|
|
|
LINUXFAMILY=rockchip64
|
|
|
|
|
LINUXCONFIG='linux-rockchip64-'$BRANCH
|
|
|
|
|
;;
|
2019-11-19 23:25:39 +01:00
|
|
|
|
2022-10-08 13:18:00 +02:00
|
|
|
edge)
|
2019-11-19 23:25:39 +01:00
|
|
|
|
2022-10-08 13:18:00 +02:00
|
|
|
KERNELPATCHDIR='rockchip64-'$BRANCH
|
2022-10-08 13:25:04 +02:00
|
|
|
export KERNEL_MAJOR_MINOR="6.1" # Major and minor versions of this kernel.
|
2022-12-14 01:43:31 +01:00
|
|
|
KERNELBRANCH="branch:linux-6.1.y"
|
2022-10-08 13:18:00 +02:00
|
|
|
LINUXFAMILY=rockchip64
|
|
|
|
|
LINUXCONFIG='linux-rockchip64-'$BRANCH
|
2019-11-24 22:07:46 +01:00
|
|
|
|
2022-10-08 13:18:00 +02:00
|
|
|
;;
|
2019-11-24 22:07:46 +01:00
|
|
|
|
2019-11-19 23:25:39 +01:00
|
|
|
esac
|
|
|
|
|
|
2022-05-12 03:47:28 +08:00
|
|
|
prepare_boot_configuration() {
|
2022-06-19 18:14:34 +00:00
|
|
|
if [[ $BOOT_SCENARIO == "blobless" || $BOOT_SCENARIO == "tpl-blob-atf-mainline" ]]; then
|
2020-05-03 19:15:46 +02:00
|
|
|
|
2022-05-29 11:28:54 -04:00
|
|
|
UBOOT_TARGET_MAP="BL31=bl31.elf idbloader.img u-boot.itb;;idbloader.img u-boot.itb"
|
2020-05-03 19:15:46 +02:00
|
|
|
ATFSOURCE='https://github.com/ARM-software/arm-trusted-firmware'
|
2020-07-17 10:34:46 +02:00
|
|
|
ATF_COMPILER='aarch64-linux-gnu-'
|
2020-05-03 19:15:46 +02:00
|
|
|
ATFDIR='arm-trusted-firmware'
|
2022-05-29 11:28:54 -04:00
|
|
|
ATFBRANCH='tag:v2.6'
|
2020-05-03 19:15:46 +02:00
|
|
|
ATF_USE_GCC='> 6.3'
|
2022-05-29 11:28:54 -04:00
|
|
|
ATF_TARGET_MAP="M0_CROSS_COMPILE=arm-linux-gnueabi- PLAT=$BOOT_SOC bl31;;build/$BOOT_SOC/release/bl31/bl31.elf:bl31.elf"
|
|
|
|
|
ATF_TOOLCHAIN2="arm-linux-gnueabi-:< 10.0"
|
2020-05-03 19:15:46 +02:00
|
|
|
|
2022-06-19 18:14:34 +00:00
|
|
|
[[ $BOOT_SCENARIO == "tpl-blob-atf-mainline" ]] && UBOOT_TARGET_MAP="BL31=bl31.elf idbloader.img u-boot.itb;;idbloader.img u-boot.itb"
|
|
|
|
|
|
2021-10-26 22:14:41 +02:00
|
|
|
elif [[ $BOOT_SCENARIO == "tpl-spl-blob" ]]; then
|
2020-05-03 19:15:46 +02:00
|
|
|
|
|
|
|
|
UBOOT_TARGET_MAP="BL31=$RKBIN_DIR/$BL31_BLOB idbloader.img u-boot.itb;;idbloader.img u-boot.itb"
|
|
|
|
|
ATFSOURCE=''
|
|
|
|
|
ATF_COMPILE='no'
|
|
|
|
|
|
2021-10-26 22:14:41 +02:00
|
|
|
elif [[ $BOOT_SCENARIO == "spl-blobs" ]]; then
|
2021-09-15 22:08:39 +02:00
|
|
|
|
|
|
|
|
UBOOT_TARGET_MAP="BL31=$RKBIN_DIR/$BL31_BLOB spl/u-boot-spl.bin u-boot.dtb u-boot.itb;;idbloader.img u-boot.itb"
|
|
|
|
|
ATFSOURCE=''
|
|
|
|
|
ATF_COMPILE='no'
|
|
|
|
|
|
2021-10-26 22:14:41 +02:00
|
|
|
elif [[ $BOOT_SCENARIO == "only-blobs" ]]; then
|
2020-05-03 19:15:46 +02:00
|
|
|
|
|
|
|
|
UBOOT_TARGET_MAP="u-boot-dtb.bin;;idbloader.bin uboot.img trust.bin"
|
|
|
|
|
ATFSOURCE=''
|
|
|
|
|
ATF_COMPILE='no'
|
|
|
|
|
|
|
|
|
|
fi
|
2020-07-26 22:02:31 +02:00
|
|
|
|
|
|
|
|
if [[ $BOOT_SUPPORT_SPI == yes ]]; then
|
|
|
|
|
|
2022-07-29 09:21:27 -07:00
|
|
|
if [[ $BOARD != "rock-3a" ]] && [[ $BOARD != "rock-5b" ]]; then
|
2022-06-01 23:10:36 +08:00
|
|
|
UBOOT_TARGET_MAP="BL31=$RKBIN_DIR/$BL31_BLOB tpl/u-boot-tpl.bin spl/u-boot-spl.bin u-boot.itb ${UBOOT_TARGET_MAP} rkspi_loader.img"
|
2022-06-06 16:06:11 +08:00
|
|
|
else
|
|
|
|
|
UBOOT_TARGET_MAP="${UBOOT_TARGET_MAP} rkspi_loader.img"
|
2022-06-01 23:10:36 +08:00
|
|
|
fi
|
2020-07-26 22:02:31 +02:00
|
|
|
|
|
|
|
|
fi
|
2020-05-03 19:15:46 +02:00
|
|
|
}
|
|
|
|
|
|
2022-05-12 03:47:28 +08:00
|
|
|
uboot_custom_postprocess() {
|
2022-10-01 13:10:50 +02:00
|
|
|
[[ -z ${BOOT_SOC} ]] && exit_with_error "BOOT_SOC not defined for scenario '${BOOT_SCENARIO}' for BOARD'=${BOARD}' and BOOTCONFIG='${BOOTCONFIG}'"
|
2021-02-24 18:19:09 +01:00
|
|
|
|
2021-10-26 22:14:41 +02:00
|
|
|
if [[ $BOOT_SCENARIO == "blobless" || $BOOT_SCENARIO == "tpl-spl-blob" ]]; then
|
2020-12-04 00:19:37 +01:00
|
|
|
:
|
2022-06-19 18:14:34 +00:00
|
|
|
elif [[ $BOOT_SCENARIO == "spl-blobs" || $BOOT_SCENARIO == "tpl-blob-atf-mainline" ]]; then
|
2022-10-01 13:10:50 +02:00
|
|
|
# Bomb if DDR_BLOB not defined or does not exist
|
|
|
|
|
declare SPL_BIN_PATH="${RKBIN_DIR}/${DDR_BLOB}"
|
|
|
|
|
[[ -z ${SPL_BIN_PATH} ]] && exit_with_error "DDR_BLOB not defined for scenario ${BOOT_SCENARIO}"
|
|
|
|
|
[[ ! -f "${SPL_BIN_PATH}" ]] && exit_with_error "DDR_BLOB ${SPL_BIN_PATH} does not exist for scenario ${BOOT_SCENARIO}"
|
|
|
|
|
|
|
|
|
|
display_alert "mkimage for '${BOOT_SOC}' for scenario ${BOOT_SCENARIO}" "SPL_BIN_PATH: ${SPL_BIN_PATH}" "debug"
|
|
|
|
|
run_host_command_logged tools/mkimage -n "${BOOT_SOC}" -T rksd -d "${SPL_BIN_PATH}:spl/u-boot-spl.bin" idbloader.img
|
2021-09-15 22:08:39 +02:00
|
|
|
|
2021-10-26 22:14:41 +02:00
|
|
|
elif [[ $BOOT_SCENARIO == "only-blobs" ]]; then
|
2020-05-03 19:15:46 +02:00
|
|
|
|
|
|
|
|
local tempfile=$(mktemp)
|
2022-10-08 13:25:04 +02:00
|
|
|
run_host_command_logged tools/mkimage -n $BOOT_SOC -T rksd -d $RKBIN_DIR/$DDR_BLOB idbloader.bin
|
2022-10-08 13:18:00 +02:00
|
|
|
cat $RKBIN_DIR/$MINILOADER_BLOB >> idbloader.bin
|
2022-10-08 13:25:04 +02:00
|
|
|
run_host_x86_binary_logged $RKBIN_DIR/tools/loaderimage --pack --uboot ./u-boot-dtb.bin uboot.img 0x200000
|
|
|
|
|
run_host_x86_binary_logged $RKBIN_DIR/tools/trust_merger --replace bl31.elf $RKBIN_DIR/$BL31_BLOB trust.ini
|
2020-05-03 19:15:46 +02:00
|
|
|
|
|
|
|
|
else
|
2022-10-01 13:10:50 +02:00
|
|
|
exit_with_error "Unsupported u-boot processing configuration!"
|
2020-05-03 19:15:46 +02:00
|
|
|
fi
|
2020-12-04 00:19:37 +01:00
|
|
|
|
|
|
|
|
if [[ $BOOT_SUPPORT_SPI == yes ]]; then
|
2022-12-31 16:55:55 +01:00
|
|
|
if [[ $BOARD == "rock-3a" ]] || [[ $BOARD == "rock-5b" ]] || [[ $BOARD == "orangepi5" ]]; then
|
2022-05-29 23:21:27 +08:00
|
|
|
dd if=/dev/zero of=rkspi_loader.img bs=1M count=0 seek=16
|
|
|
|
|
/sbin/parted -s rkspi_loader.img mklabel gpt
|
|
|
|
|
/sbin/parted -s rkspi_loader.img unit s mkpart idbloader 64 7167
|
|
|
|
|
/sbin/parted -s rkspi_loader.img unit s mkpart vnvm 7168 7679
|
|
|
|
|
/sbin/parted -s rkspi_loader.img unit s mkpart reserved_space 7680 8063
|
|
|
|
|
/sbin/parted -s rkspi_loader.img unit s mkpart reserved1 8064 8127
|
|
|
|
|
/sbin/parted -s rkspi_loader.img unit s mkpart uboot_env 8128 8191
|
|
|
|
|
/sbin/parted -s rkspi_loader.img unit s mkpart reserved2 8192 16383
|
|
|
|
|
/sbin/parted -s rkspi_loader.img unit s mkpart uboot 16384 32734
|
|
|
|
|
dd if=idbloader.img of=rkspi_loader.img seek=64 conv=notrunc
|
|
|
|
|
dd if=u-boot.itb of=rkspi_loader.img seek=16384 conv=notrunc
|
|
|
|
|
else
|
|
|
|
|
tools/mkimage -n $BOOT_SOC -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin rkspi_tpl_spl.img
|
|
|
|
|
dd if=/dev/zero of=rkspi_loader.img count=8128 status=none
|
|
|
|
|
dd if=rkspi_tpl_spl.img of=rkspi_loader.img conv=notrunc status=none
|
|
|
|
|
dd if=u-boot.itb of=rkspi_loader.img seek=768 conv=notrunc status=none
|
|
|
|
|
fi
|
2020-12-04 00:19:37 +01:00
|
|
|
fi
|
2020-05-03 19:15:46 +02:00
|
|
|
}
|
2019-11-19 23:25:39 +01:00
|
|
|
|
2022-05-12 03:47:28 +08:00
|
|
|
write_uboot_platform() {
|
2022-10-08 13:25:04 +02:00
|
|
|
# This is run board-side too, so account for the non-existance of run_host_command_logged
|
|
|
|
|
local logging_prelude=""
|
|
|
|
|
[[ $(type -t run_host_command_logged) == function ]] && logging_prelude="run_host_command_logged"
|
2020-05-03 19:15:46 +02:00
|
|
|
|
2022-10-08 13:25:04 +02:00
|
|
|
if [[ -f $1/rksd_loader.img ]]; then # legacy rk3399 loader
|
|
|
|
|
${logging_prelude} dd if=$1/rksd_loader.img of=$2 seek=64 conv=notrunc status=none
|
2021-10-26 22:14:41 +02:00
|
|
|
elif [[ -f $1/u-boot.itb ]]; then # $BOOT_SCENARIO == "blobless" || $BOOT_SCENARIO == "tpl-spl-blob"
|
2022-10-08 13:25:04 +02:00
|
|
|
${logging_prelude} dd if=$1/idbloader.img of=$2 seek=64 conv=notrunc status=none
|
|
|
|
|
${logging_prelude} dd if=$1/u-boot.itb of=$2 seek=16384 conv=notrunc status=none
|
2021-10-26 22:14:41 +02:00
|
|
|
elif [[ -f $1/uboot.img ]]; then # $BOOT_SCENARIO == "only-blobs"
|
2022-10-08 13:25:04 +02:00
|
|
|
${logging_prelude} dd if=$1/idbloader.bin of=$2 seek=64 conv=notrunc status=none
|
|
|
|
|
${logging_prelude} dd if=$1/uboot.img of=$2 seek=16384 conv=notrunc status=none
|
|
|
|
|
${logging_prelude} dd if=$1/trust.bin of=$2 seek=24576 conv=notrunc status=none
|
2020-05-03 19:15:46 +02:00
|
|
|
else
|
|
|
|
|
echo "Unsupported u-boot processing configuration!"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2019-11-19 23:25:39 +01:00
|
|
|
}
|
|
|
|
|
|
2022-05-12 03:47:28 +08:00
|
|
|
write_uboot_platform_mtd() {
|
2020-08-12 22:41:50 +02:00
|
|
|
if [[ -f $1/rkspi_loader.img ]]; then
|
|
|
|
|
|
2022-10-08 13:18:00 +02:00
|
|
|
dd if=$1/rkspi_loader.img of=$2 conv=notrunc status=none > /dev/null 2>&1
|
2020-12-04 00:19:37 +01:00
|
|
|
|
2020-08-12 22:41:50 +02:00
|
|
|
else
|
|
|
|
|
|
|
|
|
|
echo "SPI u-boot image not found!"
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
}
|
2019-11-19 23:25:39 +01:00
|
|
|
|
2022-05-12 03:47:28 +08:00
|
|
|
setup_write_uboot_platform() {
|
2019-11-19 23:25:39 +01:00
|
|
|
|
|
|
|
|
if grep -q "ubootpart" /proc/cmdline; then
|
|
|
|
|
|
|
|
|
|
local tmp=$(cat /proc/cmdline)
|
|
|
|
|
tmp="${tmp##*ubootpart=}"
|
|
|
|
|
tmp="${tmp%% *}"
|
2022-10-08 13:18:00 +02:00
|
|
|
[[ -n $tmp ]] && local part=$(findfs PARTUUID=$tmp 2> /dev/null)
|
|
|
|
|
[[ -n $part ]] && local dev=$(lsblk -n -o PKNAME $part 2> /dev/null)
|
2019-11-19 23:25:39 +01:00
|
|
|
[[ -n $dev ]] && DEVICE="/dev/$dev"
|
|
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-12 03:47:28 +08:00
|
|
|
family_tweaks() {
|
2019-11-19 23:25:39 +01:00
|
|
|
|
|
|
|
|
if [[ $BOARD == z28pro ]]; then
|
|
|
|
|
|
|
|
|
|
chroot $SDCARD /bin/bash -c "systemctl --no-reload enable z28pro-bluetooth.service >/dev/null 2>&1"
|
|
|
|
|
|
2023-02-01 17:52:18 +13:00
|
|
|
elif [[ $BOARD == nanopi-r2s || $BOARD == nanopi-r2c || $BOARD == orangepi-r1plus ]]; then
|
2020-03-10 20:03:05 +01:00
|
|
|
|
|
|
|
|
# rename USB based network to lan0
|
|
|
|
|
mkdir -p $SDCARD/etc/udev/rules.d/
|
2022-10-08 13:18:00 +02:00
|
|
|
echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="r8152", KERNEL=="eth1", NAME="lan0"' > $SDCARD/etc/udev/rules.d/70-rename-lan.rules
|
2020-03-10 20:03:05 +01:00
|
|
|
|
2020-09-07 16:17:57 +07:00
|
|
|
elif [[ $BOARD == helios64 ]]; then
|
|
|
|
|
|
|
|
|
|
chroot $SDCARD /bin/bash -c "systemctl --no-reload enable helios64-heartbeat-led.service >/dev/null 2>&1"
|
|
|
|
|
|
2019-11-19 23:25:39 +01:00
|
|
|
elif [[ -f $SDCARD/lib/systemd/system/rk3399-bluetooth.service ]]; then
|
|
|
|
|
|
|
|
|
|
# install and enable Bluetooth
|
2019-11-24 22:07:46 +01:00
|
|
|
chroot $SDCARD /bin/bash -c "apt-get -y -qq install rfkill bluetooth bluez bluez-tools"
|
|
|
|
|
chroot $SDCARD /bin/bash -c "systemctl --no-reload enable rk3399-bluetooth.service >/dev/null 2>&1"
|
2019-11-19 23:25:39 +01:00
|
|
|
|
2022-06-14 12:11:33 +02:00
|
|
|
elif [[ -f $SDCARD/lib/systemd/system/sprd-bluetooth.service ]]; then
|
|
|
|
|
|
|
|
|
|
# install and enable Bluetooth
|
|
|
|
|
chroot $SDCARD /bin/bash -c "apt-get -y -qq install rfkill bluetooth bluez bluez-tools"
|
|
|
|
|
chroot $SDCARD /bin/bash -c "systemctl --no-reload enable sprd-bluetooth.service >/dev/null 2>&1"
|
|
|
|
|
|
2019-11-19 23:25:39 +01:00
|
|
|
fi
|
|
|
|
|
|
2023-01-01 00:37:31 +03:00
|
|
|
if [[ -f $SDCARD/lib/systemd/system/orangepi5-usb2-init.service ]]; then
|
|
|
|
|
|
|
|
|
|
# enable usb2 init service
|
|
|
|
|
chroot $SDCARD /bin/bash -c "systemctl --no-reload enable orangepi5-usb2-init.service >/dev/null 2>&1"
|
|
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
2021-10-31 12:12:06 +01:00
|
|
|
if [[ $BOARD == nanopim4* ]]; then
|
|
|
|
|
|
|
|
|
|
# enable fan support
|
|
|
|
|
chroot $SDCARD /bin/bash -c "systemctl --no-reload enable nanopim4-pwm-fan.service >/dev/null 2>&1"
|
|
|
|
|
|
|
|
|
|
fi
|
2021-06-16 10:32:33 +03:00
|
|
|
|
2021-07-19 06:42:27 +00:00
|
|
|
if [[ $BOARD == pinebook-pro ]]; then
|
|
|
|
|
|
2022-05-12 03:47:28 +08:00
|
|
|
chroot $SDCARD /bin/bash -c "echo SuspendState=freeze >> /etc/systemd/sleep.conf"
|
|
|
|
|
chroot $SDCARD /bin/bash -c "echo HandlePowerKey=ignore >> /etc/systemd/login.d"
|
2021-07-19 06:42:27 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [[ $BOARD == station* ]]; then
|
|
|
|
|
|
|
|
|
|
cp -R $SRC/packages/blobs/rtl8723bt_fw/* $SDCARD/lib/firmware/rtl_bt/
|
2022-02-15 12:35:52 +03:00
|
|
|
cp -R $SRC/packages/blobs/station/firmware/* $SDCARD/lib/firmware/
|
2022-03-13 11:05:14 +03:00
|
|
|
if [[ $BRANCH == legacy && ($BOARD == station-m1) ]]; then
|
|
|
|
|
install -m 755 $SRC/packages/bsp/rk3328/m1/rtk_hciattach $SDCARD/usr/bin/rtk_hciattach
|
|
|
|
|
sed -e 's/exit 0//g' -i $SDCARD/etc/rc.local
|
2022-05-25 18:30:18 +03:00
|
|
|
echo "su -c '/usr/bin/rtk_hciattach -n -s 115200 /dev/ttyS2 rtk_h5 &'" >> $SDCARD/etc/rc.local
|
|
|
|
|
echo "exit 0" >> $SDCARD/etc/rc.local
|
2022-03-13 11:05:14 +03:00
|
|
|
fi
|
2023-02-18 00:51:02 +03:00
|
|
|
if [[ $BRANCH == legacy && ($BOARD == station-m3) ]]; then
|
|
|
|
|
install -m 755 $SRC/packages/blobs/station/firefly_fan_control $SDCARD/usr/bin/firefly_fan_control
|
|
|
|
|
install -m 755 $SRC/packages/blobs/station/firefly-fan-init $SDCARD/usr/bin/firefly-fan-init
|
|
|
|
|
install -m 755 $SRC/packages/blobs/station/firefly-fan.service $SDCARD/usr/lib/systemd/system/firefly-fan.service
|
|
|
|
|
chroot $SDCARD /bin/bash -c "systemctl --no-reload enable firefly-fan.service >/dev/null 2>&1"
|
|
|
|
|
fi
|
2021-07-19 06:42:27 +00:00
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
2023-02-18 01:06:21 +03:00
|
|
|
if [[ $BOARD == khadas-edge2 ]]; then
|
|
|
|
|
|
|
|
|
|
cp -R $SRC/packages/blobs/station/firmware/* $SDCARD/lib/firmware/
|
|
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
2022-07-25 12:38:42 +03:00
|
|
|
if [[ $BOARD == jetson-nano ]]; then
|
|
|
|
|
install -m 755 $SRC/packages/blobs/jetson/jetson.sh $SDCARD/etc/initramfs-tools/hooks/jetson.sh
|
|
|
|
|
if [[ $BRANCH == legacy ]]; then
|
|
|
|
|
install -m 755 $SRC/packages/blobs/jetson/tegra21x_xusb_firmware $SDCARD/lib/firmware/tegra21x_xusb_firmware
|
|
|
|
|
install -m 755 $SRC/packages/blobs/jetson/asound.conf.tegrahda $SDCARD/etc/asound.conf.tegrahda
|
|
|
|
|
install -m 755 $SRC/packages/blobs/jetson/asound.conf.tegrahda $SDCARD/etc/asound.conf
|
|
|
|
|
install -m 755 $SRC/packages/blobs/jetson/asound.conf.tegrasndt210ref $SDCARD/etc/asound.conf.tegrasndt210ref
|
|
|
|
|
install -m 755 $SRC/packages/blobs/jetson/tegra-hda.conf $SDCARD/usr/share/alsa/cards/tegra-hda.conf
|
|
|
|
|
install -m 755 $SRC/packages/blobs/jetson/tegra-snd-t210r.conf $SDCARD/usr/share/alsa/cards/tegra-snd-t210r.conf
|
|
|
|
|
sed -e 's/exit 0//g' -i $SDCARD/etc/rc.local
|
|
|
|
|
echo "su -c 'echo 255 > /sys/devices/pwm-fan/target_pwm'" >> $SDCARD/etc/rc.local
|
|
|
|
|
echo "exit 0" >> $SDCARD/etc/rc.local
|
|
|
|
|
else
|
|
|
|
|
cp -R $SRC/packages/blobs/jetson/firmware/* $SDCARD/lib/firmware/
|
|
|
|
|
fi
|
2022-10-08 13:18:00 +02:00
|
|
|
fi
|
2019-11-19 23:25:39 +01:00
|
|
|
}
|
|
|
|
|
|
2022-05-12 03:47:28 +08:00
|
|
|
family_tweaks_bsp() {
|
2019-11-19 23:25:39 +01:00
|
|
|
|
2020-12-04 00:19:37 +01:00
|
|
|
if [[ $BOOTCONFIG == *3328* ]] && [[ $BRANCH != legacy ]]; then
|
2020-10-16 00:45:26 -04:00
|
|
|
mkdir -p "$destination"/etc/X11/xorg.conf.d
|
2022-10-08 13:18:00 +02:00
|
|
|
cat <<- EOF > "$destination"/etc/X11/xorg.conf.d/02-driver.conf
|
2022-05-12 03:47:28 +08:00
|
|
|
# set fbdev as default driver.
|
|
|
|
|
Section "Device"
|
|
|
|
|
Identifier "NOGPU"
|
|
|
|
|
Driver "fbdev"
|
|
|
|
|
EndSection
|
|
|
|
|
EOF
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [[ $BOARD == clockworkpi-a06 ]]; then
|
|
|
|
|
# rotate screen & disable dpms
|
|
|
|
|
mkdir -p "$destination"/etc/X11/xorg.conf.d
|
2022-10-08 13:18:00 +02:00
|
|
|
cat <<- EOF > "$destination"/etc/X11/xorg.conf.d/10-monitor.conf
|
2022-05-12 03:47:28 +08:00
|
|
|
# set monitor
|
|
|
|
|
Section "Monitor"
|
|
|
|
|
Identifier "DSI-1"
|
|
|
|
|
Option "Rotate" "right"
|
|
|
|
|
Option "DPMS" "false"
|
|
|
|
|
EndSection
|
|
|
|
|
|
|
|
|
|
Section "ServerLayout"
|
|
|
|
|
Identifier "ServerLayout0"
|
|
|
|
|
Option "BlankTime" "0"
|
|
|
|
|
Option "StandbyTime" "0"
|
|
|
|
|
Option "SuspendTime" "0"
|
|
|
|
|
Option "OffTime" "0"
|
|
|
|
|
EndSection
|
2020-10-16 00:45:26 -04:00
|
|
|
EOF
|
2022-05-12 03:47:28 +08:00
|
|
|
# fan support
|
|
|
|
|
install -Dm644 $SRC/packages/bsp/clockworkpi-a06/temp_fan_daemon_a06.py $destination/usr/share/clockworkpi-a06-fan-daemon/bin/temp_fan_daemon_a06.py
|
|
|
|
|
cp $SRC/packages/bsp/clockworkpi-a06/clockworkpi-a06-fan-daemon.service $destination/lib/systemd/system/
|
|
|
|
|
|
|
|
|
|
# alsa-ucm-conf profile for DevTerm A06
|
|
|
|
|
mkdir -p $destination/usr/share/alsa/ucm2/Rockchip/es8388
|
|
|
|
|
install -Dm644 $SRC/packages/bsp/clockworkpi-a06/es8388.conf $destination/usr/share/alsa/ucm2/Rockchip/es8388/es8388.conf
|
|
|
|
|
install -Dm644 $SRC/packages/bsp/clockworkpi-a06/HiFi.conf $destination/usr/share/alsa/ucm2/Rockchip/es8388/HiFi.conf
|
|
|
|
|
mkdir -p $destination/usr/share/alsa/ucm2/conf.d/simple-card
|
|
|
|
|
ln -sfv /usr/share/alsa/ucm2/Rockchip/es8388/es8388.conf \
|
|
|
|
|
$destination/usr/share/alsa/ucm2/conf.d/simple-card/rockchip,es8388-codec.conf
|
2020-10-16 00:45:26 -04:00
|
|
|
fi
|
|
|
|
|
|
2019-11-19 23:25:39 +01:00
|
|
|
if [[ $BOARD == z28pro ]]; then
|
|
|
|
|
|
|
|
|
|
mkdir -p $destination/usr/local/bin
|
|
|
|
|
|
|
|
|
|
# Bluetooth for Z28 PRO
|
|
|
|
|
install -m 755 $SRC/packages/bsp/rk3328/z28pro/8822b_hciattach $destination/usr/bin
|
|
|
|
|
install -m 755 $SRC/packages/bsp/rk3328/z28pro/start_bt.sh $destination/usr/local/bin
|
|
|
|
|
cp $SRC/packages/bsp/rk3328/z28pro/z28pro-bluetooth.service $destination/lib/systemd/system/
|
|
|
|
|
|
2020-08-15 22:13:28 +02:00
|
|
|
elif [[ $BRANCH == legacy && ($BOARD == rockpi-4[bc] || $BOARD == nanop*4* || $BOARD == orangepi* || $BOARD == firefly*) ]]; then
|
2019-11-19 23:25:39 +01:00
|
|
|
|
2020-08-15 22:13:28 +02:00
|
|
|
# Bluetooth for most of others (custom patchram is needed only in legacy)
|
2019-11-19 23:25:39 +01:00
|
|
|
install -m 755 $SRC/packages/bsp/rk3399/brcm_patchram_plus_rk3399 $destination/usr/bin
|
|
|
|
|
cp $SRC/packages/bsp/rk3399/rk3399-bluetooth.service $destination/lib/systemd/system/
|
|
|
|
|
|
2021-01-25 20:41:56 +01:00
|
|
|
if [[ $BOARD == nanop*4* || $BOARD == firefly* || $BOARD == orangepi-rk3399 ]]; then
|
2020-12-20 23:45:30 +01:00
|
|
|
sed -i s%BCM4345C5%BCM4356A2%g $destination/lib/systemd/system/rk3399-bluetooth.service
|
|
|
|
|
fi
|
2019-11-19 23:25:39 +01:00
|
|
|
fi
|
|
|
|
|
|
2022-06-14 12:11:33 +02:00
|
|
|
if [[ $BOARD == orangepi4-lts ]]; then
|
2022-10-08 13:18:00 +02:00
|
|
|
|
2022-06-14 12:11:33 +02:00
|
|
|
# Bluetooth on orangepi 4 LTS board is handled by a Spreadtrum (sprd) chip and requires
|
|
|
|
|
# a custom hciattach_opi binary, plus a systemd service to run it at boot time
|
|
|
|
|
install -m 755 $SRC/packages/bsp/rk3399/hciattach_opi $destination/usr/bin
|
|
|
|
|
cp $SRC/packages/bsp/rk3399/sprd-bluetooth.service $destination/lib/systemd/system/
|
|
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
2021-10-31 12:12:06 +01:00
|
|
|
if [[ $BOARD == nanopim4* ]]; then
|
|
|
|
|
|
|
|
|
|
# Fan support
|
|
|
|
|
cp $SRC/packages/bsp/nanopim4/nanopim4-pwm-fan.service $destination/lib/systemd/system/
|
|
|
|
|
install -m 755 $SRC/packages/bsp/nanopim4/nanopim4-pwm-fan.sh $destination/usr/bin/nanopim4-pwm-fan.sh
|
|
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
2020-08-10 23:22:48 +07:00
|
|
|
if [[ $BOARD == helios64 ]]; then
|
|
|
|
|
|
|
|
|
|
mkdir -p $destination/etc/udev/rules.d/
|
2020-09-15 14:46:06 +07:00
|
|
|
mkdir -p $destination/etc/systemd/system/fancontrol.service.d/
|
2020-11-25 14:18:29 +07:00
|
|
|
mkdir -p $destination/lib/systemd/system/
|
2020-08-10 23:22:48 +07:00
|
|
|
mkdir -p $destination/lib/systemd/system-shutdown/
|
|
|
|
|
cp $SRC/packages/bsp/helios64/50-usb-realtek-net.rules $destination/etc/udev/rules.d/
|
|
|
|
|
cp $SRC/packages/bsp/helios64/70-keep-usb-lan-as-eth1.rules $destination/etc/udev/rules.d/
|
2020-11-25 14:18:29 +07:00
|
|
|
cp $SRC/packages/bsp/helios64/90-helios64-ups.rules $destination/etc/udev/rules.d/
|
2020-08-10 23:22:48 +07:00
|
|
|
cp $SRC/packages/bsp/helios64/asound.conf $destination/etc/
|
|
|
|
|
install -m 755 $SRC/packages/bsp/helios64/disable_auto_poweron $destination/lib/systemd/system-shutdown/
|
2020-09-07 16:17:57 +07:00
|
|
|
|
|
|
|
|
### Fancontrol tweaks
|
|
|
|
|
# copy hwmon rules to fix device mapping
|
2021-06-20 10:46:10 +02:00
|
|
|
# changed to only use one file regardless of branch
|
|
|
|
|
install -m 644 $SRC/packages/bsp/helios64/90-helios64-hwmon.rules $destination/etc/udev/rules.d/
|
2021-09-15 22:08:39 +02:00
|
|
|
|
2020-09-15 14:46:06 +07:00
|
|
|
install -m 644 $SRC/packages/bsp/helios64/fancontrol.service.pid-override $destination/etc/systemd/system/fancontrol.service.d/pid.conf
|
2020-09-07 16:17:57 +07:00
|
|
|
|
|
|
|
|
# copy fancontrol config
|
|
|
|
|
install -m 644 $SRC/packages/bsp/helios64/fancontrol.conf $destination/etc/fancontrol
|
|
|
|
|
|
|
|
|
|
# LED tweak
|
2020-11-25 14:18:29 +07:00
|
|
|
if [[ $BRANCH == legacy ]]; then
|
|
|
|
|
install -m 644 $SRC/packages/bsp/helios64/helios64-heartbeat-led-legacy.service $destination/etc/systemd/system/helios64-heartbeat-led.service
|
|
|
|
|
else
|
|
|
|
|
install -m 644 $SRC/packages/bsp/helios64/helios64-heartbeat-led.service $destination/etc/systemd/system/
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# UPS service
|
|
|
|
|
cp $SRC/packages/bsp/helios64/helios64-ups.service $destination/lib/systemd/system/
|
|
|
|
|
cp $SRC/packages/bsp/helios64/helios64-ups.timer $destination/lib/systemd/system/
|
2021-02-05 12:27:15 +02:00
|
|
|
install -m 755 $SRC/packages/bsp/helios64/helios64-ups.sh $destination/usr/bin/helios64-ups.sh
|
2020-09-07 16:17:57 +07:00
|
|
|
|
2020-08-10 23:22:48 +07:00
|
|
|
fi
|
|
|
|
|
|
2022-06-23 06:30:54 +00:00
|
|
|
if [[ $BOARD == rk3318-box ]]; then
|
2022-10-08 13:18:00 +02:00
|
|
|
# Optional board dtbo selection script
|
|
|
|
|
mkdir -p $destination/usr/local/bin
|
|
|
|
|
install -m 755 $SRC/packages/bsp/rk3318/rk3318-config $destination/usr/sbin
|
|
|
|
|
fi
|
2022-06-23 06:30:54 +00:00
|
|
|
|
2021-07-19 02:14:34 -04:00
|
|
|
if [[ $BOARD == pinebook-pro ]]; then
|
|
|
|
|
|
|
|
|
|
# special keys
|
|
|
|
|
mkdir -p "${destination}"/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/
|
2022-05-12 03:47:28 +08:00
|
|
|
cp $SRC/packages/bsp/pinebook-pro/pointers.xml "${destination}"/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/
|
2021-09-15 22:08:39 +02:00
|
|
|
|
2021-07-19 02:14:34 -04:00
|
|
|
# touchpad and keyboard tweaks
|
|
|
|
|
mkdir -p "${destination}"/etc/X11/xorg.conf.d/
|
|
|
|
|
# from https://github.com/ayufan-rock64/linux-package/tree/master/root-pinebookpro
|
|
|
|
|
cp "${SRC}"/packages/bsp/pinebook-pro/40-pinebookpro-touchpad.conf "${destination}"/etc/X11/xorg.conf.d/
|
|
|
|
|
|
|
|
|
|
# keyboard hwdb
|
|
|
|
|
mkdir -p "${destination}"/etc/udev/hwdb.d/
|
|
|
|
|
cp "${SRC}"/packages/bsp/pinebook-pro/10-usb-kbd.hwdb "${destination}"/etc/udev/hwdb.d/
|
|
|
|
|
fi
|
|
|
|
|
|
2019-11-19 23:25:39 +01:00
|
|
|
# Graphics and media
|
|
|
|
|
mkdir -p $destination/etc/udev/rules.d
|
|
|
|
|
cp $SRC/packages/bsp/rk3399/50-mali.rules $destination/etc/udev/rules.d/
|
|
|
|
|
cp $SRC/packages/bsp/rk3399/50-rk3399-vpu.rules $destination/etc/udev/rules.d/
|
|
|
|
|
mkdir -p $destination/etc/sysfs.d
|
|
|
|
|
cp $SRC/packages/bsp/rk3399/20-gpu-governor.conf $destination/etc/sysfs.d/
|
|
|
|
|
|
|
|
|
|
}
|