From e2de533f6c2dab0a9c47c8220886fbbc242af264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Sun, 26 May 2019 12:12:26 +0200 Subject: [PATCH] ayufan: dev.mk: add rockpi4b to build targets Change-Id: Iba0629b1fa0e85d71c638fd027585c0214788bf2 --- .gitlab-ci.yml | 1 + dev-ayufan/blobs/rockpi4b/erase-spi.cmd | 9 ++++++ dev-ayufan/blobs/rockpi4b/flash-spi.cmd | 28 +++++++++++++++++++ dev-ayufan/boards.mk | 11 ++++++++ .../local/lib/u-boot-rockchip/loader-common | 8 +++++- 5 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 dev-ayufan/blobs/rockpi4b/erase-spi.cmd create mode 100644 dev-ayufan/blobs/rockpi4b/flash-spi.cmd diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ffb16058030..50ea0c70166 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,6 +21,7 @@ build: - ./dev-make BOARD_TARGET=rock64 -j5 - ./dev-make BOARD_TARGET=rockpro64 -j5 - ./dev-make BOARD_TARGET=pinebookpro -j5 + - ./dev-make BOARD_TARGET=rockpi4b -j5 - | set -x diff --git a/dev-ayufan/blobs/rockpi4b/erase-spi.cmd b/dev-ayufan/blobs/rockpi4b/erase-spi.cmd new file mode 100644 index 00000000000..9ad0dd25e4d --- /dev/null +++ b/dev-ayufan/blobs/rockpi4b/erase-spi.cmd @@ -0,0 +1,9 @@ +setenv blink_power 'led status off; sleep 0.1; led status on' + +# erase flash +run blink_power blink_power +sf probe +sf erase 0 400000 + +# blink forever +while true; do run blink_power; sleep 1; done diff --git a/dev-ayufan/blobs/rockpi4b/flash-spi.cmd b/dev-ayufan/blobs/rockpi4b/flash-spi.cmd new file mode 100644 index 00000000000..b0c51693bdb --- /dev/null +++ b/dev-ayufan/blobs/rockpi4b/flash-spi.cmd @@ -0,0 +1,28 @@ +setenv blink_power 'led status off; sleep 0.1; led status on' +setenv blink_standby 'led status off; sleep 0.1; led status on' + +# first read existing loader +run blink_power +sf probe + +# or load rkspi_loader.img and write it to 0 offset of spi +# or fail badly + +if size ${devtype} ${devnum}:${distro_bootpart} rkspi_loader.img; then + load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} rkspi_loader.img + + # erase flash + run blink_power blink_power + sf erase 0 400000 + + # write flash + run blink_power blink_power blink_power + sf write ${kernel_addr_r} 0 ${filesize} + + # blink forever + while true; do run blink_power; sleep 1; done +else + # blink forever + echo "missing rkspi_loader.img" + while true; do run blink_standby; sleep 1; done +fi diff --git a/dev-ayufan/boards.mk b/dev-ayufan/boards.mk index 635e99c09f9..c1c18497000 100644 --- a/dev-ayufan/boards.mk +++ b/dev-ayufan/boards.mk @@ -23,6 +23,17 @@ USE_SEPARATE_SPIFLASH ?= true IMAGES ?= flash-spi erase-spi LOADERS ?= rksd_loader rkspi_loader +else ifeq (rockpi4b,$(BOARD_TARGET)) + +UBOOT_DEFCONFIG ?= rockpi4b-rk3399_defconfig +UBOOT_TPL ?= tmp/rkbin/rk33/rk3399_ddr_933MHz_v1.19.bin +BL31 ?= tmp/rkbin/rk33/rk3399_bl31_v1.25.elf +BOARD_CHIP ?= rk3399 +LOADER_BIN ?= tmp/rkbin/rk33/rk3399_loader_v1.10.112_support_1CS.bin +USE_SEPARATE_SPIFLASH ?= true +IMAGES ?= flash-spi erase-spi +LOADERS ?= rksd_loader rkspi_loader + else ifeq (pinebookpro,$(BOARD_TARGET)) UBOOT_DEFCONFIG ?= pinebook_pro-rk3399_defconfig diff --git a/dev-ayufan/root/usr/local/lib/u-boot-rockchip/loader-common b/dev-ayufan/root/usr/local/lib/u-boot-rockchip/loader-common index d475a9d474f..1f2a772da68 100644 --- a/dev-ayufan/root/usr/local/lib/u-boot-rockchip/loader-common +++ b/dev-ayufan/root/usr/local/lib/u-boot-rockchip/loader-common @@ -48,6 +48,12 @@ case "$PACKAGE_NAME" in BOARD=pinebookpro ;; + *-rockchip-rockpi4b-*) + SD_LOADER=/usr/lib/u-boot-rockpi4b/rksd_loader.img + SPI_LOADER=/usr/lib/u-boot-rockpi4b/rkspi_loader.img + BOARD=rockpi4b + ;; + *) echo "Cannot detect board from $PACKAGE_NAME." exit 1 @@ -56,7 +62,7 @@ esac if ! grep -qi "$BOARD" /proc/device-tree/compatible; then echo "You are currently running on different board:" - cat /proc/device-tree/model || true + echo "$(cat /proc/device-tree/model || true)" echo "It may brick your device or the system unless" echo "you know what are you doing." echo ""