forked from armbian/build
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathspacemit.conf
More file actions
79 lines (72 loc) · 2.82 KB
/
Copy pathspacemit.conf
File metadata and controls
79 lines (72 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#
# 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"
# OpenSBI
declare -g ATFSOURCE="https://gitee.com/bianbu-linux/opensbi.git"
declare -g ATFDIR="opensbi"
declare -g ATFBRANCH="tag:k1-bl-v2.2.7-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.2.7-release"}"
declare -g BOOTDIR='u-boot-spacemit'
declare -g BOOTPATCHDIR="${BOOTPATCHDIR:-"legacy/u-boot-spacemit-k1"}"
declare -g UBOOT_TARGET_MAP=";;bootinfo_emmc.bin bootinfo_spinor.bin FSBL.bin fw_dynamic.itb u-boot.itb u-boot-env-default.bin"
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"
;;
edge)
declare -g KERNELSOURCE="https://github.com/jmontleon/linux-bianbu.git"
declare -g KERNELBRANCH="branch:linux-6.18.y"
declare -g EXTRAWIFI="no" # WiFi drivers are already included in the kernel
declare -g KERNEL_MAJOR_MINOR="6.18"
declare -g LINUXCONFIG="linux-${LINUXFAMILY}-edge"
;;
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
else
echo "SDCARD"
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
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
}