Skip to content

Commit 148ac4e

Browse files
committed
Initial commit
0 parents  commit 148ac4e

File tree

7 files changed

+115
-0
lines changed

7 files changed

+115
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/arm-trusted-firmware/
2+
/u-boot/
3+
/gcc-linaro-*/
4+
/tmp/
5+
/sunxi-tools/
6+
/bootloaders/

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
UBOOT_CONFIG := sopine_baseboard
2+
ATF ?= arm-trusted-firmware/build/sun50iw1p1/debug/bl31.bin
3+
4+
all: image-bootloaders
5+
6+
include Makefile.linaro.mk
7+
include Makefile.atf.mk
8+
include Makefile.uboot.mk
9+
include Makefile.tools.mk
10+
include Makefile.sopine.mk
11+
12+
bootloaders:
13+
mkdir -p $@
14+
15+
bootloaders/pine64_plus-uboot.bin: tmp/u-boot-pine64_plus/u-boot-with-spl.bin bootloaders
16+
cp $< $@
17+
18+
bootloaders/sopine_baseboard-uboot.bin: tmp/u-boot-sopine_baseboard/u-boot-with-spl.bin bootloaders
19+
cp $< $@
20+
21+
.PHONY: image-bootloaders
22+
image-bootloaders: \
23+
bootloaders/pine64_plus-uboot.bin \
24+
bootloaders/sopine_baseboard-uboot.bin

Makefile.atf.mk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
arm-trusted-firmware:
2+
git clone https://github.com/apritzel/arm-trusted-firmware.git $@
3+
4+
arm-trusted-firmware/build/sun50iw1p1/release/bl31.bin: arm-trusted-firmware
5+
make -C $< CROSS_COMPILE="$(LINARO_CC)" PLAT=sun50iw1p1 bl31
6+
7+
arm-trusted-firmware/build/sun50iw1p1/debug/bl31.bin: arm-trusted-firmware
8+
make -C $< CROSS_COMPILE="$(LINARO_CC)" PLAT=sun50iw1p1 DEBUG=1 bl31

Makefile.linaro.mk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
LINARO_URL ?= https://releases.linaro.org/components/toolchain/binaries/6.3-2017.05/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz
2+
LINARO ?= $(basename $(basename $(notdir $(LINARO_URL))))
3+
LINARO_CC ?= ccache $(CURDIR)/$(LINARO)/bin/aarch64-linux-gnu-
4+
5+
linaro: $(LINARO)
6+
7+
$(LINARO):
8+
curl -L $(LINARO_URL) | \
9+
tar Jx

Makefile.sopine.mk

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.PHONY: sopine-spiflash-write
2+
sopine-spiflash-write: \
3+
tmp/u-boot-sopine_baseboard/spl/sunxi-spl.bin \
4+
tmp/u-boot-sopine_baseboard/u-boot.itb \
5+
sunxi-tools/sunxi-fel
6+
sunxi-tools/sunxi-fel spiflash-write 0 $(word 1,$^)
7+
sunxi-tools/sunxi-fel spiflash-write 32768 $(word 2,$^)
8+
9+
.PHONY: sopine-spiflash-clear
10+
sopine-spiflash-clear: sunxi-tools/sunxi-fel
11+
dd if=/dev/zero of=tmp/clear.img count=16
12+
sunxi-tools/sunxi-fel spiflash-write 0 tmp/clear.img
13+
14+
.PHONY: sopine-fel
15+
sopine-fel: \
16+
tmp/u-boot-spl32/spl/sunxi-spl.bin \
17+
tmp/u-boot-sopine_baseboard/u-boot.bin \
18+
sunxi-tools/sunxi-fel
19+
sunxi-tools/sunxi-fel -v -p spl $(word 1,$^) \
20+
write 0x44000 $(ATF) \
21+
write 0x4a000000 $(word 2,$^) \
22+
reset64 0x44000
23+

Makefile.tools.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sunxi-tools:
2+
git clone https://github.com/apritzel/sunxi-tools
3+
4+
sunxi-tools/sunxi-fel: sunxi-tools
5+
make -C sunxi-tools

Makefile.uboot.mk

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
u-boot:
2+
git clone https://github.com/linux-sunxi/u-boot $@ --single-branch --depth=30
3+
4+
.PHONY: u-boot-menuconfig
5+
u-boot-menuconfig: u-boot
6+
make -C $< ARCH=arm $(UBOOT_CONFIG)_defconfig KBUILD_OUTPUT=$(CURDIR)/tmp/u-boot-menuconfig
7+
make -C $< ARCH=arm menuconfig KBUILD_OUTPUT=$(CURDIR)/tmp/u-boot-menuconfig
8+
make -C $< ARCH=arm savedefconfig KBUILD_OUTPUT=$(CURDIR)/tmp/u-boot-menuconfig
9+
mv $(CURDIR)/tmp/u-boot-menuconfig/defconfig $</configs/$(UBOOT_CONFIG)_defconfig
10+
11+
u-boot/configs/%_defconfig: u-boot
12+
13+
tmp/u-boot-%/.config: u-boot/configs/%_defconfig
14+
make -C u-boot ARCH=arm $(shell basename $<) KBUILD_OUTPUT=$(CURDIR)/$(shell dirname $@)
15+
16+
tmp/u-boot-%/spl/sunxi-spl.bin tmp/u-boot-%/u-boot.itb tmp/u-boot-%/u-boot.bin: tmp/u-boot-%/.config \
17+
$(ATF)
18+
make -C u-boot ARCH=arm \
19+
CROSS_COMPILE="$(LINARO_CC)" \
20+
BL31="$(CURDIR)/$(word 2,$^)" \
21+
KBUILD_OUTPUT=$(CURDIR)/$(shell dirname $<) \
22+
-j$$(nproc) \
23+
u-boot-with-spl.bin spl/sunxi-spl.bin u-boot.itb u-boot.bin
24+
25+
tmp/u-boot-spl32/spl/sunxi-spl.bin:
26+
make -C u-boot ARCH=arm \
27+
CROSS_COMPILE="ccache arm-linux-gnueabihf-" \
28+
KBUILD_OUTPUT=$(CURDIR)/tmp/u-boot-spl32 \
29+
-j$$(nproc) \
30+
sun50i_spl32_defconfig
31+
make -C u-boot ARCH=arm \
32+
CROSS_COMPILE="ccache arm-linux-gnueabihf-" \
33+
KBUILD_OUTPUT=$(CURDIR)/tmp/u-boot-spl32 \
34+
-j$$(nproc) \
35+
spl/sunxi-spl.bin
36+
37+
tmp/u-boot-%/u-boot-with-spl.bin: tmp/u-boot-%/spl/sunxi-spl.bin \
38+
tmp/u-boot-%/u-boot.itb
39+
cat $^ > $@.tmp
40+
mv $@.tmp $@

0 commit comments

Comments
 (0)