aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZoltan Herpai <wigyori@uid0.hu>2016-07-15 16:55:19 +0200
committerGitHub <noreply@github.com>2016-07-15 16:55:19 +0200
commite365798d804207f172e78249a58b8e8881835030 (patch)
tree8f306065588647b71fb2e650fbda23baf29b9fdd
parent00e666a59443521409144fa14cc6ecd8a645d1d4 (diff)
parent138f0748e9ccb7a71dd4fbd4941f5d8ff6509366 (diff)
downloadmaster-187ad058-e365798d804207f172e78249a58b8e8881835030.tar.gz
master-187ad058-e365798d804207f172e78249a58b8e8881835030.tar.bz2
master-187ad058-e365798d804207f172e78249a58b8e8881835030.zip
Merge pull request #31 from qinfengling/zedboard
zynq: add sdcard image generation support
-rw-r--r--package/boot/uboot-zynq/Makefile19
-rw-r--r--package/boot/uboot-zynq/patches/001-use-dtc-in-kernel.patch13
-rw-r--r--package/boot/uboot-zynq/uEnv-default.txt4
-rw-r--r--target/linux/zynq/Makefile2
-rw-r--r--target/linux/zynq/image/Config.in5
-rw-r--r--target/linux/zynq/image/Makefile29
-rwxr-xr-xtarget/linux/zynq/image/gen_zynq_sdcard_img.sh27
-rw-r--r--target/linux/zynq/profiles/zc702.mk3
-rw-r--r--target/linux/zynq/profiles/zed.mk3
-rw-r--r--target/linux/zynq/profiles/zybo.mk3
-rw-r--r--tools/Makefile2
11 files changed, 102 insertions, 8 deletions
diff --git a/package/boot/uboot-zynq/Makefile b/package/boot/uboot-zynq/Makefile
index 412415bfc6..48d2d6bd7d 100644
--- a/package/boot/uboot-zynq/Makefile
+++ b/package/boot/uboot-zynq/Makefile
@@ -6,15 +6,16 @@
#
include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.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)
@@ -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
@@ -81,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
@@ -99,12 +103,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/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__ \
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 <jason.wu.misc@gamil.com>
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 <file> <bootfs image> <rootfs image> <bootfs size> <rootfs size>"
+ 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
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