From: Luka Perkov Date: Tue, 5 Nov 2013 08:00:34 +0000 (+0000) Subject: sunxi: add new target X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=cb07269988cd3be7cbbd3278081c5688ae8d7616;p=openwrt%2Fstaging%2Fneocturne.git sunxi: add new target Signed-off-by: Luka Perkov SVN-Revision: 38651 --- diff --git a/target/linux/sunxi/Makefile b/target/linux/sunxi/Makefile new file mode 100644 index 0000000000..bff78e5ee6 --- /dev/null +++ b/target/linux/sunxi/Makefile @@ -0,0 +1,22 @@ +# +# Copyright (C) 2013 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +ARCH:=arm +BOARD:=sunxi +BOARDNAME:=Allwinner SoC +FEATURES:=targz +SUBTARGETS=cortex-a7 cortex-a8 +MAINTAINER:=Luka Perkov + +LINUX_VERSION:=3.10.17 + +include $(INCLUDE_DIR)/target.mk + +KERNELNAME:="zImage dtbs" + +$(eval $(call BuildTarget)) diff --git a/target/linux/sunxi/base-files.mk b/target/linux/sunxi/base-files.mk new file mode 100644 index 0000000000..fdd2c714b2 --- /dev/null +++ b/target/linux/sunxi/base-files.mk @@ -0,0 +1,3 @@ +define Package/base-files/install-target + rm -f $(1)/etc/config/network +endef diff --git a/target/linux/sunxi/base-files/etc/uci-defaults/02_network b/target/linux/sunxi/base-files/etc/uci-defaults/02_network new file mode 100644 index 0000000000..48781e5e00 --- /dev/null +++ b/target/linux/sunxi/base-files/etc/uci-defaults/02_network @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Copyright (C) 2013 OpenWrt.org +# + +[ -e /etc/config/network ] && exit 0 + +touch /etc/config/network + +. /lib/functions/uci-defaults.sh + +ucidef_set_interface_loopback + +case "`cat /proc/device-tree/model`" in +"Cubietech Cubieboard") + ucidef_set_interface_wan 'eth0' + ;; +esac + +uci commit network + +exit 0 diff --git a/target/linux/sunxi/config-3.10 b/target/linux/sunxi/config-3.10 new file mode 100644 index 0000000000..562aa97e7e --- /dev/null +++ b/target/linux/sunxi/config-3.10 @@ -0,0 +1,205 @@ +CONFIG_ALIGNMENT_TRAP=y +# CONFIG_ARCH_BCM is not set +CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_MULTIPLATFORM=y +# CONFIG_ARCH_MULTI_CPU_AUTO is not set +# CONFIG_ARCH_MULTI_V6 is not set +CONFIG_ARCH_MULTI_V6_V7=y +CONFIG_ARCH_MULTI_V7=y +# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set +CONFIG_ARCH_NR_GPIO=288 +# CONFIG_ARCH_OMAP2PLUS is not set +CONFIG_ARCH_REQUIRE_GPIOLIB=y +# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +CONFIG_ARCH_SUNXI=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +# CONFIG_ARCH_VIRT is not set +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +# CONFIG_ARCH_WM8850 is not set +CONFIG_ARM=y +CONFIG_ARM_APPENDED_DTB=y +CONFIG_ARM_ATAG_DTB_COMPAT=y +# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND is not set +CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y +# CONFIG_ARM_CPU_SUSPEND is not set +CONFIG_ARM_L1_CACHE_SHIFT=6 +CONFIG_ARM_L1_CACHE_SHIFT_6=y +# CONFIG_ARM_LPAE is not set +CONFIG_ARM_NR_BANKS=8 +CONFIG_ARM_PATCH_PHYS_VIRT=y +CONFIG_ARM_THUMB=y +# CONFIG_ARM_THUMBEE is not set +CONFIG_ARM_VIRT_EXT=y +CONFIG_ATAGS=y +CONFIG_AUTO_ZRELADDR=y +CONFIG_BOUNCE=y +# CONFIG_CACHE_L2X0 is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_CLKSRC_MMIO=y +CONFIG_CLKSRC_OF=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_COMMON_CLK=y +CONFIG_COMMON_CLK_DEBUG=y +CONFIG_CPU_32v6K=y +CONFIG_CPU_32v7=y +CONFIG_CPU_ABRT_EV7=y +# CONFIG_CPU_BPREDICT_DISABLE is not set +CONFIG_CPU_CACHE_V7=y +CONFIG_CPU_CACHE_VIPT=y +CONFIG_CPU_COPY_V6=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_HAS_ASID=y +# CONFIG_CPU_ICACHE_DISABLE is not set +CONFIG_CPU_PABRT_V7=y +CONFIG_CPU_TLB_V7=y +CONFIG_CPU_V7=y +CONFIG_DCACHE_WORD_ACCESS=y +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +# CONFIG_DEBUG_PINCTRL is not set +# CONFIG_DEBUG_USER is not set +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_DTC=y +CONFIG_FRAME_POINTER=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_GENERIC_IO=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_PINCONF=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_GPIO_SYSFS=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_PFN_VALID=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_HAVE_BPF_JIT=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_HAVE_DEBUG_KMEMLEAK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_GENERIC_HARDIRQS=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_HAVE_KERNEL_XZ=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_NET_DSA=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_HAVE_PROC_CPU=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_UID16=y +CONFIG_HIGHMEM=y +CONFIG_HIGHPTE=y +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_CHARDEV=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_WORK=y +CONFIG_KTIME_SCALAR=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_MTD_OF_PARTS=y +# CONFIG_MTD_PHYSMAP_OF is not set +CONFIG_MULTI_IRQ_HANDLER=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NEON=y +# CONFIG_NET_CADENCE is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +# CONFIG_NET_VENDOR_CIRRUS is not set +# CONFIG_NET_VENDOR_FARADAY is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SMSC is not set +# CONFIG_NET_VENDOR_STMICRO is not set +CONFIG_NO_HZ=y +CONFIG_NO_HZ_COMMON=y +CONFIG_NO_HZ_IDLE=y +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_DEVICE=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_I2C=y +CONFIG_OF_IRQ=y +CONFIG_OF_MTD=y +CONFIG_OF_NET=y +CONFIG_OLD_SIGACTION=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PCI_SYSCALL is not set +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PINCONF=y +CONFIG_PINCTRL=y +# CONFIG_PINCTRL_SINGLE is not set +CONFIG_PINCTRL_SUNXI=y +CONFIG_PINMUX=y +# CONFIG_PREEMPT_RCU is not set +CONFIG_PROC_DEVICETREE=y +# CONFIG_RCU_STALL_COMMON is not set +CONFIG_SCHED_HRTICK=y +# CONFIG_SCSI_DMA is not set +CONFIG_SERIAL_8250_DW=y +CONFIG_SERIAL_8250_NR_UARTS=8 +CONFIG_SERIAL_8250_RUNTIME_UARTS=8 +CONFIG_SPARSE_IRQ=y +CONFIG_SUN4I_TIMER=y +# CONFIG_SWP_EMULATE is not set +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +# CONFIG_TEGRA_HOST1X is not set +# CONFIG_THUMB2_KERNEL is not set +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_UID16=y +CONFIG_UIDGID_CONVERTED=y +CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" +# CONFIG_USB_ARCH_HAS_EHCI is not set +# CONFIG_USB_ARCH_HAS_OHCI is not set +# CONFIG_USB_ARCH_HAS_XHCI is not set +CONFIG_USE_OF=y +CONFIG_VECTORS_BASE=0xffff0000 +CONFIG_VFP=y +CONFIG_VFPv3=y +# CONFIG_WIRELESS is not set +# CONFIG_WLAN is not set +# CONFIG_XEN is not set +CONFIG_ZBOOT_ROM_BSS=0 +CONFIG_ZBOOT_ROM_TEXT=0 +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/sunxi/cortex-a7/profiles/100-generic.mk b/target/linux/sunxi/cortex-a7/profiles/100-generic.mk new file mode 100644 index 0000000000..ca4db9c8ae --- /dev/null +++ b/target/linux/sunxi/cortex-a7/profiles/100-generic.mk @@ -0,0 +1,18 @@ +# +# Copyright (C) 2013 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/Generic + NAME:=Generic (default) + PACKAGES:= \ + uboot-envtools +endef + +define Profile/Generic/Description + Package set compatible with most Allwinner A20, A31 and A31s SoC based boards. +endef + +$(eval $(call Profile,Generic)) diff --git a/target/linux/sunxi/cortex-a7/target.mk b/target/linux/sunxi/cortex-a7/target.mk new file mode 100644 index 0000000000..1267eef30b --- /dev/null +++ b/target/linux/sunxi/cortex-a7/target.mk @@ -0,0 +1,11 @@ +# +# Copyright (C) 2013 OpenWrt.org +# + +BOARDNAME:=A20, A31 and A31s +SUBTARGET:=cortex-a7 +CPU_TYPE:=cortex-a7 + +define Target/Description + Allwinner A20, A31 and A31s SoC +endef diff --git a/target/linux/sunxi/cortex-a8/profiles/100-generic.mk b/target/linux/sunxi/cortex-a8/profiles/100-generic.mk new file mode 100644 index 0000000000..272ec815d7 --- /dev/null +++ b/target/linux/sunxi/cortex-a8/profiles/100-generic.mk @@ -0,0 +1,18 @@ +# +# Copyright (C) 2013 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/Generic + NAME:=Generic (default) + PACKAGES:= \ + uboot-envtools +endef + +define Profile/Generic/Description + Package set compatible with most Allwinner A10, A10s and A13 SoC based boards. +endef + +$(eval $(call Profile,Generic)) diff --git a/target/linux/sunxi/cortex-a8/profiles/110-cubieboard.mk b/target/linux/sunxi/cortex-a8/profiles/110-cubieboard.mk new file mode 100644 index 0000000000..a08a53f4b6 --- /dev/null +++ b/target/linux/sunxi/cortex-a8/profiles/110-cubieboard.mk @@ -0,0 +1,14 @@ +# +# Copyright (C) 2013 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/CUBIEBOARD + NAME:=Cubieboard + PACKAGES:= \ + uboot-envtools +endef + +$(eval $(call Profile,CUBIEBOARD)) diff --git a/target/linux/sunxi/cortex-a8/target.mk b/target/linux/sunxi/cortex-a8/target.mk new file mode 100644 index 0000000000..15984a6d2c --- /dev/null +++ b/target/linux/sunxi/cortex-a8/target.mk @@ -0,0 +1,11 @@ +# +# Copyright (C) 2013 OpenWrt.org +# + +BOARDNAME:=A10, A10s and A13 +SUBTARGET:=cortex-a8 +CPU_TYPE:=cortex-a8 + +define Target/Description + Allwinner A10, A10s and A13 SoC +endef diff --git a/target/linux/sunxi/image/Makefile b/target/linux/sunxi/image/Makefile new file mode 100644 index 0000000000..3a9f64d9af --- /dev/null +++ b/target/linux/sunxi/image/Makefile @@ -0,0 +1,121 @@ +# +# Copyright (C) 2013 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +define sanitize_profile_name +$(shell echo $(PROFILE) | tr '[:upper:]' '[:lower:]' | sed 's/_/-/g') +endef + +define Image/BuildKernel/Template + + $(CP) $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage + echo -ne '\x00\x00\x00\x00' >> $(BIN_DIR)/$(IMG_PREFIX)-zImage + $(call Image/BuildKernel/MkuImage, \ + none, 0x40008000, 0x40008000, \ + $(BIN_DIR)/$(IMG_PREFIX)-zImage, \ + $(BIN_DIR)/$(IMG_PREFIX)-uImage \ + ) + + ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + $(CP) $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs + echo -ne '\x00\x00\x00\x00' >> $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs + $(call Image/BuildKernel/MkuImage, \ + none, 0x40008000, 0x40008000, \ + $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs, \ + $(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs \ + ) + endif + + ifneq ($(1),) + $(CP) $(LINUX_DIR)/arch/arm/boot/dts/$(1).dtb $(BIN_DIR)/$(IMG_PREFIX)-$(1).dtb + + $(CP) $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-zImage + cat $(BIN_DIR)/$(IMG_PREFIX)-$(1).dtb >> $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-zImage + $(call Image/BuildKernel/MkuImage, \ + none, 0x40008000, 0x40008000, \ + $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-zImage, \ + $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-uImage \ + ) + + ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + $(CP) $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-zImage-initramfs + cat $(BIN_DIR)/$(IMG_PREFIX)-$(1).dtb >> $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-zImage-initramfs + $(call Image/BuildKernel/MkuImage, \ + none, 0x40008000, 0x40008000, \ + $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-zImage-initramfs, \ + $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-uImage-initramfs \ + ) + endif + endif +endef + +define Image/InstallKernel/Template + + ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_KERNEL),) + $(INSTALL_DIR) $(TARGET_DIR)/boot + ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_UIMAGE),) + $(CP) $(BIN_DIR)/$(IMG_PREFIX)-uImage $(TARGET_DIR)/boot/ + ln -sf $(IMG_PREFIX)-uImage $(TARGET_DIR)/boot/uImage + endif + ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_ZIMAGE),) + $(CP) $(BIN_DIR)/$(IMG_PREFIX)-zImage $(TARGET_DIR)/boot/ + ln -sf $(IMG_PREFIX)-zImage $(TARGET_DIR)/boot/zImage + endif + endif + + ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_DTB),) + $(INSTALL_DIR) $(TARGET_DIR)/boot + ifneq ($(1),) + $(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(1).dtb $(TARGET_DIR)/boot/ + ln -sf $(IMG_PREFIX)-$(1).dtb $(TARGET_DIR)/boot/$(1).dtb + endif + endif +endef + +define Image/mkfs/targz + + $(TAR) -czpf $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-rootfs.tar.gz --numeric-owner --owner=0 --group=0 -C $(TARGET_DIR)/ . +endef + +define Image/Build/ubifs + + ifneq ($($(PROFILE)_UBIFS_OPTS),) + $(CP) $(KDIR)/root.ubifs $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-rootfs.ubifs + endif +endef + +define Image/Build/ubi + + ifneq ($($(PROFILE)_UBI_OPTS),) + $(CP) $(KDIR)/root.ubi $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-rootfs.ubi + endif +endef + + +Image/BuildKernel/Template/generic=$(call Image/BuildKernel/Template) +Image/InstallKernel/Template/generic=$(call Image/InstallKernel/Template) + +Image/BuildKernel/Template/CUBIEBOARD=$(call Image/BuildKernel/Template,sun4i-a10-cubieboard) +Image/InstallKernel/Template/CUBIEBOARD=$(call Image/InstallKernel/Template,sun4i-a10-cubieboard) + +define Image/BuildKernel + $(call Image/BuildKernel/Template/$(PROFILE)) +endef + +define Image/InstallKernel + $(call Image/InstallKernel/Template/$(PROFILE)) +endef + +define Image/Build + $(if $(Image/Build/$(1)), \ + $(call Image/Build/$(1),$(1)), \ + $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-$(1).img \ + ) +endef + +$(eval $(call BuildImage))