rk3399 support

This commit is contained in:
Martijn Braam 2020-04-09 17:35:43 +02:00
parent 7765a4a74a
commit 5389546c49
No known key found for this signature in database
GPG Key ID: C4280ACB000B060F
11 changed files with 4986 additions and 15 deletions

3
.gitignore vendored
View File

@ -4,6 +4,9 @@
/initramfs-*
/build
/dtbs
/src/linux-rockchip
/src/u-boot
/src/arm-trusted-firmware
/*.scr
/*.dtb
/*.img.xz

6
.gitmodules vendored
View File

@ -5,9 +5,3 @@
path = src/linux
url = https://gitlab.com/pine64-org/linux.git
branch = pine64-kernel-5.5.y
[submodule "src/u-boot"]
path = src/u-boot
url = https://github.com/u-boot/u-boot
[submodule "src/arm-trusted-firmware"]
path = src/arm-trusted-firmware
url = https://github.com/ARM-software/arm-trusted-firmware.git

View File

@ -1,6 +1,7 @@
CROSS_FLAGS = ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
CROSS_FLAGS_BOOT = CROSS_COMPILE=aarch64-linux-gnu-
all: pine64-pinephone.img.xz pine64-pinetab.img.xz
all: pine64-pinephone.img.xz pine64-pinetab.img.xz pine64-pinebookpro.img.xz
pine64-pinephone.img: fat-pine64-pinephone.img u-boot-sunxi-with-spl.bin
@ -43,6 +44,27 @@ fat-pine64-pinetab.img: initramfs-pine64-pinetab.gz kernel-sunxi.gz pine64-pinet
@mcopy -i $@ initramfs-pine64-pinetab.gz ::initramfs.gz
@mcopy -i $@ pine64-pinetab.scr ::boot.scr
pine64-pinebookpro.img: fat-pine64-pinebookpro.img u-boot-rk3399.bin
rm -f $@
truncate --size 50M $@
parted -s $@ mktable msdos
parted -s $@ mkpart primary fat32 32768s 100%
parted -s $@ set 1 boot on
dd if=u-boot-rk3399.bin of=$@ bs=32k seek=1
dd if=fat-$@ of=$@ seek=32768 bs=512
fat-pine64-pinebookpro.img: initramfs-pine64-pinebookpro.gz kernel-rockchip.gz src/pine64-pinebookpro.conf dtbs/rockchip/rk3399-pinebook-pro.dtb
@echo "MKFS $@"
@rm -f $@
@truncate --size 40M $@
@mkfs.fat -F32 $@
@mcopy -i $@ kernel-rockchip.gz ::Image.gz
@mcopy -i $@ dtbs/rockchip/rk3399-pinebook-pro.dtb ::rk3399-pinebook-pro.dtb
@mcopy -i $@ initramfs-pine64-pinebookpro.gz ::initramfs.gz
@mmd -i $@ extlinux
@mcopy -i $@ src/pine64-pinebookpro.conf ::extlinux/extlinux.conf
%.img.xz: %.img
@echo "XZ $@"
@xz -c $< > $@
@ -72,26 +94,73 @@ initramfs-%.gz: initramfs-%.cpio
@echo "GZ $@"
@gzip < $< > $@
kernel-sunxi.gz: src/linux_config
kernel-sunxi.gz: src/linux_config_sunxi
@echo "MAKE $@"
@mkdir -p build/linux-sunxi
@mkdir -p dtbs/sunxi
@cp src/linux_config build/linux-sunxi/.config
@cp src/linux_config_sunxi build/linux-sunxi/.config
@$(MAKE) -C src/linux O=../../build/linux-sunxi $(CROSS_FLAGS) olddefconfig
@$(MAKE) -C src/linux O=../../build/linux-sunxi $(CROSS_FLAGS)
@cp build/linux-sunxi/arch/arm64/boot/Image.gz $@
@cp build/linux-sunxi/arch/arm64/boot/dts/allwinner/*.dtb dtbs/sunxi/
kernel-rockchip.gz: src/linux_config_rockchip src/linux-rockchip
@echo "MAKE $@"
@mkdir -p build/linux-rockchip
@mkdir -p dtbs/rockchip
@cp src/linux_config_rockchip build/linux-rockchip/.config
@$(MAKE) -C src/linux-rockchip O=../../build/linux-rockchip $(CROSS_FLAGS) olddefconfig
@$(MAKE) -C src/linux-rockchip O=../../build/linux-rockchip $(CROSS_FLAGS)
@cp build/linux-rockchip/arch/arm64/boot/Image.gz $@
@cp build/linux-rockchip/arch/arm64/boot/dts/rockchip/*.dtb dtbs/rockchip/
%.scr: src/%.txt
@echo "MKIMG $@"
@mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d $< $@
u-boot-sunxi-with-spl.bin:
@echo "WGET $@"
@wget http://dl-cdn.alpinelinux.org/alpine/edge/main/aarch64/u-boot-pine64-2020.01-r0.apk
@tar -xvf u-boot-pine64-2020.01-r0.apk usr/share/u-boot/pine64-lts/u-boot-sunxi-with-spl.bin --strip-components 4
build/atf/sun50i_a64/bl31.bin: src/arm-trusted-firmware
@echo "MAKE $@"
@mkdir -p build/atf/sun50i_a64
@cd src/arm-trusted-firmware; make $(CROSS_FLAGS_BOOT) PLAT=sun50i_a64 bl31
@cp src/arm-trusted-firmware/build/sun50i_a64/release/bl31.bin "$@"
u-boot-sunxi-with-spl.bin: build/atf/sun50i_a64/bl31.bin src/u-boot
@echo "MAKE $@"
@mkdir -p build/u-boot/sun50i_a64
@BL31=../../../build/atf/sun50i_a64/bl31.bin $(MAKE) -C src/u-boot O=../../build/u-boot/sun50i_a64 $(CROSS_FLAGS_BOOT) pine64-lts_defconfig
@BL31=../../../build/atf/sun50i_a64/bl31.bin $(MAKE) -C src/u-boot O=../../build/u-boot/sun50i_a64 $(CROSS_FLAGS_BOOT) ARCH=arm all
@cp build/u-boot/sun50i_a64/u-boot-sunxi-with-spl.bin "$@"
build/atf/rk3399/bl31.elf: src/arm-trusted-firmware
@echo "MAKE $@"
@mkdir -p build/atf/rk3399
@cd src/arm-trusted-firmware; make $(CROSS_FLAGS_BOOT) PLAT=rk3399 bl31
@cp src/arm-trusted-firmware/build/sun50i_a64/release/bl31/bl31.elf "$@"
u-boot-rk3399.bin: build/atf/rk3399/bl31.elf src/u-boot
@echo "MAKE $@"
@mkdir -p build/u-boot/rk3399
@BL31=../../../build/atf/rk3399/bl31.elf $(MAKE) -C src/u-boot O=../../build/u-boot/rk3399 $(CROSS_FLAGS_BOOT) rockpro64-rk3399_defconfig
@BL31=../../../build/atf/rk3399/bl31.elf $(MAKE) -C src/u-boot O=../../build/u-boot/rk3399 $(CROSS_FLAGS_BOOT) all
@cp build/u-boot/rk3399/u-boot "$@"
src/linux-rockchip:
@echo "WGET linux-rockchip"
@mkdir src/linux-rockchip
@wget https://gitlab.manjaro.org/tsys/linux-pinebook-pro/-/archive/v5.6/linux-pinebook-pro-v5.6.tar.gz
@tar -xvf linux-pinebook-pro-v5.6.tar.gz --strip-components 1 -C src/linux-rockchip
src/arm-trusted-firmware:
@echo "WGET arm-trusted-firmware"
@mkdir src/arm-trusted-firmware
@wget https://github.com/ARM-software/arm-trusted-firmware/archive/50d8cf26dc57bb453b1a52be646140bfea4aa591.tar.gz
@tar -xvf 50d8cf26dc57bb453b1a52be646140bfea4aa591.tar.gz --strip-components 1 -C src/arm-trusted-firmware
src/u-boot:
@echo "WGET u-boot"
@mkdir src/u-boot
@wget ftp://ftp.denx.de/pub/u-boot/u-boot-2020.04-rc4.tar.bz2
@tar -xvf u-boot-2020.04-rc4.tar.bz2 --strip-components 1 -C src/u-boot
.PHONY: clean cleanfast

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,2 @@
PLATFORM=pine64-pinebookpro
EMMC=/dev/mmcblk2

4894
src/linux_config_rockchip Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
timeout 10
default POSTMARKETOS
menu title boot prev kernel
label POSTMARKETOS
kernel /Image.gz
fdt /rk3399-pinebook-pro.dtb
initrd /initramfs.gz
append console=tty0 console=ttyS2,1500000n8 panic=10 coherent_pool=1M video=HDMI-A-1:1920x1080@60 video=eDP-1:1920x1080@60 loglevel=5 mem_sleep_default=s2idle

@ -1 +0,0 @@
Subproject commit c00bd81ae0d6eb1f94e26b31be3a64cadaa05bcb