Files
build/config/sources/families/spacemit.conf
2025-02-03 10:12:17 -05:00

77 lines
2.7 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://gitee.com/bianbu-linux/opensbi.git"
declare -g ATFDIR="opensbi"
declare -g ATFBRANCH="tag:k1-bl-v2.1-release"
declare -g ATF_TARGET_MAP="PLATFORM_DEFCONFIG=k1_defconfig PLATFORM=generic ;;build/platform/generic/firmware/fw_dynamic.itb"
# U-Boot
declare -g BOOTSOURCE="https://gitee.com/bianbu-linux/uboot-2022.10.git"
declare -g BOOTBRANCH="${BOOTBRANCH_BOARD:-"tag:k1-bl-v2.1-release"}"
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
# Linux
case "${BRANCH}" in
current)
declare -g KERNELSOURCE="https://github.com/jmontleon/linux-bianbu.git"
declare -g KERNELBRANCH="branch:linux-6.6.y"
declare -g EXTRAWIFI="no" # WiFi drivers are already included in the kernel
declare -g KERNEL_MAJOR_MINOR="6.6"
declare -g LINUXCONFIG="linux-${LINUXFAMILY}-current"
;;
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}
if [ -b ${2}boot0 ]; then
echo "eMMC"
DEVICE=`ls /dev/mmcblk*boot0 | sed 's/^.....//'`
echo 0 > /sys/block/${DEVICE}/force_ro
sleep .50
dd if="$1/bootinfo_emmc.bin" of="/dev/${DEVICE}" bs=512 conv=notrunc
dd if="$1/FSBL.bin" of="/dev/${DEVICE}" bs=512 seek=1 conv=notrunc
dd if="$1/FSBL.bin" of="/dev/${DEVICE}" bs=512 seek=512 conv=notrunc
else
echo "SD card"
dd if="$1/bootinfo_emmc.bin" of=$2 bs=512 conv=notrunc
dd if="$1/FSBL.bin" of="$2" bs=512 seek=1 conv=notrunc
dd if="$1/FSBL.bin" of="$2" bs=512 seek=512 conv=notrunc
fi
dd if="$1/fw_dynamic.itb" of="$2" bs=512 seek=1280 conv=notrunc
dd if="$1/u-boot.itb" of="$2" bs=512 seek=2048 conv=notrunc
sync
}