Skip to content

Commit

Permalink
Preliminary radxa support
Browse files Browse the repository at this point in the history
Patches added and tested on rockpi-e board. Board can boot and mender works.


Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
  • Loading branch information
nandra committed Apr 24, 2023
1 parent dc79fe2 commit 96d3dde
Show file tree
Hide file tree
Showing 9 changed files with 182 additions and 0 deletions.
25 changes: 25 additions & 0 deletions meta-mender-radxa/README.md
@@ -0,0 +1,25 @@
# Mender integration for Rockchip based boards

Supported boards:

- Tinker Board

## Build

Download the source:

$ mkdir mender-rockchip
$ cd mender-rockchip
$ repo init \
-u https://github.com/mendersoftware/meta-mender-community \
-m meta-mender-rockchip/scripts/manifest-rockchip.xml \
-b thud
$ repo sync

Setup environment

$ . setup-environment rockchip

Build

$ bitbake core-image-base
11 changes: 11 additions & 0 deletions meta-mender-radxa/classes/radxa-sdimg.bbclass
@@ -0,0 +1,11 @@
inherit image_types

# It is not possible to specific this using MENDER_IMAGE_BOOTLOADER_FILE/OFFSET,
# instead we use an append to "gptimg" to embedd the bootloader
IMAGE_CMD:gptimg:append() {
outimgname="${IMGDEPLOYDIR}/${IMAGE_NAME}.$suffix"
dd if=${DEPLOY_DIR_IMAGE}/idbloader.img of=${outimgname} conv=notrunc seek=64
dd if=${DEPLOY_DIR_IMAGE}/u-boot.img of=${outimgname} conv=notrunc seek=16384
dd if=${DEPLOY_DIR_IMAGE}/trust.img of=${outimgname} conv=notrunc seek=24576
}

12 changes: 12 additions & 0 deletions meta-mender-radxa/conf/layer.conf
@@ -0,0 +1,12 @@
# Copyright 2018 Northern.tech AS

# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"

# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "mender-radxa"
BBFILE_PATTERN_mender-radxa = "^${LAYERDIR}/"
BBFILE_PRIORITY_mender-radxa = "10"
@@ -0,0 +1,51 @@
From e2855df9b775fe69bf4c4171bb99f10cb98d35e8 Mon Sep 17 00:00:00 2001
From: Marek Belisko <marek.belisko@open-nandra.com>
Date: Tue, 18 Apr 2023 14:57:52 +0200
Subject: [PATCH] Added mender defines

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
env/Kconfig | 4 ++--
include/configs/rockchip-common.h | 6 ++++++
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/env/Kconfig b/env/Kconfig
index bc03816bc8..b711216f12 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -469,7 +469,7 @@ if ARCH_ROCKCHIP || ARCH_SUNXI || ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL || ARC
config ENV_OFFSET
hex "Environment Offset"
depends on (!ENV_IS_IN_UBI && !ENV_IS_NOWHERE) || ARCH_STM32MP
- default 0x3f8000 if ARCH_ROCKCHIP
+ default 0x3f8000 if ARCH_ROCKCHIP
default 0x88000 if ARCH_SUNXI
default 0xE0000 if ARCH_ZYNQ
default 0x1E00000 if ARCH_ZYNQMP
@@ -484,7 +484,7 @@ config ENV_SIZE
hex "Environment Size"
default 0x40000 if ENV_IS_IN_SPI_FLASH && ARCH_ZYNQMP
default 0x20000 if ARCH_SUNXI || ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91
- default 0x8000 if ARCH_ROCKCHIP || ARCH_ZYNQMP || ARCH_VERSAL
+ default 0x4000 if ARCH_ROCKCHIP || ARCH_ZYNQMP || ARCH_VERSAL
default 0x4000 if ARC
default 0x1f000
help
diff --git a/include/configs/rockchip-common.h b/include/configs/rockchip-common.h
index 68e1105a4b..63db946220 100644
--- a/include/configs/rockchip-common.h
+++ b/include/configs/rockchip-common.h
@@ -59,4 +59,10 @@

#endif

+/*mender defines*/
+#define CONFIG_BOOTCOUNT_LIMIT
+#define CONFIG_BOOTCOUNT_ENV
+#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
+
+
#endif /* _ROCKCHIP_COMMON_H_ */
--
2.25.1

@@ -0,0 +1,34 @@
From 191ac4cdd5fde3ae42929f8a3731da5546117849 Mon Sep 17 00:00:00 2001
From: Marek Belisko <marek.belisko@open-nandra.com>
Date: Mon, 24 Apr 2023 21:02:20 +0200
Subject: [PATCH] sdkf

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
arch/arm/mach-rockchip/misc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/misc.c b/arch/arm/mach-rockchip/misc.c
index aeceae89e5..8031a90b26 100644
--- a/arch/arm/mach-rockchip/misc.c
+++ b/arch/arm/mach-rockchip/misc.c
@@ -20,6 +20,7 @@

int rockchip_setup_macaddr(void)
{
+ return 0;
#if CONFIG_IS_ENABLED(CMD_NET)
int ret;
const char *cpuid = env_get("cpuid#");
@@ -116,7 +117,7 @@ int rockchip_cpuid_set(const u8 *cpuid, const u32 cpuid_length)
snprintf(serialno_str, sizeof(serialno_str), "%016llx", serialno);

env_set("cpuid#", cpuid_str);
- env_set("serial#", serialno_str);
+ //env_set("serial#", serialno_str);

return 0;
}
--
2.25.1

@@ -0,0 +1,7 @@
run mender_setup;
setenv bootargs console=${console} console=ttyS2,1500000N8 console=tty1 root=${mender_kernel_root} rootwait panic=10 ${extra}
mmc dev ${mender_uboot_dev};
load ${mender_uboot_root} ${kernel_addr_r} /boot/Image;
load ${mender_uboot_root} ${fdt_addr_r} /boot/${mender_dtb_name};
booti ${kernel_addr_r} - ${fdt_addr_r}
run mender_try_to_recover;
14 changes: 14 additions & 0 deletions meta-mender-radxa/recipes-bsp/u-boot/u-boot-rockpi-e.bbappend
@@ -0,0 +1,14 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

MENDER_UBOOT_AUTO_CONFIGURE = "0"

include recipes-bsp/u-boot/u-boot-mender.inc

PROVIDES += "u-boot"
RPROVIDES:${PN} += "u-boot"

SRC_URI:append = " \
file://0001-Added-mender-defines.patch \
file://0002-Do-not-update-serial.patch \
file://boot.cmd \
"
@@ -0,0 +1,25 @@
From bb002f37bc8473902596c7decd28b4f1ef2bba05 Mon Sep 17 00:00:00 2001
From: Marek Belisko <marek.belisko@open-nandra.com>
Date: Mon, 24 Apr 2023 21:14:04 +0200
Subject: [PATCH] Enable serial console

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts
index 52732643f049..11f1148b8e64 100644
--- a/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts
@@ -494,3 +494,7 @@
rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */
};
+
+&uart2 {
+ status = "okay";
+};
--
2.25.1

@@ -0,0 +1,3 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI += "file://0001-Enable-serial-console.patch"

0 comments on commit 96d3dde

Please sign in to comment.