aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLey Foon Tan <lftan@altera.com>2014-11-06 02:20:19 -0500
committerLey Foon Tan <lftan@altera.com>2014-12-07 23:56:06 -0500
commit2fc8483fdcde767795402a38a53e647811dc9abf (patch)
tree01c734b5191c6ddd5c095fb2a08494720b06f817
parent9cce02ec7146248862ba63a41bf8eb32d9e4fb63 (diff)
nios2: Build infrastructure
This patch adds Makefile and Kconfig files required for building a nios2 kernel. Signed-off-by: Ley Foon Tan <lftan@altera.com>
-rw-r--r--arch/nios2/Kconfig201
-rw-r--r--arch/nios2/Kconfig.debug17
-rw-r--r--arch/nios2/Makefile73
-rw-r--r--arch/nios2/boot/Makefile52
-rw-r--r--arch/nios2/boot/install.sh52
-rw-r--r--arch/nios2/configs/3c120_defconfig77
-rw-r--r--arch/nios2/include/asm/Kbuild66
-rw-r--r--arch/nios2/include/uapi/asm/Kbuild4
-rw-r--r--arch/nios2/kernel/Makefile24
-rw-r--r--arch/nios2/kernel/nios2_ksyms.c33
-rw-r--r--arch/nios2/kernel/vmlinux.lds.S75
-rw-r--r--arch/nios2/lib/Makefile8
-rw-r--r--arch/nios2/mm/Makefile14
-rw-r--r--arch/nios2/platform/Kconfig.platform129
-rw-r--r--arch/nios2/platform/Makefile1
15 files changed, 826 insertions, 0 deletions
diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
new file mode 100644
index 000000000000..8a4889d24db1
--- /dev/null
+++ b/arch/nios2/Kconfig
@@ -0,0 +1,201 @@
1config NIOS2
2 def_bool y
3 select ARCH_WANT_OPTIONAL_GPIOLIB
4 select CLKSRC_OF
5 select GENERIC_ATOMIC64
6 select GENERIC_CLOCKEVENTS
7 select GENERIC_CPU_DEVICES
8 select GENERIC_IRQ_PROBE
9 select GENERIC_IRQ_SHOW
10 select HAVE_ARCH_TRACEHOOK
11 select IRQ_DOMAIN
12 select MODULES_USE_ELF_RELA
13 select OF
14 select OF_EARLY_FLATTREE
15 select SOC_BUS
16 select SPARSE_IRQ
17 select USB_ARCH_HAS_HCD if USB_SUPPORT
18
19config GENERIC_CSUM
20 def_bool y
21
22config GENERIC_HWEIGHT
23 def_bool y
24
25config GENERIC_CALIBRATE_DELAY
26 def_bool y
27
28config NO_IOPORT_MAP
29 def_bool y
30
31config HAS_DMA
32 def_bool y
33
34config FPU
35 def_bool n
36
37config SWAP
38 def_bool n
39
40config RWSEM_GENERIC_SPINLOCK
41 def_bool y
42
43config TRACE_IRQFLAGS_SUPPORT
44 def_bool n
45
46source "init/Kconfig"
47
48menu "Kernel features"
49
50source "kernel/Kconfig.preempt"
51
52source "kernel/Kconfig.freezer"
53
54source "kernel/Kconfig.hz"
55
56source "mm/Kconfig"
57
58config FORCE_MAX_ZONEORDER
59 int "Maximum zone order"
60 range 9 20
61 default "11"
62 help
63 The kernel memory allocator divides physically contiguous memory
64 blocks into "zones", where each zone is a power of two number of
65 pages. This option selects the largest power of two that the kernel
66 keeps in the memory allocator. If you need to allocate very large
67 blocks of physically contiguous memory, then you may need to
68 increase this value.
69
70 This config option is actually maximum order plus one. For example,
71 a value of 11 means that the largest free memory block is 2^10 pages.
72
73endmenu
74
75source "arch/nios2/platform/Kconfig.platform"
76
77menu "Processor type and features"
78
79config MMU
80 def_bool y
81
82config NIOS2_ALIGNMENT_TRAP
83 bool "Catch alignment trap"
84 default y
85 help
86 Nios II CPUs cannot fetch/store data which is not bus aligned,
87 i.e., a 2 or 4 byte fetch must start at an address divisible by
88 2 or 4. Any non-aligned load/store instructions will be trapped and
89 emulated in software if you say Y here, which has a performance
90 impact.
91
92comment "Boot options"
93
94config CMDLINE_BOOL
95 bool "Default bootloader kernel arguments"
96 default y
97
98config CMDLINE
99 string "Default kernel command string"
100 default ""
101 depends on CMDLINE_BOOL
102 help
103 On some platforms, there is currently no way for the boot loader to
104 pass arguments to the kernel. For these platforms, you can supply
105 some command-line options at build time by entering them here. In
106 other cases you can specify kernel args so that you don't have
107 to set them up in board prom initialization routines.
108
109config CMDLINE_FORCE
110 bool "Force default kernel command string"
111 depends on CMDLINE_BOOL
112 help
113 Set this to have arguments from the default kernel command string
114 override those passed by the boot loader.
115
116config NIOS2_CMDLINE_IGNORE_DTB
117 bool "Ignore kernel command string from DTB"
118 depends on !CMDLINE_FORCE
119 default y
120 help
121 Set this to ignore the bootargs property from the devicetree's
122 chosen node and fall back to CMDLINE if nothing is passed.
123
124config NIOS2_PASS_CMDLINE
125 bool "Passed kernel command line from u-boot"
126 default n
127 help
128 Use bootargs env variable from u-boot for kernel command line.
129 will override "Default kernel command string".
130 Say N if you are unsure.
131
132endmenu
133
134menu "Advanced setup"
135
136config ADVANCED_OPTIONS
137 bool "Prompt for advanced kernel configuration options"
138 help
139
140comment "Default settings for advanced configuration options are used"
141 depends on !ADVANCED_OPTIONS
142
143config NIOS2_KERNEL_MMU_REGION_BASE_BOOL
144 bool "Set custom kernel MMU region base address"
145 depends on ADVANCED_OPTIONS
146 help
147 This option allows you to set the virtual address of the kernel MMU region.
148
149 Say N here unless you know what you are doing.
150
151config NIOS2_KERNEL_MMU_REGION_BASE
152 hex "Virtual base address of the kernel MMU region " if NIOS2_KERNEL_MMU_REGION_BASE_BOOL
153 default "0x80000000"
154 help
155 This option allows you to set the virtual base address of the kernel MMU region.
156
157config NIOS2_KERNEL_REGION_BASE_BOOL
158 bool "Set custom kernel region base address"
159 depends on ADVANCED_OPTIONS
160 help
161 This option allows you to set the virtual address of the kernel region.
162
163 Say N here unless you know what you are doing.
164
165config NIOS2_KERNEL_REGION_BASE
166 hex "Virtual base address of the kernel region " if NIOS2_KERNEL_REGION_BASE_BOOL
167 default "0xc0000000"
168
169config NIOS2_IO_REGION_BASE_BOOL
170 bool "Set custom I/O region base address"
171 depends on ADVANCED_OPTIONS
172 help
173 This option allows you to set the virtual address of the I/O region.
174
175 Say N here unless you know what you are doing.
176
177config NIOS2_IO_REGION_BASE
178 hex "Virtual base address of the I/O region" if NIOS2_IO_REGION_BASE_BOOL
179 default "0xe0000000"
180
181endmenu
182
183menu "Executable file formats"
184
185source "fs/Kconfig.binfmt"
186
187endmenu
188
189source "net/Kconfig"
190
191source "drivers/Kconfig"
192
193source "fs/Kconfig"
194
195source "arch/nios2/Kconfig.debug"
196
197source "security/Kconfig"
198
199source "crypto/Kconfig"
200
201source "lib/Kconfig"
diff --git a/arch/nios2/Kconfig.debug b/arch/nios2/Kconfig.debug
new file mode 100644
index 000000000000..8d4e6bacd997
--- /dev/null
+++ b/arch/nios2/Kconfig.debug
@@ -0,0 +1,17 @@
1menu "Kernel hacking"
2
3config TRACE_IRQFLAGS_SUPPORT
4 def_bool y
5
6source "lib/Kconfig.debug"
7
8config DEBUG_STACK_USAGE
9 bool "Enable stack utilization instrumentation"
10 depends on DEBUG_KERNEL
11 help
12 Enables the display of the minimum amount of free stack which each
13 task has ever had available in the sysrq-T and sysrq-P debug output.
14
15 This option will slow down process creation somewhat.
16
17endmenu
diff --git a/arch/nios2/Makefile b/arch/nios2/Makefile
new file mode 100644
index 000000000000..e142c9ee51fa
--- /dev/null
+++ b/arch/nios2/Makefile
@@ -0,0 +1,73 @@
1#
2# This file is subject to the terms and conditions of the GNU General Public
3# License. See the file "COPYING" in the main directory of this archive
4# for more details.
5#
6# Copyright (C) 2013 Altera Corporation
7# Copyright (C) 1994, 95, 96, 2003 by Wind River Systems
8# Written by Fredrik Markstrom
9#
10# This file is included by the global makefile so that you can add your own
11# architecture-specific flags and dependencies. Remember to do have actions
12# for "archclean" cleaning up for this architecture.
13#
14# Nios2 port by Wind River Systems Inc trough:
15# fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
16
17UTS_SYSNAME = Linux
18
19export MMU
20
21LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
22
23KBUILD_CFLAGS += -pipe -D__linux__ -D__ELF__
24KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MUL_SUPPORT),-mhw-mul,-mno-hw-mul)
25KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MULX_SUPPORT),-mhw-mulx,-mno-hw-mulx)
26KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_DIV_SUPPORT),-mhw-div,-mno-hw-div)
27KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_FPU_SUPPORT),-mcustom-fpu-cfg=60-1,)
28
29KBUILD_CFLAGS += -fno-optimize-sibling-calls
30KBUILD_CFLAGS += -DUTS_SYSNAME=\"$(UTS_SYSNAME)\"
31KBUILD_CFLAGS += -fno-builtin
32KBUILD_CFLAGS += -G 0
33
34head-y := arch/nios2/kernel/head.o
35libs-y += arch/nios2/lib/ $(LIBGCC)
36core-y += arch/nios2/kernel/ arch/nios2/mm/
37core-y += arch/nios2/platform/
38
39INSTALL_PATH ?= /tftpboot
40nios2-boot := arch/$(ARCH)/boot
41BOOT_TARGETS = vmImage zImage
42PHONY += $(BOOT_TARGETS) install
43KBUILD_IMAGE := $(nios2-boot)/vmImage
44
45ifneq ($(CONFIG_NIOS2_DTB_SOURCE),"")
46 core-y += $(nios2-boot)/
47endif
48
49all: vmImage
50
51archclean:
52 $(Q)$(MAKE) $(clean)=$(nios2-boot)
53
54%.dtb:
55 $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
56
57dtbs:
58 $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
59
60$(BOOT_TARGETS): vmlinux
61 $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
62
63install:
64 $(Q)$(MAKE) $(build)=$(nios2-boot) BOOTIMAGE=$(KBUILD_IMAGE) install
65
66define archhelp
67 echo '* vmImage - Kernel-only image for U-Boot ($(KBUILD_IMAGE))'
68 echo ' install - Install kernel using'
69 echo ' (your) ~/bin/$(INSTALLKERNEL) or'
70 echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
71 echo ' install to $$(INSTALL_PATH)'
72 echo ' dtbs - Build device tree blobs for enabled boards'
73endef
diff --git a/arch/nios2/boot/Makefile b/arch/nios2/boot/Makefile
new file mode 100644
index 000000000000..59392dc0bdcb
--- /dev/null
+++ b/arch/nios2/boot/Makefile
@@ -0,0 +1,52 @@
1#
2# arch/nios2/boot/Makefile
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License. See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8
9UIMAGE_LOADADDR = $(shell $(NM) vmlinux | awk '$$NF == "_stext" {print $$1}')
10UIMAGE_ENTRYADDR = $(shell $(NM) vmlinux | awk '$$NF == "_start" {print $$1}')
11UIMAGE_COMPRESSION = gzip
12
13OBJCOPYFLAGS_vmlinux.bin := -O binary
14
15targets += vmlinux.bin vmlinux.gz vmImage
16
17$(obj)/vmlinux.bin: vmlinux FORCE
18 $(call if_changed,objcopy)
19
20$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
21 $(call if_changed,gzip)
22
23$(obj)/vmImage: $(obj)/vmlinux.gz
24 $(call if_changed,uimage)
25 @$(kecho) 'Kernel: $@ is ready'
26
27# Rule to build device tree blobs
28DTB_SRC := $(patsubst "%",%,$(CONFIG_NIOS2_DTB_SOURCE))
29
30# Make sure the generated dtb gets removed during clean
31extra-$(CONFIG_NIOS2_DTB_SOURCE_BOOL) += system.dtb
32
33$(obj)/system.dtb: $(DTB_SRC) FORCE
34 $(call cmd,dtc)
35
36# Ensure system.dtb exists
37$(obj)/linked_dtb.o: $(obj)/system.dtb
38
39obj-$(CONFIG_NIOS2_DTB_SOURCE_BOOL) += linked_dtb.o
40
41targets += $(dtb-y)
42
43# Rule to build device tree blobs with make command
44$(obj)/%.dtb: $(src)/dts/%.dts FORCE
45 $(call if_changed_dep,dtc)
46
47$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
48
49clean-files := *.dtb
50
51install:
52 sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
diff --git a/arch/nios2/boot/install.sh b/arch/nios2/boot/install.sh
new file mode 100644
index 000000000000..3cb3f468bc51
--- /dev/null
+++ b/arch/nios2/boot/install.sh
@@ -0,0 +1,52 @@
1#!/bin/sh
2#
3# This file is subject to the terms and conditions of the GNU General Public
4# License. See the file "COPYING" in the main directory of this archive
5# for more details.
6#
7# Copyright (C) 1995 by Linus Torvalds
8#
9# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
10#
11# "make install" script for nios2 architecture
12#
13# Arguments:
14# $1 - kernel version
15# $2 - kernel image file
16# $3 - kernel map file
17# $4 - default install path (blank if root directory)
18#
19
20verify () {
21 if [ ! -f "$1" ]; then
22 echo "" 1>&2
23 echo " *** Missing file: $1" 1>&2
24 echo ' *** You need to run "make" before "make install".' 1>&2
25 echo "" 1>&2
26 exit 1
27 fi
28}
29
30# Make sure the files actually exist
31verify "$2"
32verify "$3"
33
34# User may have a custom install script
35
36if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
37if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
38
39# Default install - same as make zlilo
40
41if [ -f $4/vmlinuz ]; then
42 mv $4/vmlinuz $4/vmlinuz.old
43fi
44
45if [ -f $4/System.map ]; then
46 mv $4/System.map $4/System.old
47fi
48
49cat $2 > $4/vmlinuz
50cp $3 $4/System.map
51
52sync
diff --git a/arch/nios2/configs/3c120_defconfig b/arch/nios2/configs/3c120_defconfig
new file mode 100644
index 000000000000..87541f0a5d6e
--- /dev/null
+++ b/arch/nios2/configs/3c120_defconfig
@@ -0,0 +1,77 @@
1CONFIG_SYSVIPC=y
2CONFIG_NO_HZ_IDLE=y
3CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_SYSCTL_SYSCALL=y
6# CONFIG_ELF_CORE is not set
7# CONFIG_EPOLL is not set
8# CONFIG_SIGNALFD is not set
9# CONFIG_TIMERFD is not set
10# CONFIG_EVENTFD is not set
11# CONFIG_SHMEM is not set
12# CONFIG_AIO is not set
13CONFIG_EMBEDDED=y
14CONFIG_SLAB=y
15CONFIG_MODULES=y
16CONFIG_MODULE_UNLOAD=y
17CONFIG_NIOS2_MEM_BASE=0x10000000
18CONFIG_NIOS2_HW_MUL_SUPPORT=y
19CONFIG_NIOS2_HW_DIV_SUPPORT=y
20CONFIG_CUSTOM_CACHE_SETTINGS=y
21CONFIG_NIOS2_DCACHE_SIZE=0x8000
22CONFIG_NIOS2_ICACHE_SIZE=0x8000
23# CONFIG_NIOS2_CMDLINE_IGNORE_DTB is not set
24CONFIG_NIOS2_PASS_CMDLINE=y
25CONFIG_NET=y
26CONFIG_PACKET=y
27CONFIG_UNIX=y
28CONFIG_INET=y
29CONFIG_IP_MULTICAST=y
30CONFIG_IP_PNP=y
31CONFIG_IP_PNP_DHCP=y
32CONFIG_IP_PNP_BOOTP=y
33CONFIG_IP_PNP_RARP=y
34# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
35# CONFIG_INET_XFRM_MODE_TUNNEL is not set
36# CONFIG_INET_XFRM_MODE_BEET is not set
37# CONFIG_INET_LRO is not set
38# CONFIG_IPV6 is not set
39# CONFIG_WIRELESS is not set
40CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
41CONFIG_DEVTMPFS=y
42CONFIG_DEVTMPFS_MOUNT=y
43# CONFIG_FW_LOADER is not set
44CONFIG_MTD=y
45CONFIG_MTD_CMDLINE_PARTS=y
46CONFIG_MTD_BLOCK=y
47CONFIG_MTD_CFI=y
48CONFIG_MTD_CFI_INTELEXT=y
49CONFIG_MTD_CFI_AMDSTD=y
50CONFIG_MTD_PHYSMAP_OF=y
51CONFIG_BLK_DEV_LOOP=y
52CONFIG_NETDEVICES=y
53CONFIG_ALTERA_TSE=y
54CONFIG_MARVELL_PHY=y
55# CONFIG_WLAN is not set
56# CONFIG_INPUT_MOUSE is not set
57# CONFIG_SERIO_SERPORT is not set
58# CONFIG_VT is not set
59CONFIG_SERIAL_ALTERA_JTAGUART=y
60CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE=y
61CONFIG_SERIAL_ALTERA_UART=y
62# CONFIG_HW_RANDOM is not set
63# CONFIG_HWMON is not set
64# CONFIG_USB_SUPPORT is not set
65CONFIG_NEW_LEDS=y
66CONFIG_LEDS_CLASS=y
67CONFIG_LEDS_TRIGGERS=y
68CONFIG_LEDS_TRIGGER_HEARTBEAT=y
69# CONFIG_DNOTIFY is not set
70# CONFIG_INOTIFY_USER is not set
71CONFIG_JFFS2_FS=y
72CONFIG_NFS_FS=y
73CONFIG_NFS_V3_ACL=y
74CONFIG_ROOT_NFS=y
75CONFIG_SUNRPC_DEBUG=y
76CONFIG_DEBUG_INFO=y
77# CONFIG_ENABLE_WARN_DEPRECATED is not set
diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild
new file mode 100644
index 000000000000..bb160be0dc28
--- /dev/null
+++ b/arch/nios2/include/asm/Kbuild
@@ -0,0 +1,66 @@
1generic-y += atomic.h
2generic-y += auxvec.h
3generic-y += barrier.h
4generic-y += bitops.h
5generic-y += bitsperlong.h
6generic-y += bug.h
7generic-y += bugs.h
8generic-y += clkdev.h
9generic-y += cputime.h
10generic-y += current.h
11generic-y += device.h
12generic-y += div64.h
13generic-y += dma.h
14generic-y += emergency-restart.h
15generic-y += errno.h
16generic-y += exec.h
17generic-y += fb.h
18generic-y += fcntl.h
19generic-y += ftrace.h
20generic-y += futex.h
21generic-y += hardirq.h
22generic-y += hash.h
23generic-y += hw_irq.h
24generic-y += ioctl.h
25generic-y += ioctls.h
26generic-y += ipcbuf.h
27generic-y += irq_regs.h
28generic-y += irq_work.h
29generic-y += kdebug.h
30generic-y += kmap_types.h
31generic-y += kvm_para.h
32generic-y += local.h
33generic-y += mcs_spinlock.h
34generic-y += mman.h
35generic-y += module.h
36generic-y += msgbuf.h
37generic-y += param.h
38generic-y += pci.h
39generic-y += percpu.h
40generic-y += poll.h
41generic-y += posix_types.h
42generic-y += preempt.h
43generic-y += resource.h
44generic-y += scatterlist.h
45generic-y += sections.h
46generic-y += segment.h
47generic-y += sembuf.h
48generic-y += serial.h
49generic-y += shmbuf.h
50generic-y += shmparam.h
51generic-y += siginfo.h
52generic-y += signal.h
53generic-y += socket.h
54generic-y += sockios.h
55generic-y += spinlock.h
56generic-y += stat.h
57generic-y += statfs.h
58generic-y += termbits.h
59generic-y += termios.h
60generic-y += topology.h
61generic-y += trace_clock.h
62generic-y += types.h
63generic-y += unaligned.h
64generic-y += user.h
65generic-y += vga.h
66generic-y += xor.h
diff --git a/arch/nios2/include/uapi/asm/Kbuild b/arch/nios2/include/uapi/asm/Kbuild
new file mode 100644
index 000000000000..4f07ca3f8d10
--- /dev/null
+++ b/arch/nios2/include/uapi/asm/Kbuild
@@ -0,0 +1,4 @@
1include include/uapi/asm-generic/Kbuild.asm
2
3header-y += elf.h
4header-y += ucontext.h
diff --git a/arch/nios2/kernel/Makefile b/arch/nios2/kernel/Makefile
new file mode 100644
index 000000000000..8ae76823ff93
--- /dev/null
+++ b/arch/nios2/kernel/Makefile
@@ -0,0 +1,24 @@
1#
2# Makefile for the nios2 linux kernel.
3#
4
5extra-y += head.o
6extra-y += vmlinux.lds
7
8obj-y += cpuinfo.o
9obj-y += entry.o
10obj-y += insnemu.o
11obj-y += irq.o
12obj-y += nios2_ksyms.o
13obj-y += process.o
14obj-y += prom.o
15obj-y += ptrace.o
16obj-y += setup.o
17obj-y += signal.o
18obj-y += sys_nios2.o
19obj-y += syscall_table.o
20obj-y += time.o
21obj-y += traps.o
22
23obj-$(CONFIG_MODULES) += module.o
24obj-$(CONFIG_NIOS2_ALIGNMENT_TRAP) += misaligned.o
diff --git a/arch/nios2/kernel/nios2_ksyms.c b/arch/nios2/kernel/nios2_ksyms.c
new file mode 100644
index 000000000000..bf2f55d10a4d
--- /dev/null
+++ b/arch/nios2/kernel/nios2_ksyms.c
@@ -0,0 +1,33 @@
1/*
2 * Copyright (C) 2004 Microtronix Datacom Ltd
3 *
4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file COPYING in the main directory of this
6 * archive for more details.
7 */
8
9#include <linux/export.h>
10#include <linux/string.h>
11
12/* string functions */
13
14EXPORT_SYMBOL(memcpy);
15EXPORT_SYMBOL(memset);
16EXPORT_SYMBOL(memmove);
17
18/*
19 * libgcc functions - functions that are used internally by the
20 * compiler... (prototypes are not correct though, but that
21 * doesn't really matter since they're not versioned).
22 */
23#define DECLARE_EXPORT(name) extern void name(void); EXPORT_SYMBOL(name)
24
25DECLARE_EXPORT(__gcc_bcmp);
26DECLARE_EXPORT(__divsi3);
27DECLARE_EXPORT(__moddi3);
28DECLARE_EXPORT(__modsi3);
29DECLARE_EXPORT(__udivmoddi4);
30DECLARE_EXPORT(__udivsi3);
31DECLARE_EXPORT(__umoddi3);
32DECLARE_EXPORT(__umodsi3);
33DECLARE_EXPORT(__muldi3);
diff --git a/arch/nios2/kernel/vmlinux.lds.S b/arch/nios2/kernel/vmlinux.lds.S
new file mode 100644
index 000000000000..326fab40a9de
--- /dev/null
+++ b/arch/nios2/kernel/vmlinux.lds.S
@@ -0,0 +1,75 @@
1/*
2 * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18#include <asm/page.h>
19#include <asm-generic/vmlinux.lds.h>
20#include <asm/cache.h>
21#include <asm/thread_info.h>
22
23OUTPUT_FORMAT("elf32-littlenios2", "elf32-littlenios2", "elf32-littlenios2")
24
25OUTPUT_ARCH(nios)
26ENTRY(_start) /* Defined in head.S */
27
28jiffies = jiffies_64;
29
30SECTIONS
31{
32 . = CONFIG_NIOS2_MEM_BASE | CONFIG_NIOS2_KERNEL_REGION_BASE;
33
34 _text = .;
35 _stext = .;
36 HEAD_TEXT_SECTION
37 .text : {
38 TEXT_TEXT
39 SCHED_TEXT
40 LOCK_TEXT
41 IRQENTRY_TEXT
42 KPROBES_TEXT
43 } =0
44 _etext = .;
45
46 .got : {
47 *(.got.plt)
48 *(.igot.plt)
49 *(.got)
50 *(.igot)
51 }
52
53 EXCEPTION_TABLE(L1_CACHE_BYTES)
54
55 . = ALIGN(PAGE_SIZE);
56 __init_begin = .;
57 INIT_TEXT_SECTION(PAGE_SIZE)
58 INIT_DATA_SECTION(PAGE_SIZE)
59 PERCPU_SECTION(L1_CACHE_BYTES)
60 __init_end = .;
61
62 _sdata = .;
63 RO_DATA_SECTION(PAGE_SIZE)
64 RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
65 _edata = .;
66
67 BSS_SECTION(0, 0, 0)
68 _end = .;
69
70 STABS_DEBUG
71 DWARF_DEBUG
72 NOTES
73
74 DISCARDS
75}
diff --git a/arch/nios2/lib/Makefile b/arch/nios2/lib/Makefile
new file mode 100644
index 000000000000..557256628ecd
--- /dev/null
+++ b/arch/nios2/lib/Makefile
@@ -0,0 +1,8 @@
1#
2# Makefile for Nios2-specific library files.
3#
4
5lib-y += delay.o
6lib-y += memcpy.o
7lib-y += memmove.o
8lib-y += memset.o
diff --git a/arch/nios2/mm/Makefile b/arch/nios2/mm/Makefile
new file mode 100644
index 000000000000..3cbd0840873c
--- /dev/null
+++ b/arch/nios2/mm/Makefile
@@ -0,0 +1,14 @@
1#
2# Makefile for the Nios2-specific parts of the memory manager.
3#
4
5obj-y += cacheflush.o
6obj-y += dma-mapping.o
7obj-y += extable.o
8obj-y += fault.o
9obj-y += init.o
10obj-y += ioremap.o
11obj-y += mmu_context.o
12obj-y += pgtable.o
13obj-y += tlb.o
14obj-y += uaccess.o
diff --git a/arch/nios2/platform/Kconfig.platform b/arch/nios2/platform/Kconfig.platform
new file mode 100644
index 000000000000..d3e5df9fb36b
--- /dev/null
+++ b/arch/nios2/platform/Kconfig.platform
@@ -0,0 +1,129 @@
1menu "Platform options"
2
3comment "Memory settings"
4
5config NIOS2_MEM_BASE
6 hex "Memory base address"
7 default "0x00000000"
8 help
9 This is the physical address of the memory that the kernel will run
10 from. This address is used to link the kernel and setup initial memory
11 management. You should take the raw memory address without any MMU
12 or cache bits set.
13 Please not that this address is used directly so you have to manually
14 do address translation if it's connected to a bridge.
15
16comment "Device tree"
17
18config NIOS2_DTB_AT_PHYS_ADDR
19 bool "DTB at physical address"
20 default n
21 help
22 When enabled you can select a physical address to load the dtb from.
23 Normally this address is passed by a bootloader such as u-boot but
24 using this you can use a devicetree without a bootloader.
25 This way you can store a devicetree in NOR flash or an onchip rom.
26 Please note that this address is used directly so you have to manually
27 do address translation if it's connected to a bridge. Also take into
28 account that when using an MMU you'd have to ad 0xC0000000 to your
29 address
30
31config NIOS2_DTB_PHYS_ADDR
32 hex "DTB Address"
33 depends on NIOS2_DTB_AT_PHYS_ADDR
34 default "0xC0000000"
35 help
36 Physical address of a dtb blob.
37
38config NIOS2_DTB_SOURCE_BOOL
39 bool "Compile and link device tree into kernel image"
40 default n
41 help
42 This allows you to specify a dts (device tree source) file
43 which will be compiled and linked into the kernel image.
44
45config NIOS2_DTB_SOURCE
46 string "Device tree source file"
47 depends on NIOS2_DTB_SOURCE_BOOL
48 default ""
49 help
50 Absolute path to the device tree source (dts) file describing your
51 system.
52
53comment "Nios II instructions"
54
55config NIOS2_HW_MUL_SUPPORT
56 bool "Enable MUL instruction"
57 default n
58 help
59 Set to true if you configured the Nios II to include the MUL
60 instruction. This will enable the -mhw-mul compiler flag.
61
62config NIOS2_HW_MULX_SUPPORT
63 bool "Enable MULX instruction"
64 default n
65 help
66 Set to true if you configured the Nios II to include the MULX
67 instruction. Enables the -mhw-mulx compiler flag.
68
69config NIOS2_HW_DIV_SUPPORT
70 bool "Enable DIV instruction"
71 default n
72 help
73 Set to true if you configured the Nios II to include the DIV
74 instruction. Enables the -mhw-div compiler flag.
75
76config NIOS2_FPU_SUPPORT
77 bool "Custom floating point instr support"
78 default n
79 help
80 Enables the -mcustom-fpu-cfg=60-1 compiler flag.
81
82config NIOS2_CI_SWAB_SUPPORT
83 bool "Byteswap custom instruction"
84 default n
85 help
86 Use the byteswap (endian converter) Nios II custom instruction provided
87 by Altera and which can be enabled in QSYS builder. This accelerates
88 endian conversions in the kernel (e.g. ntohs).
89
90config NIOS2_CI_SWAB_NO
91 int "Byteswap custom instruction number" if NIOS2_CI_SWAB_SUPPORT
92 default 0
93 help
94 Number of the instruction as configured in QSYS Builder.
95
96comment "Cache settings"
97
98config CUSTOM_CACHE_SETTINGS
99 bool "Custom cache settings"
100 help
101 This option allows you to tweak the cache settings used during early
102 boot (where the information from device tree is not yet available).
103 There should be no reason to change these values. Linux will work
104 perfectly fine, even if the Nios II is configured with smaller caches.
105
106 Say N here unless you know what you are doing.
107
108config NIOS2_DCACHE_SIZE
109 hex "D-Cache size" if CUSTOM_CACHE_SETTINGS
110 range 0x200 0x10000
111 default "0x800"
112 help
113 Maximum possible data cache size.
114
115config NIOS2_DCACHE_LINE_SIZE
116 hex "D-Cache line size" if CUSTOM_CACHE_SETTINGS
117 range 0x10 0x20
118 default "0x20"
119 help
120 Minimum possible data cache line size.
121
122config NIOS2_ICACHE_SIZE
123 hex "I-Cache size" if CUSTOM_CACHE_SETTINGS
124 range 0x200 0x10000
125 default "0x1000"
126 help
127 Maximum possible instruction cache size.
128
129endmenu
diff --git a/arch/nios2/platform/Makefile b/arch/nios2/platform/Makefile
new file mode 100644
index 000000000000..46364f1d9352
--- /dev/null
+++ b/arch/nios2/platform/Makefile
@@ -0,0 +1 @@
obj-y += platform.o