aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/rockchip/image
diff options
context:
space:
mode:
authorTobias Mädel <t.maedel@alfeld.de>2020-04-12 13:57:25 +0200
committerPetr Štetiar <ynezz@true.cz>2020-04-20 16:37:56 +0200
commit6a05a85dcbf91777a3666693b41bd71dee6d9bfd (patch)
tree1871e9340a4e1a40818bae4112e047ef0fca6dcc /target/linux/rockchip/image
parent797506011695d2dacba74bec717fbf88a7729ace (diff)
downloadupstream-6a05a85dcbf91777a3666693b41bd71dee6d9bfd.tar.gz
upstream-6a05a85dcbf91777a3666693b41bd71dee6d9bfd.tar.bz2
upstream-6a05a85dcbf91777a3666693b41bd71dee6d9bfd.zip
rockchip: add support for Pine64 RockPro64
This adds the new rockchip target and support for RockPro64 RK3399 Flash: 16 MiB SPI NOR RAM: 2 GiB/4 GiB LPDDR4 SoC: RK3399 USB: 2x USB 2.0, 1x USB 3.0, 1x USB-C Ethernet: 1x GbE PCIe: PCIe 2.0, 4 lanes Storage: eMMC or SD card Optional SDIO wifi/bt module The Pine64 RockPro64 is a single-board-computer with a 4x PCIe connector, 6 ARM64 cores (4 little, 2 big), plenty of RAM and storage. By default the single Gigabit-Ethernet port is configured as the LAN port. Installation of the firware is possible by dd'ing the image to an SD card or the eMMC flash. Serial: 3v3 1500000 8n1 U-boot is build from the mainline tree and integrated into the images. Required ATF to build u-boot is downloaded from a CI build bot. Signed-off-by: Tobias Mädel <t.maedel@alfeld.de> Tested-by: Tobias Schramm <t.schramm@manjaro.org>
Diffstat (limited to 'target/linux/rockchip/image')
-rw-r--r--target/linux/rockchip/image/Makefile63
-rw-r--r--target/linux/rockchip/image/armv8.mk14
-rw-r--r--target/linux/rockchip/image/mmc.bootscript8
3 files changed, 85 insertions, 0 deletions
diff --git a/target/linux/rockchip/image/Makefile b/target/linux/rockchip/image/Makefile
new file mode 100644
index 0000000000..5f605ebfe5
--- /dev/null
+++ b/target/linux/rockchip/image/Makefile
@@ -0,0 +1,63 @@
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/image.mk
+
+DEVICE_VARS += UBOOT_DEVICE_NAME
+
+define Build/Compile
+ $(CP) $(LINUX_DIR)/COPYING $(KDIR)/COPYING.linux
+endef
+
+### Image scripts ###
+define Build/boot-common
+ # This creates a new folder copies the dtb (as rockchip.dtb)
+ # and the kernel image (as kernel.img)
+ rm -fR $@.boot
+ mkdir -p $@.boot
+
+ $(CP) $(DTS_DIR)/$(DEVICE_DTS).dtb $@.boot/rockchip.dtb
+ $(CP) $(IMAGE_KERNEL) $@.boot/kernel.img
+endef
+
+define Build/boot-script
+ # Make an U-boot image and copy it to the boot partition
+ mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d mmc.bootscript $@.boot/boot.scr
+endef
+
+define Build/pine64-img
+ # Creates the final SD/eMMC images,
+ # combining boot partition, root partition as well as the u-boot bootloader
+
+ # Generate a new partition table in $@ with 32 MiB of
+ # alignment padding for the idbloader and u-boot to fit:
+ # http://opensource.rock-chips.com/wiki_Boot_option#Boot_flow
+ #
+ # U-Boot SPL expects the U-Boot ITB to be located at sector 0x4000 (8 MiB) on the MMC storage
+ $(SCRIPT_DIR)/gen_image_generic.sh \
+ $@ \
+ $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \
+ $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS) \
+ 32768
+
+ # Copy the idbloader and the u-boot image to the image at sector 0x40 and 0x4000
+ dd if="$(STAGING_DIR_IMAGE)"/$(UBOOT_DEVICE_NAME)-idbloader.img of="$@" seek=64 conv=notrunc
+ dd if="$(STAGING_DIR_IMAGE)"/$(UBOOT_DEVICE_NAME)-u-boot.itb of="$@" seek=16384 conv=notrunc
+endef
+
+### Devices ###
+define Device/Default
+ PROFILES := Default
+ KERNEL := kernel-bin
+ IMAGES := sysupgrade.img.gz
+ SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
+ DEVICE_DTS = rockchip/$$(SOC)-$(lastword $(subst _, ,$(1)))
+endef
+
+ifeq ($(SUBTARGET),armv8)
+ include armv8.mk
+endif
+
+$(eval $(call BuildImage))
diff --git a/target/linux/rockchip/image/armv8.mk b/target/linux/rockchip/image/armv8.mk
new file mode 100644
index 0000000000..737c6e4f9a
--- /dev/null
+++ b/target/linux/rockchip/image/armv8.mk
@@ -0,0 +1,14 @@
+#
+# Copyright (C) 2020 Tobias Maedel
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+define Device/pine64_rockpro64
+ DEVICE_VENDOR := Pine64
+ DEVICE_MODEL := RockPro64
+ SOC := rk3399
+ UBOOT_DEVICE_NAME := rockpro64-rk3399
+ IMAGE/sysupgrade.img.gz := boot-common | boot-script | pine64-img | gzip | append-metadata
+endef
+TARGET_DEVICES += pine64_rockpro64
diff --git a/target/linux/rockchip/image/mmc.bootscript b/target/linux/rockchip/image/mmc.bootscript
new file mode 100644
index 0000000000..b70a62c4c7
--- /dev/null
+++ b/target/linux/rockchip/image/mmc.bootscript
@@ -0,0 +1,8 @@
+part uuid mmc ${devnum}:2 uuid
+
+setenv bootargs "console=ttyS2,1500000 console=tty1 earlycon=uart8250,mmio32,0xff1a0000 root=PARTUUID=${uuid} rw rootwait"
+
+load mmc ${devnum}:1 ${fdt_addr_r} rockchip.dtb
+load mmc ${devnum}:1 ${kernel_addr_r} kernel.img
+
+booti ${kernel_addr_r} - ${fdt_addr_r}