Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
uppdate to u-boot 2023.01
Browse files Browse the repository at this point in the history
Signed-off-by: John Clark <[email protected]>
  • Loading branch information
inindev committed Mar 7, 2023
1 parent 12ef03b commit 3d00772
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 240 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ dtb/*.dts
dtb/*.dtsi
dtb/*.dtb
uboot/u-boot
uboot/rksd_loader.img
uboot/idbloader.img
uboot/u-boot.itb
128 changes: 85 additions & 43 deletions uboot/make_uboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,89 @@

set -e

if [ 'clean' = "$1" ]; then
rm -f rksd_loader.img u-boot.itb
git -C u-boot clean -f
git -C u-boot checkout master
git -C u-boot branch -D uboot-2022.04
git -C u-boot pull --ff-only
exit 0
fi

if [ ! -d u-boot ]; then
git clone https://github.com/u-boot/u-boot.git
git -C u-boot fetch --tags
fi

if ! git -C u-boot branch | grep -q uboot-2022.04; then
git -C u-boot checkout -b uboot-2022.04 v2022.04
git -C u-boot am ../patches/0001-.gitignore-ignore-tools-boot-build-artifact.patch
git -C u-boot am ../patches/0002-arm64-rk3399-enable-usb-disable-video.patch
git -C u-boot am ../patches/0003-arm64-rk3399-set-ethaddr-and-eth1addr-from-eeprom.patch
# optional boot from usb
# git -C u-boot am ../patches/0004-optional-skip-mmc-boot-usb-boot.patch
elif [ 'uboot-2022.04' != "$(git -C u-boot branch | sed -n -e 's/^\* \(.*\)/\1/p')" ]; then
git -C u-boot checkout uboot-2022.04
fi

if [ ! -f u-boot/rk3399_bl31.elf ]; then
wget -cP u-boot https://github.com/atf-builds/atf/releases/download/v2.6/rk3399_bl31.elf
fi

make -C u-boot mrproper
make -C u-boot nanopi-r4s-rk3399_defconfig
make -C u-boot -j$(nproc) BL31=rk3399_bl31.elf

# outputs: rksd_loader.img & u-boot.itb
u-boot/tools/mkimage -n rk3399 -T rksd -d u-boot/tpl/u-boot-tpl.bin rksd_loader.img
cat u-boot/spl/u-boot-spl.bin >> rksd_loader.img
cp u-boot/u-boot.itb .

echo '\nu-boot and spl binaries are now ready'
echo '\ncopy images to media:'
echo ' dd bs=4K seek=8 if=rksd_loader.img of=/dev/sdX conv=notrunc'
echo ' dd bs=4K seek=2048 if=u-boot.itb of=/dev/sdX conv=notrunc'
echo ' sync\n'
main() {
local utag='v2023.01'
local boot_usb='false'
local atf_url='https://github.com/atf-builds/atf/releases/download/v2.8/rk3399_bl31.elf'
local atf_file=$(basename $atf_url)

if [ '_clean' = "_$1" ]; then
make -C u-boot distclean
git -C u-boot clean -f
git -C u-boot checkout master
git -C u-boot branch -D $utag 2>/dev/null || true
git -C u-boot pull --ff-only
rm -f *.img *.itb
exit 0
fi

check_installed 'bison' 'flex' 'libssl-dev' 'make' 'python3-dev' 'python3-pyelftools' 'python3-setuptools' 'swig'

if [ ! -d u-boot ]; then
git clone https://github.com/u-boot/u-boot.git
git -C u-boot fetch --tags
fi

if ! git -C u-boot branch | grep -q $utag; then
git -C u-boot checkout -b $utag $utag
git -C u-boot am ../patches/0001-ignore-build-artifacts.patch
# optional boot from usb (u-boot on mmc only)
if $boot_usb; then
git -C u-boot am ../patches/0002-optional-skip-mmc-boot-usb-boot.patch
fi
elif [ "_$utag" != "_$(git -C u-boot branch | sed -n -e 's/^\* \(.*\)/\1/p')" ]; then
git -C u-boot checkout $utag
fi

if [ ! -f u-boot/$atf_file ]; then
wget -cP u-boot $atf_url
fi

# outputs: idbloader.img & u-boot.itb
make -C u-boot distclean
make -C u-boot nanopi-r4s-rk3399_defconfig
make -C u-boot -j$(nproc) BL31=$atf_file

local target_spl='idbloader.img'
local target_itb='u-boot.itb'
if $boot_usb; then
target_spl="usb_$target_spl"
target_itb="usb_$target_itb"
fi

cp u-boot/idbloader.img $target_spl
cp u-boot/u-boot.itb $target_itb

echo "\n${cya}idbloader and u-boot binaries are now ready${rst}"
echo "\n${cya}copy images to media:${rst}"
echo " ${cya}sudo dd bs=4K seek=8 if=$target_spl of=/dev/sdX conv=notrunc${rst}"
echo " ${cya}sudo dd bs=4K seek=2048 if=$target_itb of=/dev/sdX conv=notrunc,fsync${rst}"
echo
}

# check if utility program is installed
check_installed() {
local todo
for item in "$@"; do
dpkg -l "$item" 2>/dev/null | grep -q "ii $item" || todo="$todo $item"
done

if [ ! -z "$todo" ]; then
echo "this script requires the following packages:${bld}${yel}$todo${rst}"
echo " run: ${bld}${grn}sudo apt update && sudo apt -y install$todo${rst}\n"
exit 1
fi
}

rst='\033[m'
bld='\033[1m'
red='\033[31m'
grn='\033[32m'
yel='\033[33m'
blu='\033[34m'
mag='\033[35m'
cya='\033[36m'
h1="${blu}==>${rst} ${bld}"

main $@

This file was deleted.

43 changes: 43 additions & 0 deletions uboot/patches/0001-ignore-build-artifacts.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From 0f5d63aef9e24953a5d3d6c58f246c5661b4c558 Mon Sep 17 00:00:00 2001
From: John Clark <[email protected]>
Date: Tue, 7 Mar 2023 01:47:26 +0000
Subject: [PATCH 1/2] ignore build artifacts

Signed-off-by: John Clark <[email protected]>
---
.gitignore | 3 ++-
drivers/video/.gitignore | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
create mode 100644 drivers/video/.gitignore

diff --git a/.gitignore b/.gitignore
index eb769f144c..2ffd5fd3bf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,7 +34,7 @@
*.tab.[ch]

# Build tree
-/build-*
+/build*

#
# Top-level generic files
@@ -43,6 +43,7 @@ fit-dtb.blob*
/MLO*
/SPL*
/System.map
+/simple-bin.map
/u-boot*
/boards.cfg
/*.log
diff --git a/drivers/video/.gitignore b/drivers/video/.gitignore
new file mode 100644
index 0000000000..86ec950f64
--- /dev/null
+++ b/drivers/video/.gitignore
@@ -0,0 +1 @@
+*.S
--
2.39.2

73 changes: 0 additions & 73 deletions uboot/patches/0002-arm64-rk3399-enable-usb-disable-video.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
From 2a17f88851898aee8483d89a69b1f104dbf881f4 Mon Sep 17 00:00:00 2001
From dd99b1b1db016e5b9728e32d6993919ed64104a7 Mon Sep 17 00:00:00 2001
From: John Clark <[email protected]>
Date: Mon, 4 Jul 2022 21:46:31 -0400
Subject: [PATCH] optional: skip mmc boot (usb boot)
Date: Tue, 7 Mar 2023 01:51:58 +0000
Subject: [PATCH 2/2] optional: skip mmc boot (usb boot)

Signed-off-by: John Clark <[email protected]>
---
include/configs/rockchip-common.h | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/include/configs/rockchip-common.h b/include/configs/rockchip-common.h
index ba7061a287..90422b9f2f 100644
index 4c964cc377..70598c6f8e 100644
--- a/include/configs/rockchip-common.h
+++ b/include/configs/rockchip-common.h
@@ -14,14 +14,8 @@
@@ -13,14 +13,8 @@

#ifndef CONFIG_SPL_BUILD

Expand All @@ -29,5 +30,5 @@ index ba7061a287..90422b9f2f 100644
#if CONFIG_IS_ENABLED(CMD_NVME)
#define BOOT_TARGET_NVME(func) func(NVME, nvme, 0)
--
2.30.2
2.39.2

Loading

0 comments on commit 3d00772

Please sign in to comment.