Skip to content

Commit

Permalink
[u-boot] switch to mainline u-boot version
Browse files Browse the repository at this point in the history
  • Loading branch information
rroohhh committed May 12, 2019
1 parent 3f43acf commit d9052b0
Show file tree
Hide file tree
Showing 8 changed files with 12,340 additions and 31 deletions.
2 changes: 1 addition & 1 deletion makefiles/host/assemble.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ build/$(IMAGE): build/boot.part build/root.part
dd if=build/boot.part of=$@ bs=512 seek=$$(sfdisk -l build/$(IMAGE) -o start -q | sed -n "2p" | sed 's/ //g') conv=sparse,notrunc
dd if=build/root.part of=$@ bs=512 seek=$$(sfdisk -l build/$(IMAGE) -o start -q | sed -n "3p" | sed 's/ //g') conv=sparse,notrunc

build/boot.part: build/boot.fs/BOOT.bin
build/boot.part: build/boot.fs/.install_stamp
rm -f build/boot.part
fallocate -l $(BOOTSIZE) build/boot.part
mkfs.vfat -n "BOOT" -F 32 build/boot.part
Expand Down
49 changes: 23 additions & 26 deletions makefiles/host/bootfs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@ ARCH = arm
LINUX_VERSION = v4.20.4
LINUX_SOURCE = build/linux-$(LINUX_VERSION).git

UBOOT_VERSION = xilinx-v2018.3
UBOOT_SOURCE = build/u-boot-xlnx-$(UBOOT_VERSION).git
UBOOT_VERSION = v2019.04
UBOOT_SOURCE = build/u-boot-$(UBOOT_VERSION).git

build/boot.fs/BOOT.bin: $(LINUX_SOURCE)/arch/arm/boot/zImage $(UBOOT_SOURCE)/u-boot.elf build/boot.fs/devicetree.dtb \
build/zynq-mkbootimage.git/mkbootimage boot/boot.bif boot/axiom-$(DEVICE)/fsbl.elf boot/axiom-$(DEVICE)/uEnv.txt \
build/boot.fs/devicetree.dts
build/boot.fs/.install_stamp: $(LINUX_SOURCE)/arch/arm/boot/zImage $(UBOOT_SOURCE)/u-boot.img $(UBOOT_SOURCE)/spl/boot.bin build/boot.fs/devicetree.dtb \
boot/axiom-$(DEVICE)/uEnv.txt build/boot.fs/devicetree.dts
mkdir -p $(@D)

ifeq ($(DEVICE),micro)
cp -a boot/axiom-micro/bitstream.bit $(@D)/bitstream.bit
endif

cp boot/axiom-$(DEVICE)/uEnv.txt boot/axiom-$(DEVICE)/fsbl.elf boot/boot.bif $(UBOOT_SOURCE)/u-boot.elf $(LINUX_SOURCE)/arch/arm/boot/zImage $(@D)
cp boot/axiom-$(DEVICE)/uEnv.txt $(UBOOT_SOURCE)/u-boot.img $(UBOOT_SOURCE)/spl/boot.bin $(LINUX_SOURCE)/arch/arm/boot/zImage $(@D)

(cd $(@D) && ../zynq-mkbootimage.git/mkbootimage boot.bif BOOT.bin)
touch $@


### Kernel
Expand All @@ -29,7 +28,7 @@ $(LINUX_SOURCE): $(LINUX_PATCHES)
rm -rf $@
git clone --branch $(LINUX_VERSION) --depth 1 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git $@

./makefiles/host/patch_wrapper.sh $@ $(LINUX_PATCHES)
./makefiles/host/patch_wrapper.sh $@ $(LINUX_PATCHES)
# remove + at end of kernel version (indicates dirty tree)
touch $@/.scmversion

Expand All @@ -50,22 +49,27 @@ $(LINUX_SOURCE)/arch/arm/boot/zImage: boot/kernel.config $(LINUX_SOURCE)
touch $@

