Browse Source

This ones for you Dan, I hope it helps. (#175)

* Add aarch64 as an option to build.go

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>

* aarch64: add just enough bits to aarch64 to make build sort of work

yes, the aarch/bin/auth thing is a kludge. But with the build tool
this will be simpler.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>

* aarch64: add just enough stuff so build does not fail with stupid errors.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>

* simple BUILDME script

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
ron minnich 7 years ago
parent
commit
d8290f7c10

+ 5 - 0
aarch64/bin/auth/disable

@@ -0,0 +1,5 @@
+#!/bin/rc
+if(test -e /mnt/keys/$1)
+	echo -n disabled > /mnt/keys/$1/status
+if(test -e /mnt/netkeys/$1)
+	echo -n disabled > /mnt/netkeys/$1/status

+ 5 - 0
aarch64/bin/auth/enable

@@ -0,0 +1,5 @@
+#!/bin/rc
+if(test -e /mnt/keys/$1)
+	echo -n ok > /mnt/keys/$1/status
+if(test -e /mnt/netkeys/$1)
+	echo -n ok > /mnt/netkeys/$1/status

+ 36 - 0
aarch64/bin/auth/status

@@ -0,0 +1,36 @@
+#!/bin/rc
+cd /mnt/keys/$1 > /dev/null >[2=1] && {
+	stat=`{cat status}
+	exp=`{cat expire}
+	switch($exp){
+	case never 0
+		exp='never expires'
+	case *
+		exp=(expires on `{date $exp})
+	}
+	switch($stat){
+	case expired
+		echo user $1: plan 9 key has expired
+	case *
+		echo user $1: plan 9 key status is $stat and $exp
+	}
+	grep '^'$1'[ 	]' /adm/keys.who | tail -1
+}
+cd /mnt/netkeys/$1 > /dev/null >[2=1] && {
+	stat=`{cat status}
+	exp=`{cat expire}
+	switch($exp){
+	case never 0
+		exp='never expires'
+	case *
+		exp=(expires on `{date $exp})
+	}
+	switch($stat){
+	case expired
+		echo user $1: network key has expired
+	case *
+		echo user $1: network key status is $stat and $exp
+		auth/printnetkey $1
+	}
+	grep '^'$1'[ 	]' /adm/netkeys.who | tail -1
+}

+ 18 - 0
aarch64/include/cflags.json

@@ -0,0 +1,18 @@
+{
+	"buildflags": {
+		"Cflags": [
+			"-ffreestanding",
+			"-fno-builtin",
+			"-fno-omit-frame-pointer",
+			"-g",
+			"-gdwarf-2",
+			"-ggdb",
+			"-O0",
+			"-static",
+			"-Wall",
+			"-Wno-missing-braces",
+			"-Wno-parentheses",
+			"-Wno-unknown-pragmas"
+		]
+	}
+}

+ 24 - 0
aarch64/include/klib.json

@@ -0,0 +1,24 @@
+{
+	"KernelLibs": {
+		"Cflags": [
+			"-O0",
+			"-ffreestanding",
+			"-fno-builtin",
+			"-Wall",
+			"-Wno-missing-braces",
+			"-Wno-parentheses",
+			"-Wno-unknown-pragmas",
+			"-Wuninitialized",
+			"-g"
+		],
+		"Oflags": [
+			"-static"
+		],
+		"Post": [
+			"rm *.o"
+		],
+		"Pre": [
+			"rm -f *.o *.tag.*"
+		]
+	}
+}

+ 5 - 0
sys/src/9/aarch64/BUILDME

@@ -0,0 +1,5 @@
+ARCH=aarch64  \
+STRIP=aarch64-linux-gnu-strip \
+CC=aarch64-linux-gnu-gcc \
+LD=aarch64-linux-gnu-ld \
+../../../../util/build cpu.json

+ 7 - 0
sys/src/9/aarch64/clean.json

@@ -0,0 +1,7 @@
+{
+	"clean": {
+		"Pre": [
+			"rm -f systab.c harvey aarch64.c cpu.c *.o *.root.c *.out errstr.h init.h init ../boot/libboot.a ../boot/*.o boot*.c"
+		]
+	}
+}

+ 59 - 0
sys/src/9/aarch64/core.json

@@ -0,0 +1,59 @@
+{
+	"core": {
+		"Cflags": [
+			"-O0",
+			"-static",
+			"-ffreestanding",
+			"-fno-builtin",
+			"-DKERNDATE=1433623937",
+			"-g",
+			"-Wall",
+			"-W",
+			"-Wno-sign-compare",
+			"-Wno-missing-field-initializers",
+			"-Wno-unused-parameter",
+			"-Wno-missing-braces",
+			"-Wno-parentheses",
+			"-Wno-unknown-pragmas",
+			"-Werror",
+			"-I", "/sys/src/9/aarch64",
+			"-I", "/sys/src/9/port"
+		],
+		"NoLibs": [
+			"/$ARCH/lib/klibc.a"
+		],
+		"Oflags": [
+			"-z",
+			"max-page-size=0x1000",
+			"-nostdlib",
+			"-g",
+			"-T",
+			"kernel.ld"
+		],
+		"Pre": [
+			"mksys -o systab.c '-mode=systab.c' $HARVEY/sys/src/sysconf.json",
+			"mksys -o errstr.h '-mode=errstr.h' $HARVEY/sys/src/sysconf.json"
+		],
+		"Projects": [
+			"clean.json",
+			"../boot/bootconf.json",
+			"inith.json"
+		],
+	    "MissingSourceFiles": [
+			"arch.c",
+			"asm.c",
+			"devarch.c",
+			"map.c",
+			"memory.c",
+			"mmu.c",
+			"mp.c",
+			"physalloc.c",
+			"systab.c",
+			"tcore.c",
+			"trap.c"
+		],
+		"SourceFiles": [
+			"main.c"
+		]
+	}
+}

+ 79 - 0
sys/src/9/aarch64/cpu.json

@@ -0,0 +1,79 @@
+{
+	"aarch64cpu": {
+		"Env": [
+			"CONF=aarch64cpu"
+		],
+		"Include": [
+			"core.json"
+		],
+		"IncludeSomeday": [
+			"../ip/ip.json",
+			"../port/port.json"
+		],
+		"Kernel": {
+			"Config": {
+				"Code": [
+					"int cpuserver = 1;",
+					"uint32_t kerndate = 1;"
+				],
+				"NoDev": [
+					"arch",
+					"cap",
+					"cons",
+					"dup",
+					"env",
+					"ip",
+					"kbin",
+					"kprof",
+					"mnt",
+					"mntn",
+					"pipe",
+					"proc",
+					"regress",
+					"root",
+					"segment",
+					"srv",
+					"ssl",
+					"tls",
+					"uart",
+					"ws",
+					"zp"
+				],
+				"NoIp": [
+					"tcp",
+					"udp",
+					"ipifc",
+					"icmp",
+					"icmp6",
+					"gre"
+				],
+				"NoUart": [
+					"pci"
+				]
+			},
+			"NoRamfiles": {
+				"bind": "/$ARCH/bin/bind",
+				"boot": "/sys/src/9/boot/bootcpu.elf.out",
+				"cat": "/$ARCH/bin/cat",
+				"date": "/$ARCH/bin/date",
+				"echo": "/$ARCH/bin/echo",
+				"factotum": "/$ARCH/bin/auth/factotum",
+				"ipconfig": "/$ARCH/bin/ip/ipconfig",
+				"ls": "/$ARCH/bin/ls",
+				"mount": "/$ARCH/bin/mount",
+				"nvram": "/util/nvram",
+				"rc": "/$ARCH/bin/rc",
+				"ps": "/$ARCH/bin/ps",
+				"ed": "/$ARCH/bin/ed",
+				"rcmain": "/rc/lib/rcmain",
+				"screenconsole": "/$ARCH/bin/aux/screenconsole",
+				"srv": "/$ARCH/bin/srv"
+			},
+			"Systab": "/sys/src/libc/9syscall/sys.h"
+		},
+		"Program": "harvey",
+		"SourceFiles": [
+			"aarch64cpu.c"
+		]
+	}
+}

+ 31 - 0
sys/src/9/aarch64/inith.json

@@ -0,0 +1,31 @@
+{
+	"inith": {
+		"Cflags": [
+			"-g",
+			"-Wall",
+			"-Wno-missing-braces",
+			"-Wno-parentheses",
+			"-Wno-unknown-pragmas",
+			"-O0",
+			"-static",
+			"-ffreestanding",
+			"-fno-builtin"
+		],
+		"Libs": [
+			"/$ARCH/lib/libc.a"
+		],
+		"Oflags": [
+			"-e_main",
+			"-static",
+			"-Ttext=0x200000"
+		],
+		"Post": [
+			"elf2c init > init.h"
+		],
+		"Program": "init",
+		"SourceFiles": [
+			"init9.c",
+			"../port/initcode.c"
+		]
+	}
+}

+ 14 - 0
sys/src/9/aarch64/main.c

@@ -0,0 +1,14 @@
+/*
+ * This file is part of the Harvey operating system.  It is subject to the
+ * license terms of the GNU GPL v2 in LICENSE.gpl found in the top-level
+ * directory of this distribution and at http://www.gnu.org/licenses/gpl-2.0.txt
+ *
+ * No part of Harvey operating system, including this file, may be copied,
+ * modified, propagated, or distributed except according to the terms
+ * contained in the LICENSE.gpl file.
+ */
+
+void
+main(uint32_t mbmagic, uint32_t mbaddress)
+{
+}

+ 1 - 0
util/src/harvey/cmd/build/build.go

@@ -119,6 +119,7 @@ var (
 	arch = map[string]bool{
 		"amd64": true,
 		"riscv": true,
+		"aarch64": true,
 	}
 	debugPrint = flag.Bool("debug", false, "enable debug prints")
 	shellhack  = flag.Bool("shellhack", false, "spawn every command in a shell (forced on if LD_PRELOAD is set)")