Files
build/config/sources/families/spacemit.conf
The-going 2e5611c92d spacemit: opensbi, u-boot, kernel legacy: Update for v1.0.15
Re-extract the kernel patches as a series.
Re-extract the u-boot patches as "git format-patch" command.

Unified patch extraction makes it easier to work with patches.
2024-10-09 20:47:00 +02:00

107 lines
3.8 KiB
Plaintext

#
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2013-2024 Igor Pecovnik, igor@armbian.com
#
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
#
declare -g ARCH="riscv64"
declare -g LINUXFAMILY="spacemit"
declare -g GOVERNOR="performance"
# Arm Trusted Firmware
declare -g ATF_USE_GCC="> 8.0"
declare -g ATF_COMPILER="riscv64-linux-gnu-"
declare -g ATFSOURCE="https://github.com/riscv-software-src/opensbi.git"
declare -g ATFDIR="opensbi"
declare -g ATFBRANCH="tag:v1.3"
declare -g ATF_TARGET_MAP="PLATFORM_DEFCONFIG=k1_defconfig PLATFORM=generic ;;build/platform/generic/firmware/fw_dynamic.itb"
# declare -g ATFPATCHDIR="atf-spacemit"
# U-Boot
declare -g BOOTSOURCE="https://gitee.com/bianbu-linux/uboot-2022.10.git"
declare -g BOOTBRANCH="${BOOTBRANCH_BOARD:-"tag:v1.0.15"}"
declare -g BOOTDIR='u-boot-spacemit'
declare -g BOOTPATCHDIR="${BOOTPATCHDIR:-"legacy/u-boot-spacemit-k1"}"
declare -g UBOOT_TARGET_MAP=";;bootinfo_emmc.bin FSBL.bin u-boot.itb fw_dynamic.itb"
declare -g BOOTCONFIG="k1_defconfig" # Boot with generic SpacemiT K1 config
# Skip all wifi drivers
declare -g KERNEL_DRIVERS_SKIP+=(driver_generic_bring_back_ipx driver_mt7921u_add_pids driver_rtl8152_rtl8153 driver_rtl8189ES
driver_rtl8189FS driver_rtl8192EU driver_rtl8811_rtl8812_rtl8814_rtl8821 driver_xradio_xr819 driver_rtl8811CU_rtl8821C
driver_rtl8188EU_rtl8188ETV driver_rtl88x2bu driver_rtw88 driver_rtl88x2cs driver_rtl8822cs_bt driver_rtl8723DS driver_rtl8723DU
driver_rtl8822BS driver_uwe5622 driver_rtl8723cs)
case "${BRANCH}" in
legacy)
# Kernel
declare -g KERNELSOURCE='https://gitee.com/bianbu-linux/linux-6.1.git'
declare -g KERNELBRANCH='tag:v1.0.15'
declare -g KERNEL_MAJOR_MINOR="6.1"
declare -g LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
declare -g KERNELPATCHDIR="${LINUXFAMILY}-legacy-${KERNEL_MAJOR_MINOR}" # Needed as long as both legacy and current are 6.1 kernels
declare -g EXTRAWIFI="no" # WiFi drivers are already included in th legacy kernel
;;
current)
# Kernel
declare -g KERNEL_MAJOR_MINOR="6.1"
declare -g KERNELBRANCH='tag:v6.1.102' # last known good tag on current patchset
declare -g LINUXCONFIG="linux-${LINUXFAMILY}-${KERNEL_MAJOR_MINOR}"
# No need to set KERNELPATCHDIR, since default is: KERNELPATCHDIR='archive/${LINUXFAMILY}-${KERNEL_MAJOR_MINOR}'
;;
esac
function custom_kernel_config__spacemit_k1_firmware() {
if [[ -f .config ]]; then
# check $kernel_work_dir is set and exists, or bail
[[ -z "${kernel_work_dir}" ]] && exit_with_error "kernel_work_dir is not set"
[[ ! -d "${kernel_work_dir}" ]] && exit_with_error "kernel_work_dir does not exist: ${kernel_work_dir}"
display_alert "$BOARD" "Adding boot firmware" "info"
mkdir -pv "${kernel_work_dir}/firmware"
cp -fv "$SRC/packages/blobs/riscv64/spacemit/esos.elf" "${kernel_work_dir}/firmware"
fi
}
pre_prepare_partitions() {
declare -g OFFSET="4"
declare -g IMAGE_PARTITION_TABLE="msdos"
}
write_uboot_platform() {
local device=${2}
declare -A d
d=(
[${1}/bootinfo_emmc.bin]="0:$(du -b ${1}/bootinfo_emmc.bin | awk '{print $1}')"
[${1}/FSBL.bin]="512:$(du -b ${1}/FSBL.bin | awk '{print $1}')"
)
if [ -b ${2}boot0 ]; then
device=${2}boot0
echo 0 > /sys/block/$(basename ${device})/force_ro
sync
fi
for f in "${!d[@]}"
do
if $(dd if=${device} bs=1 skip="${d[$f]%:*}" count="${d[$f]#*:}" \
conv=notrunc status=noxfer 2>/dev/null | cmp --quiet "${f}")
then
echo "Skip $(basename $f), it is equal to the existing one"
else
echo "# Write =: $(basename $f) to ${device}"
dd if=$f of=${device} bs=1 seek="${d[$f]%:*}" conv=notrunc status=noxfer
sync
fi
done
dd if=$1/fw_dynamic.itb of=${2} bs=512 seek=1280 conv=notrunc
sync
dd if=$1/u-boot.itb of=${2} bs=512 seek=2048 conv=notrunc
sync
}