# u-boot
# TODO use mainline uboot -> profit (use `--depth 1` again)
U_BOOT_MAKE = $(MAKE) -C $(UBOOT_SOURCE) CROSS_COMPILE=$(CROSS) ARCH=$(ARCH)
$(UBOOT_SOURCE):
U_BOOT_PATCHES = $(wildcard patches/u-boot/*.patch)
$(UBOOT_SOURCE)/.config: $(U_BOOT_PATCHES)
@mkdir -p $(@D)
git clone --branch $(UBOOT_VERSION) --depth 1 https://github.com/Xilinx/u-boot-xlnx $@
rm -rf $(@D)
git clone --branch $(UBOOT_VERSION) --depth 1 git://www.denx.de/git/u-boot.git $(@D)

./makefiles/host/patch_wrapper.sh $(@D) $(U_BOOT_PATCHES)
# remove -dirty from version
touch $(@D)/.scmversion

$(UBOOT_SOURCE)/u-boot.elf: boot/axiom-$(DEVICE)/u-boot.config $(UBOOT_SOURCE) boot/axiom-micro/devicetree_uboot.dts boot/axiom-beta/devicetree_uboot.dts
# copy the devicetree's (done here to avoid redownload on changed devicetree)
cp boot/axiom-micro/devicetree_uboot.dts $(UBOOT_SOURCE)/arch/arm/dts/zynq-zturn-myir.dts
cp boot/axiom-beta/devicetree_uboot.dts $(UBOOT_SOURCE)/arch/arm/dts/zynq-microzed.dts
# configure u-boot
cp $< $(UBOOT_SOURCE)/.config
+$(U_BOOT_MAKE) olddefconfig
+$(U_BOOT_MAKE) $(U_BOOT_DEFCONFIG)
touch $@

$(UBOOT_SOURCE)/u-boot.img: $(UBOOT_SOURCE)/.config
+$(U_BOOT_MAKE) u-boot.img
touch $@

# finally make it
+$(U_BOOT_MAKE) u-boot.elf
$(UBOOT_SOURCE)/spl/boot.bin: $(UBOOT_SOURCE)/.config $(UBOOT_SOURCE)/u-boot.img
+$(U_BOOT_MAKE) spl/boot.bin
touch $@

build/boot.fs/devicetree.dtb: boot/axiom-$(DEVICE)/devicetree.dts
Expand All @@ -75,10 +79,3 @@ build/boot.fs/devicetree.dtb: boot/axiom-$(DEVICE)/devicetree.dts
build/boot.fs/devicetree.dts: boot/axiom-$(DEVICE)/devicetree.dts
@mkdir -p $(@D)
cp $< $@

# tool for generating BOOT.bin
build/zynq-mkbootimage.git/mkbootimage:
git clone --depth 1 https://github.com/antmicro/zynq-mkbootimage build/zynq-mkbootimage.git
+$(MAKE) -C $(@D)

touch $@
1 change: 1 addition & 0 deletions makefiles/host/config/beta.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
U_BOOT_DEFCONFIG = zynq_microzed_defconfig
1 change: 1 addition & 0 deletions makefiles/host/config/micro.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
U_BOOT_DEFCONFIG = zynq_z_turn_lite_defconfig
7 changes: 4 additions & 3 deletions makefiles/host/main.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include config.mk
include config/$(DEVICE).mk

.DEFAULT_GOAL := build/$(IMAGE)

Expand All @@ -16,12 +17,12 @@ chroot-shell: build/root.fs/.install_stamp
./makefiles/host/run_in_chroot.sh /bin/bash

.PHONY: qemu-shell
qemu-shell: $(QEMU_SOURCE)/aarch64-softmmu/qemu-system-aarch64 build/boot.fs/devicetree.dtb $(UBOOT_SOURCE)/u-boot.elf build/$(IMAGE)
$(QEMU_SOURCE)/aarch64-softmmu/qemu-system-aarch64 -M arm-generic-fdt-7series -machine linux=on -serial /dev/null -serial mon:stdio -nographic -dtb build/boot.fs/devicetree.dtb -kernel $(UBOOT_SOURCE)/u-boot.elf -drive if=sd,format=raw,index=0,file=build/$(IMAGE) -boot mode=5
qemu-shell: $(QEMU_SOURCE)/aarch64-softmmu/qemu-system-aarch64 build/boot.fs/.install_stamp build/$(IMAGE)
$(QEMU_SOURCE)/aarch64-softmmu/qemu-system-aarch64 -M arm-generic-fdt-7series -serial /dev/null -serial mon:stdio -nographic -dtb build/boot.fs/devicetree.dtb -drive if=sd,format=raw,index=0,file=build/$(IMAGE) -kernel build/boot.fs/zImage -append 'console=ttyPS0,115200n8 root=PARTUUID=f37043ff-02 rw rootfstype=ext4 rootwait systemd.log_level=warning loglevel=7 systemd.log_target=console kernel.sysrq=1 init=/usr/lib/systemd/systemd sdhci.debug_quirks=64 kernel.sysrq=1'

# test targets
.PHONY: test
test: $(QEMU_SOURCE)/aarch64-softmmu/qemu-system-aarch64 build/boot.fs/devicetree.dtb $(UBOOT_SOURCE)/u-boot.elf build/$(IMAGE) makefiles/host/run_qemu.expect
test: $(QEMU_SOURCE)/aarch64-softmmu/qemu-system-aarch64 build/boot.fs/.install_stamp build/$(IMAGE) makefiles/host/run_qemu.expect
QEMU_SOURCE=$(QEMU_SOURCE) IMAGE=$(IMAGE) makefiles/host/run_qemu.expect

# cleaning rules
Expand Down
2 changes: 1 addition & 1 deletion makefiles/host/run_qemu.expect
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
puts stdout "starting qemu!\n\n"
set timeout 300

spawn $env(QEMU_SOURCE)/aarch64-softmmu/qemu-system-aarch64 -M arm-generic-fdt-7series -machine linux=on -serial /dev/null -serial mon:stdio -nographic -dtb build/boot.fs/devicetree.dtb -kernel build/boot.fs/u-boot.elf -drive if=sd,format=raw,index=0,file=build/$env(IMAGE) -boot mode=5
spawn $env(QEMU_SOURCE)/aarch64-softmmu/qemu-system-aarch64 -M arm-generic-fdt-7series -serial /dev/null -serial mon:stdio -nographic -dtb build/boot.fs/devicetree.dtb -drive if=sd,format=raw,index=0,file=build/$env(IMAGE) -kernel build/boot.fs/zImage -append {'console=ttyPS0,115200n8 root=PARTUUID=f37043ff-02 rw rootfstype=ext4 rootwait systemd.log_level=warning loglevel=7 systemd.log_target=console kernel.sysrq=1 init=/usr/lib/systemd/systemd sdhci.debug_quirks=64 kernel.sysrq=1'}
expect {
"login:" { }
timeout { puts "\ntimed out\n"; exit 1 }
Expand Down
23 changes: 23 additions & 0 deletions patches/u-boot/microzed_changes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/configs/zynq_microzed_defconfig b/configs/zynq_microzed_defconfig
index 0af0f233dd..549e36835b 100644
--- a/configs/zynq_microzed_defconfig
+++ b/configs/zynq_microzed_defconfig
@@ -8,8 +8,9 @@ CONFIG_FIT=y
CONFIG_FIT_SIGNATURE=y
CONFIG_FIT_VERBOSE=y
CONFIG_IMAGE_FORMAT_LEGACY=y
+CONFIG_BOOTDELAY=0
CONFIG_SPL_STACK_R=y
-CONFIG_SPL_OS_BOOT=y
+CONFIG_SPL_PAYLOAD="u-boot.img"
CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_PROMPT="Zynq> "
CONFIG_CMD_THOR_DOWNLOAD=y
@@ -28,7 +29,6 @@ CONFIG_CMD_TFTPPUT=y
CONFIG_CMD_CACHE=y
CONFIG_CMD_EXT4_WRITE=y
CONFIG_DEFAULT_DEVICE_TREE="zynq-microzed"
-CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_SPL_DM_SEQ_ALIAS=y
CONFIG_DFU_MMC=y
Loading

0 comments on commit d9052b0

Please sign in to comment.