From a2768bd9e0efb430e864fe5faf5070ea724e2797 Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Mon, 24 Nov 2014 06:34:07 +0000 Subject: [PATCH] arm64: add ARM 64-bits target This target can be emulated using ARM's Foundation_V8 simulator software or qemu-system-aarch64 using the command-line described in the README file. Signed-off-by: Florian Fainelli SVN-Revision: 43355 --- target/linux/arm64/Makefile | 28 +++ target/linux/arm64/README | 13 + target/linux/arm64/base-files/etc/inittab | 5 + target/linux/arm64/config-default | 232 ++++++++++++++++++ target/linux/arm64/image/Makefile | 46 ++++ .../linux/arm64/image/boot-wrapper/Makefile | 38 +++ 6 files changed, 362 insertions(+) create mode 100644 target/linux/arm64/Makefile create mode 100644 target/linux/arm64/README create mode 100644 target/linux/arm64/base-files/etc/inittab create mode 100644 target/linux/arm64/config-default create mode 100644 target/linux/arm64/image/Makefile create mode 100644 target/linux/arm64/image/boot-wrapper/Makefile diff --git a/target/linux/arm64/Makefile b/target/linux/arm64/Makefile new file mode 100644 index 0000000000..a30430bb70 --- /dev/null +++ b/target/linux/arm64/Makefile @@ -0,0 +1,28 @@ +# +# Copyright (C) 2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +ARCH:=aarch64 +BOARD:=arm64 +BOARDNAME:=ARMv8 multiplatform +FEATURES:=fpu ramdisk +CFLAGS:=-Os -pipe -fno-caller-saves +MAINTAINER:=Florian Fainelli + +KERNEL_PATCHVER:=3.14 + +DEVICE_TYPE:=developerboard + +include $(INCLUDE_DIR)/target.mk + +define Target/Description + Build multi-platform images for the ARMv8 instruction set architecture +endef + +KERNELNAME:=Image dtbs + +$(eval $(call BuildTarget)) diff --git a/target/linux/arm64/README b/target/linux/arm64/README new file mode 100644 index 0000000000..0328ca1607 --- /dev/null +++ b/target/linux/arm64/README @@ -0,0 +1,13 @@ +This multi-platform ARMv8 target can be used either with ARM Ltd.'s Foundation_V8 +fast-model doing the following: + +Foundation_v8 --image bin/arm64-eglibc/openwrt-arm64-vexpress-foundation.axf + +or you can also use QEMU: + +qemu-system-aarch64 -machine virt -cpu cortex-a57 -machine type=virt -nographic \ + -smp 1 -m 2048 \ + -kernel bin/arm64-eglibc/openwrt-arm64-qemu-virt-initramfs.Image \ + --append "console=ttyAMA0" + +and enjoy the system booting. diff --git a/target/linux/arm64/base-files/etc/inittab b/target/linux/arm64/base-files/etc/inittab new file mode 100644 index 0000000000..d9d571e8d9 --- /dev/null +++ b/target/linux/arm64/base-files/etc/inittab @@ -0,0 +1,5 @@ +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K shutdown +tts/0::askfirst:/bin/ash --login +ttyAMA0::askfirst:/bin/ash --login +tty1::askfirst:/bin/ash --login diff --git a/target/linux/arm64/config-default b/target/linux/arm64/config-default new file mode 100644 index 0000000000..6c4209ba87 --- /dev/null +++ b/target/linux/arm64/config-default @@ -0,0 +1,232 @@ +CONFIG_64BIT=y +CONFIG_ARCH_DMA_ADDR_T_64BIT=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y +CONFIG_ARCH_HAS_TICK_BROADCAST=y +# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set +CONFIG_ARCH_PHYS_ADDR_T_64BIT=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_DEFAULT=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +CONFIG_ARCH_VEXPRESS=y +CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y +CONFIG_ARCH_WANT_FRAME_POINTERS=y +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +# CONFIG_ARCH_XGENE is not set +CONFIG_ARM64=y +# CONFIG_ARM64_64K_PAGES is not set +# CONFIG_ARM64_CPU_SUSPEND is not set +CONFIG_ARM_AMBA=y +CONFIG_ARM_ARCH_TIMER=y +CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +CONFIG_ARM_GIC=y +# CONFIG_ARM_SP805_WATCHDOG is not set +CONFIG_ATOMIC64_SELFTEST=y +# CONFIG_BLK_CGROUP is not set +CONFIG_BLK_DEV_SD=y +CONFIG_BLOCK_COMPAT=y +CONFIG_BSD_PROCESS_ACCT=y +CONFIG_BSD_PROCESS_ACCT_V3=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +# CONFIG_CFS_BANDWIDTH is not set +CONFIG_CGROUPS=y +# CONFIG_CGROUP_CPUACCT is not set +# CONFIG_CGROUP_DEVICE is not set +# CONFIG_CGROUP_FREEZER is not set +# CONFIG_CGROUP_NET_CLASSID is not set +CONFIG_CGROUP_SCHED=y +CONFIG_CLKDEV_LOOKUP=y +CONFIG_CLKSRC_OF=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMDLINE="console=ttyAMA0" +CONFIG_COMMON_CLK=y +CONFIG_COMMON_CLK_VERSATILE=y +CONFIG_COMMON_CLK_XGENE=y +CONFIG_COMPAT=y +CONFIG_COMPAT_BINFMT_ELF=y +CONFIG_COMPAT_OLD_SIGACTION=y +# CONFIG_CPUSETS is not set +# CONFIG_CPU_BIG_ENDIAN is not set +CONFIG_CPU_RMAP=y +CONFIG_CRC16=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CUSE=y +CONFIG_DCACHE_WORD_ACCESS=y +CONFIG_DEBUG_INFO=y +CONFIG_DEFAULT_IOSCHED="noop" +CONFIG_DEFAULT_NOOP=y +CONFIG_DEVTMPFS=y +CONFIG_DTC=y +CONFIG_EARLY_PRINTK=y +CONFIG_EXT2_FS=y +CONFIG_EXT3_FS=y +CONFIG_EXT4_FS=y +CONFIG_FAIR_GROUP_SCHED=y +CONFIG_FAT_FS=y +CONFIG_FB=y +CONFIG_FB_ARMCLCD=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FRAME_POINTER=y +CONFIG_FS_MBCACHE=y +CONFIG_FUSE_FS=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CSUM=y +CONFIG_GENERIC_IO=y +CONFIG_GENERIC_IOMAP=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_NET_UTILS=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_PFN_VALID=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_HAVE_CLK=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_HAVE_DEBUG_BUGVERBOSE=y +CONFIG_HAVE_DEBUG_KMEMLEAK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_MEMORY_PRESENT=y +CONFIG_HAVE_NET_DSA=y +CONFIG_HAVE_PATA_PLATFORM=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_HAVE_UID16=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +# CONFIG_HUGETLBFS is not set +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_IOMMU_HELPER=y +# CONFIG_IOSCHED_DEADLINE is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_IP_PNP_RARP is not set +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_WORK=y +CONFIG_JBD=y +CONFIG_JBD2=y +CONFIG_LOCKD=y +CONFIG_LOGO=y +CONFIG_LOGO_LINUX_CLUT224=y +# CONFIG_LOGO_LINUX_MONO is not set +# CONFIG_LOGO_LINUX_VGA16 is not set +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_MAGIC_SYSRQ=y +# CONFIG_MISC_FILESYSTEMS is not set +CONFIG_MMC=y +CONFIG_MMC_ARMMMCI=y +CONFIG_MODULES_USE_ELF_RELA=y +# CONFIG_MTD_PHYSMAP_OF is not set +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_SG_DMA_LENGTH=y +# CONFIG_NET_CLS_CGROUP is not set +CONFIG_NET_FLOW_LIMIT=y +CONFIG_NFS_FS=y +CONFIG_NLS=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NO_BOOTMEM=y +CONFIG_NO_HZ=y +CONFIG_NO_HZ_COMMON=y +CONFIG_NO_HZ_IDLE=y +CONFIG_NO_IOPORT=y +CONFIG_NR_CPUS=4 +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_MTD=y +CONFIG_OF_NET=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +CONFIG_POWER_RESET=y +# CONFIG_POWER_RESET_GPIO is not set +CONFIG_POWER_RESET_VEXPRESS=y +# CONFIG_POWER_RESET_XGENE is not set +CONFIG_POWER_SUPPLY=y +# CONFIG_PREEMPT_NONE is not set +# CONFIG_PREEMPT_RCU is not set +CONFIG_PREEMPT_VOLUNTARY=y +CONFIG_PROFILING=y +CONFIG_RCU_STALL_COMMON=y +# CONFIG_RESOURCE_COUNTERS is not set +CONFIG_RFS_ACCEL=y +CONFIG_ROOT_NFS=y +CONFIG_RPS=y +# CONFIG_RT_GROUP_SCHED is not set +CONFIG_SCHED_AUTOGROUP=y +CONFIG_SCSI=y +# CONFIG_SCSI_LOWLEVEL is not set +# CONFIG_SCSI_PROC_FS is not set +# CONFIG_SERIAL_AMBA_PL010 is not set +CONFIG_SERIAL_AMBA_PL011=y +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y +CONFIG_SMC91X=y +CONFIG_SMP=y +CONFIG_SPARSEMEM=y +CONFIG_SPARSEMEM_EXTREME=y +CONFIG_SPARSEMEM_MANUAL=y +CONFIG_SPARSEMEM_VMEMMAP=y +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +CONFIG_SPARSE_IRQ=y +CONFIG_STOP_MACHINE=y +CONFIG_SUNRPC=y +# CONFIG_SWAP is not set +CONFIG_SWIOTLB=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_SYSVIPC_COMPAT=y +CONFIG_SYS_SUPPORTS_HUGETLBFS=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TREE_RCU=y +CONFIG_UID16=y +CONFIG_VEXPRESS_CONFIG=y +CONFIG_VFAT_FS=y +CONFIG_VIRTIO=y +CONFIG_VIRTIO_BLK=y +# CONFIG_VIRTIO_CONSOLE is not set +CONFIG_VIRTIO_MMIO=y +# CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set +# CONFIG_VIRTIO_NET is not set +# CONFIG_WIRELESS is not set +# CONFIG_WLAN is not set +# CONFIG_XEN is not set +CONFIG_XPS=y +CONFIG_ZONE_DMA32=y +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/arm64/image/Makefile b/target/linux/arm64/image/Makefile new file mode 100644 index 0000000000..23c26ceb4d --- /dev/null +++ b/target/linux/arm64/image/Makefile @@ -0,0 +1,46 @@ +# +# Copyright (C) 2010 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 Image/Prepare + -rm -rf $(KDIR)/linux-system.axf + cp $(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/Image $(KDIR)/Image + $(MAKE) -C boot-wrapper clean + $(MAKE) -C boot-wrapper compile +endef + +define Build/Clean + $(MAKE) -C boot-wrapper clean +endef + +define Image/Build/QemuVirt + $(CP) $(KDIR)/Image $(BIN_DIR)/openwrt-$(BOARD)-qemu-virt.Image +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + $(CP) $(KDIR)/Image-initramfs $(BIN_DIR)/openwrt-$(BOARD)-qemu-virt-initramfs.Image +endif +endef + +define Image/Build/VexpressFoundation + $(CP) $(KDIR)/linux-system.axf $(BIN_DIR)/openwrt-$(BOARD)-vexpress-foundation.axf +endef + +define Image/BuildKernel + $(call Image/Build/QemuVirt) + $(call Image/Build/VexpressFoundation) +endef + +define Image/Build/squashfs + $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) +endef + +define Image/Build + $(call Image/Build/$(1)) + dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-root.$(1) bs=128k conv=sync +endef + +$(eval $(call BuildImage)) diff --git a/target/linux/arm64/image/boot-wrapper/Makefile b/target/linux/arm64/image/boot-wrapper/Makefile new file mode 100644 index 0000000000..cf58590545 --- /dev/null +++ b/target/linux/arm64/image/boot-wrapper/Makefile @@ -0,0 +1,38 @@ +# +# 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 + +PKG_NAME:=aarch64-boot-wrapper +PKG_VERSION:=2013-01-10 +PKG_RELEASE:=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/boot-wrapper-aarch64.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=c51dde817b5ed5b8f741b67ac51bd67bd87b4a2a +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz +PKG_MAINTAINER:=Florian Fainelli + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/image.mk + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + KERNEL="../Image" \ + DTC="$(LINUX_DIR)/scripts/dtc/dtc" \ + FDT_SRC="$(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts/foundation-v8.dts" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + BOOTARGS="console=ttyAMA0 earlyprintk" +endef + +define Build/InstallDev + $(CP) $(PKG_BUILD_DIR)/linux-system.axf $(KDIR)/linux-system.axf +endef + +$(eval $(call Build/DefaultTargets))