From 951b300fcd86cbb047b70b9a5992d8b3b14c997d Mon Sep 17 00:00:00 2001 From: Mike Qin Date: Fri, 15 Jul 2016 12:01:50 +0800 Subject: packages: uboot-zynq: bump uboot-zynq to 2016.07 Signed-off-by: Mike Qin --- package/boot/uboot-zynq/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/boot/uboot-zynq/Makefile b/package/boot/uboot-zynq/Makefile index 412415bfc6..8dcd43112d 100644 --- a/package/boot/uboot-zynq/Makefile +++ b/package/boot/uboot-zynq/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=u-boot -PKG_VERSION:=2016.03 +PKG_VERSION:=2016.07 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ http://mirror2.openwrt.org/sources \ ftp://ftp.denx.de/pub/u-boot -PKG_MD5SUM:=973c1d896be751321cc3aafa564f64b2 +PKG_MD5SUM:=425a3fa610a7d972e5092a0e92276c70 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) -- cgit v1.2.3 From 4d133a7c632cd50db5e18978b82f04069dc5d99d Mon Sep 17 00:00:00 2001 From: Mike Qin Date: Thu, 14 Jul 2016 14:22:09 +0800 Subject: tools: build dosfstools and mtools for zynq Signed-off-by: Mike Qin --- tools/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Makefile b/tools/Makefile index 43ca9382b0..bb839100e6 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -36,7 +36,7 @@ tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2 tools-$(CONFIG_powerpc) += upx tools-$(CONFIG_TARGET_x86) += qemu tools-$(CONFIG_TARGET_mxs) += elftosb sdimage -tools-$(CONFIG_TARGET_brcm2708)$(CONFIG_TARGET_sunxi)$(CONFIG_TARGET_mxs)$(CONFIG_TARGET_omap) += mtools dosfstools +tools-$(CONFIG_TARGET_brcm2708)$(CONFIG_TARGET_sunxi)$(CONFIG_TARGET_mxs)$(CONFIG_TARGET_omap)$(CONFIG_TARGET_zynq) += mtools dosfstools tools-$(CONFIG_TARGET_ar71xx) += lzma-old squashfs tools-y += lzma squashfs4 tools-$(BUILD_B43_TOOLS) += b43-tools -- cgit v1.2.3 From 2268ee8e1f16e7f888bf03c48011271a3ebae122 Mon Sep 17 00:00:00 2001 From: Mike Qin Date: Fri, 15 Jul 2016 12:05:27 +0800 Subject: zynq: add sdcard image generation support when board profile is selected Signed-off-by: Mike Qin --- package/boot/uboot-zynq/Makefile | 12 +++++++++++ package/boot/uboot-zynq/uEnv-default.txt | 4 ++++ target/linux/zynq/Makefile | 2 +- target/linux/zynq/image/Config.in | 5 +++++ target/linux/zynq/image/Makefile | 29 ++++++++++++++++++++++++++ target/linux/zynq/image/gen_zynq_sdcard_img.sh | 27 ++++++++++++++++++++++++ target/linux/zynq/profiles/zc702.mk | 3 ++- target/linux/zynq/profiles/zed.mk | 3 ++- target/linux/zynq/profiles/zybo.mk | 3 ++- 9 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 package/boot/uboot-zynq/uEnv-default.txt create mode 100644 target/linux/zynq/image/Config.in create mode 100755 target/linux/zynq/image/gen_zynq_sdcard_img.sh diff --git a/package/boot/uboot-zynq/Makefile b/package/boot/uboot-zynq/Makefile index 8dcd43112d..366bdc9775 100644 --- a/package/boot/uboot-zynq/Makefile +++ b/package/boot/uboot-zynq/Makefile @@ -6,6 +6,7 @@ # include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=u-boot PKG_VERSION:=2016.07 @@ -74,6 +75,8 @@ UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT)) UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin) endif +UENV:=default + define Build/Configure +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ $(BOARD)_$(UBOOT_CONFIG)_config @@ -99,12 +102,21 @@ define Package/uboot/install/default $(CP) $(PKG_BUILD_DIR)/u-boot-dtb.img \ $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-dtb.img + $(CP) $(PKG_BUILD_DIR)/u-boot-dtb.img \ + $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-u-boot-dtb.img + $(CP) $(PKG_BUILD_DIR)/spl/boot.bin \ $(BIN_DIR)/uboot-$(BOARD)-$(1)/boot.bin + $(CP) $(PKG_BUILD_DIR)/spl/boot.bin \ + $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-u-boot.bin + $(CP) $(PKG_BUILD_DIR)/spl/u-boot-spl \ $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-spl + $(CP) uEnv-$(UENV).txt \ + $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-uEnv.txt + $(CP) $(PKG_BUILD_DIR)/spl/u-boot-spl-dtb.bin \ $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-spl-dtb.bin endef diff --git a/package/boot/uboot-zynq/uEnv-default.txt b/package/boot/uboot-zynq/uEnv-default.txt new file mode 100644 index 0000000000..b352b4c7ae --- /dev/null +++ b/package/boot/uboot-zynq/uEnv-default.txt @@ -0,0 +1,4 @@ +loadkernel=fatload mmc 0 0x2080000 uImage +loaddtb=fatload mmc 0 0x2000000 devicetree.dtb +bootargs=console=ttyPS0,115200 root=/dev/mmcblk0p2 rootwait +uenvcmd=run loadkernel \&\& run loaddtb \&\& bootm 0x2080000 - 0x2000000 diff --git a/target/linux/zynq/Makefile b/target/linux/zynq/Makefile index 6495c59723..e700c40c3a 100644 --- a/target/linux/zynq/Makefile +++ b/target/linux/zynq/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/host.mk ARCH:=arm BOARD:=zynq BOARDNAME:=Xilinx Zynq 7000 SoCs -FEATURES:=fpu gpio rtc usb usbgadget targz ubifs +FEATURES:=fpu gpio rtc usb usbgadget targz ext4 CPU_TYPE:=cortex-a9 CPU_SUBTYPE:=neon MAINTAINER:=Jason Wu diff --git a/target/linux/zynq/image/Config.in b/target/linux/zynq/image/Config.in new file mode 100644 index 0000000000..ded974196e --- /dev/null +++ b/target/linux/zynq/image/Config.in @@ -0,0 +1,5 @@ +config ZYNQ_SD_BOOT_PARTSIZE + int "Boot (SD Card) filesystem partition size (in MB)" + depends on TARGET_zynq + default 20 + diff --git a/target/linux/zynq/image/Makefile b/target/linux/zynq/image/Makefile index d803c336b8..d89c0ba3db 100644 --- a/target/linux/zynq/image/Makefile +++ b/target/linux/zynq/image/Makefile @@ -6,6 +6,10 @@ # include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk +include $(INCLUDE_DIR)/host.mk + +FAT32_BLOCK_SIZE=1024 +FAT32_BLOCKS=$(shell echo $$(($(CONFIG_ZYNQ_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE)))) ################################################# # Images @@ -40,7 +44,26 @@ define Image/boot-imgs PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/fit-$(DEVICE_LC).its $(KDIR)/fit-$(DEVICE_LC).itb $(CP) $(KDIR)/fit-$(DEVICE_LC).itb $(BIN_DIR)/$(IMG_PREFIX)-fit.itb ln -fs $(IMG_PREFIX)-fit.itb $(BIN_DIR)/fit.itb +endef +define Image/Build/Zynq + # Create SD card image + rm -f $(KDIR_TMP)/$(IMG_PREFIX)-boot.img + mkfs.fat $(KDIR_TMP)/$(IMG_PREFIX)-boot.img -C $(FAT32_BLOCKS) + mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-boot.img $(KDIR)/uboot-$(IMG_PREFIX)-u-boot.bin ::boot.bin + mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-boot.img $(BIN_DIR)/$(DEVICE_DTS)-system.dtb ::devicetree.dtb + mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-boot.img $(KDIR)/uboot-$(IMG_PREFIX)-u-boot-dtb.img ::u-boot.img + mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-boot.img $(KDIR)/uboot-$(IMG_PREFIX)-uEnv.txt ::uEnv.txt + mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage + + ./gen_zynq_sdcard_img.sh \ + $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img \ + $(KDIR_TMP)/$(IMG_PREFIX)-boot.img \ + $(KDIR)/root.$(1) \ + $(CONFIG_ZYNQ_SD_BOOT_PARTSIZE) \ + $(CONFIG_TARGET_ROOTFS_PARTSIZE) + + $(if $(CONFIG_TARGET_IMAGES_GZIP),gzip -9n -c $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img > $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img.gz) endef ################################################# @@ -83,4 +106,10 @@ define Image/BuildKernel $(call Image/boot-imgs) endef +define Image/Build + $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).img + + $(call Image/Build/Zynq,$(1)) +endef + $(eval $(call BuildImage)) diff --git a/target/linux/zynq/image/gen_zynq_sdcard_img.sh b/target/linux/zynq/image/gen_zynq_sdcard_img.sh new file mode 100755 index 0000000000..6b18c8270f --- /dev/null +++ b/target/linux/zynq/image/gen_zynq_sdcard_img.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -x +[ $# -eq 5 ] || { + echo "SYNTAX: $0 " + exit 1 +} + +OUTPUT="$1" +BOOTFS="$2" +ROOTFS="$3" +BOOTFSSIZE="$4" +ROOTFSSIZE="$5" + +head=4 +sect=63 + +set `ptgen -o $OUTPUT -h $head -s $sect -l 4096 -t c -p ${BOOTFSSIZE}M -t 83 -p ${ROOTFSSIZE}M` + +BOOTOFFSET="$(($1 / 512))" +BOOTSIZE="$(($2 / 512))" +ROOTFSOFFSET="$(($3 / 512))" +ROOTFSSIZE="$(($4 / 512))" + +dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc +dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc + diff --git a/target/linux/zynq/profiles/zc702.mk b/target/linux/zynq/profiles/zc702.mk index 9d3c972fa6..23ae3b59d6 100644 --- a/target/linux/zynq/profiles/zc702.mk +++ b/target/linux/zynq/profiles/zc702.mk @@ -6,7 +6,8 @@ # define Profile/ZC702 - NAME:=ZC702 development baord + NAME:=ZC702 development board + PACKAGES:= uboot-zynq-zc702 endef define Profile/ZC702/Description diff --git a/target/linux/zynq/profiles/zed.mk b/target/linux/zynq/profiles/zed.mk index d8ff08b02f..42274510a3 100644 --- a/target/linux/zynq/profiles/zed.mk +++ b/target/linux/zynq/profiles/zed.mk @@ -6,7 +6,8 @@ # define Profile/ZED - NAME:=ZedBoard development baord + NAME:=ZedBoard development board + PACKAGES:= uboot-zynq-zed endef define Profile/ZED/Description diff --git a/target/linux/zynq/profiles/zybo.mk b/target/linux/zynq/profiles/zybo.mk index dfe7e675d7..0cad680d72 100644 --- a/target/linux/zynq/profiles/zybo.mk +++ b/target/linux/zynq/profiles/zybo.mk @@ -6,7 +6,8 @@ # define Profile/ZYBO - NAME:=ZYBO development baord + NAME:=ZYBO development board + PACKAGES:= uboot-zynq-zybo endef define Profile/ZYBO/Description -- cgit v1.2.3 From 138f0748e9ccb7a71dd4fbd4941f5d8ff6509366 Mon Sep 17 00:00:00 2001 From: Mike Qin Date: Fri, 15 Jul 2016 22:16:44 +0800 Subject: packages: uboot-zynq: use dtc in kernel Signed-off-by: Mike Qin --- package/boot/uboot-zynq/Makefile | 3 ++- package/boot/uboot-zynq/patches/001-use-dtc-in-kernel.patch | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 package/boot/uboot-zynq/patches/001-use-dtc-in-kernel.patch diff --git a/package/boot/uboot-zynq/Makefile b/package/boot/uboot-zynq/Makefile index 366bdc9775..48d2d6bd7d 100644 --- a/package/boot/uboot-zynq/Makefile +++ b/package/boot/uboot-zynq/Makefile @@ -84,7 +84,8 @@ endef define Build/Compile +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ - CROSS_COMPILE=$(TARGET_CROSS) + CROSS_COMPILE=$(TARGET_CROSS) \ + DTCDIR=$(LINUX_DIR)/scripts/dtc/ endef define Package/uboot/install/default diff --git a/package/boot/uboot-zynq/patches/001-use-dtc-in-kernel.patch b/package/boot/uboot-zynq/patches/001-use-dtc-in-kernel.patch new file mode 100644 index 0000000000..553c99e02b --- /dev/null +++ b/package/boot/uboot-zynq/patches/001-use-dtc-in-kernel.patch @@ -0,0 +1,13 @@ +Index: u-boot-2016.07/Makefile +=================================================================== +--- u-boot-2016.07.orig/Makefile ++++ u-boot-2016.07/Makefile +@@ -348,7 +348,7 @@ OBJDUMP = $(CROSS_COMPILE)objdump + AWK = awk + PERL = perl + PYTHON = python +-DTC = dtc ++DTC = $(DTCDIR)dtc + CHECK = sparse + + CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ -- cgit v1.2.3