CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/scripts/pack-uboot.sh
Views: 3960
1
#!/bin/bash
2
#
3
# SPDX-License-Identifier: GPL-2.0
4
5
function do_prepare()
6
{
7
export PATH=$EXTER/packages/pack-uboot/${BOARDFAMILY}/tools/:$PATH
8
cp ${EXTER}/packages/pack-uboot/${BOARDFAMILY}/bin/* . -r
9
cp sys_config/sys_config_${BOARD}.fex sys_config.fex
10
}
11
12
function do_ini_to_dts()
13
{
14
local DTC_COMPILER=$EXTER/packages/pack-uboot/${BOARDFAMILY}/tools/dtc
15
[[ ! -f $DTC_COMPILER ]] && exit_with_error "Script_to_dts: Can not find dtc compiler."
16
17
if [[ $BOARDFAMILY =~ sun50iw2|sun50iw6|sun50iw9 ]]; then
18
19
#Disbale noisy checks
20
local DTC_FLAGS="-W no-unit_address_vs_reg"
21
22
if [[ $BOARDFAMILY =~ sun50iw2 ]]; then
23
$DTC_COMPILER ${DTC_FLAGS} -O dtb -o ${BOARD}-u-boot.dtb -b 0 dts/${BOARD}-u-boot.dts >/dev/null 2>&1
24
else
25
$DTC_COMPILER -p 2048 ${DTC_FLAGS} -@ -O dtb -o ${BOARD}-u-boot.dtb -b 0 dts/${BOARD}-u-boot.dts >/dev/null 2>&1
26
fi
27
28
[[ $? -ne 0 ]] && exit_with_error "dtb: Conver script to dts failed."
29
30
# It'is used for debug dtb
31
$DTC_COMPILER ${DTC_FLAGS} -I dtb -O dts -o .${BOARD}-u-boot.dts ${BOARD}-u-boot.dtb >/dev/null 2>&1
32
fi
33
}
34
35
function do_common()
36
{
37
unix2dos sys_config.fex > /dev/null 2>&1
38
script sys_config.fex > /dev/null 2>&1
39
cp ${PACKOUT_DIR}/${BOARD}-u-boot.dtb sunxi.fex
40
[[ $BOARDFAMILY == sun50iw2 ]] && update_uboot_fdt u-boot.fex sunxi.fex u-boot.fex >/dev/null
41
42
if [[ $BOARDFAMILY =~ sun50iw6|sun50iw9 ]]; then
43
update_dtb sunxi.fex 4096 >/dev/null
44
fi
45
46
if [[ $BOARDFAMILY =~ sun50iw6|sun50iw2 ]]; then
47
cp -f sys_config.bin config.fex
48
update_scp scp.fex sunxi.fex > /dev/null 2>&1
49
fi
50
51
update_boot0 boot0_sdcard.fex sys_config.bin SDMMC_CARD > /dev/null
52
if [[ $BOARDFAMILY =~ sun50iw6|sun50iw9 ]]; then
53
update_uboot -no_merge u-boot.fex sys_config.bin > /dev/null
54
elif [[ $BOARDFAMILY =~ sun50iw2 ]]; then
55
update_uboot u-boot.fex sys_config.bin > /dev/null
56
fi
57
[[ $? -ne 0 ]] && exit_with_error "update u-boot run error"
58
59
#pack boot package
60
unix2dos boot_package.cfg > /dev/null 2>&1
61
dragonsecboot -pack boot_package.cfg > /dev/null
62
[[ $? -ne 0 ]] && exit_with_error "dragon pack error"
63
64
#Here, will check if need to used multi config.fex or not
65
if [[ $BOARDFAMILY == sun50iw2 ]]; then
66
update_uboot_v2 u-boot.fex sys_config.bin ${CHIP_BOARD} 1>/dev/null 2>&1
67
fi
68
}
69
70
do_pack_h3()
71
{
72
cp $BOOTDIR/boot0_sdcard_${CHIP}.bin ${PACK_OUT}
73
cp $BOOTDIR/u-boot-${CHIP}.bin ${PACK_OUT}
74
cp $SYS_CONFIG ${PACK_OUT}/sys_config.fex
75
76
fex2bin sys_config.fex sys_config.bin
77
update_boot0 boot0_sdcard_${CHIP}.bin sys_config.bin SDMMC_CARD >/dev/null 2>&1
78
update_uboot u-boot-${CHIP}.bin sys_config.bin >/dev/null 2>&1
79
80
cp boot0_sdcard_${CHIP}.bin $UBOOT_BIN/boot0_sdcard_${CHIP}.bin
81
cp u-boot-${CHIP}.bin $UBOOT_BIN/u-boot-${CHIP}.bin
82
cp sys_config.bin $UBOOT_BIN/script.bin_${BOARD}
83
cp sys_config.bin $EXTER/chips/${CHIP}/script/script.bin_${BOARD}
84
}
85
86
pack_uboot()
87
{
88
PACKOUT_DIR=$SRC/.tmp/packout
89
cd ${PACKOUT_DIR}
90
91
do_prepare
92
do_ini_to_dts
93
do_common
94
}
95
96