David du Colombier | 9f40ee8 | 2016-04-20 03:17:04 +0200 | [diff] [blame] | 1 | # Introduction |
| 2 | |
| 3 | An experimental port of [Go](https://golang.org) is available for the [Plan 9 from Bell Labs](https://9p.io/plan9) operating system. |
| 4 | |
| 5 | # Supported architectures |
| 6 | |
| 7 | The Plan 9 port of Go is available for the following architectures: |
| 8 | |
| 9 | * 386 |
| 10 | * amd64 |
| 11 | * arm |
| 12 | |
| 13 | # Supported kernels |
| 14 | |
| 15 | The current Go distribution has been tested successfully on: |
| 16 | |
| 17 | * [Plan 9 from Bell Labs](https://9p.io/plan9) (386 and arm) kernel |
| 18 | * [9front](http://9front.org) amd64 kernel |
| 19 | * Charles Forsyth's [9k](https://bitbucket.org/forsyth/plan9-9k) (amd64) kernel |
| 20 | |
| 21 | # Requirements |
| 22 | |
| 23 | Plan 9 requires a kernel providing the following system calls: |
| 24 | |
| 25 | * tsemacquire (available since [2012-06-30](https://github.com/0intro/plan9/commit/bd0c9332d5b1da1371d03e8e0ad03de0d08e08c6)) |
| 26 | * nsec (available since [2014-05-15](https://github.com/0intro/plan9/commit/6c1d8fd563a815cbbac06f61bdc1d0f6331c3d3b)) |
| 27 | |
| 28 | A fix to the pread system call is required, so pread will not update the channel offset when reading a file: |
| 29 | |
| 30 | * [9-pread-offset](http://9legacy.org/9legacy/patch/9-pread-offset.diff) |
| 31 | |
David du Colombier | a5b9bd7 | 2016-10-18 13:30:54 +0200 | [diff] [blame] | 32 | The TCP connection control file must handle the "close" message to be able close a TCP connection gracefully, while waking up the readers: |
| 33 | |
| 34 | * [9-tcp-close](http://9legacy.org/9legacy/patch/9-tcp-close.diff) |
| 35 | |
David du Colombier | 2fe1b4b | 2017-01-18 01:13:01 +0100 | [diff] [blame] | 36 | A fix to Fossil is required to increment Qid.vers after a wstat, so a truncate followed by a read will return the content of the new file instead of the cached content. |
David du Colombier | 6d6ab3a | 2016-11-10 12:22:21 +0100 | [diff] [blame] | 37 | |
David du Colombier | 63ffe50 | 2016-11-13 18:58:31 +0100 | [diff] [blame] | 38 | * [fossil-wstat-qid](http://9legacy.org/9legacy/patch/fossil-wstat-qid.diff) |
David du Colombier | 6d6ab3a | 2016-11-10 12:22:21 +0100 | [diff] [blame] | 39 | |
David du Colombier | 04b8d44 | 2016-11-14 00:25:10 +0100 | [diff] [blame] | 40 | You will need support for SHA-2 signatures in X.509 certificates, so you could download sources from repositories hosted on GoogleSource, GitHub and so on. |
| 41 | |
| 42 | * [libsec-x509-sha2](http://9legacy.org/9legacy/patch/libsec-x509-sha2.diff) |
| 43 | |
David du Colombier | 9f40ee8 | 2016-04-20 03:17:04 +0200 | [diff] [blame] | 44 | If you're running Plan 9 on Raspberry Pi, you'll require the latest [bcm](https://9p.io/magic/webls?dir=/sources/contrib/miller/9/bcm) kernel from Richard Miller. |
| 45 | |
Fazlul Shahriar | ebab965 | 2018-01-20 14:39:53 -0500 | [diff] [blame] | 46 | CA certificates for `crypto/x509` package needs to be installed at `/sys/lib/tls/ca.pem`. You can download it from `https://curl.haxx.se/ca/cacert.pem` or copy from another system. |
| 47 | |
David du Colombier | 9f40ee8 | 2016-04-20 03:17:04 +0200 | [diff] [blame] | 48 | # Installation |
| 49 | |
| 50 | Since Go is written in Go, you may want to bootstrap Go with Go 1.4.3, which is the latest release of Go written in C. |
| 51 | |
| 52 | However, since the Go 1.4 runtime wasn't mature enough on Plan 9, we recommend you to bootstrap from a more recent version of Go, using another operating system. |
| 53 | |
| 54 | ## Boostraping from Plan 9 |
| 55 | |
| 56 | First, install Go 1.4: |
| 57 | |
| 58 | ``` |
| 59 | cd /tmp |
| 60 | git clone -b go1.4.3 https://go.googlesource.com/go go1.4 |
| 61 | cd go1.4/src |
| 62 | hget http://9legacy.org/go/patch/syscall-exec.diff | ape/patch -p2 |
| 63 | make.rc |
| 64 | ``` |
| 65 | |
| 66 | The [syscall-exec](http://9legacy.org/go/patch/syscall-exec.diff) patch is required if you're running a machine with SMP enabled. |
| 67 | |
| 68 | Then, set the `GOROOT_BOOTSTRAP` environment variable: |
| 69 | |
| 70 | ``` |
| 71 | GOROOT_BOOTSTRAP=/tmp/go1.4 |
| 72 | ``` |
| 73 | |
| 74 | Finally, install the latest version of Go: |
| 75 | |
| 76 | ``` |
| 77 | cd /tmp |
| 78 | git clone https://go.googlesource.com/go |
| 79 | cd go/src |
| 80 | all.rc |
| 81 | bind -a /tmp/go/bin /bin |
| 82 | ``` |
| 83 | Go is now ready to use. |
| 84 | |
| 85 | ## Bootstraping from another operating system |
| 86 | |
| 87 | First, you must have installed Go on this operating system, following the [Go installation instructions](https://golang.org/doc/install). |
| 88 | |
| 89 | Then, you can cross-compile a Go toolchain for Plan 9: |
| 90 | |
| 91 | ``` |
| 92 | cd $GOROOT/src |
| 93 | GOOS=plan9 GOARCH=386 ./bootstrap.bash |
| 94 | ``` |
| 95 | |
| 96 | Then, the bootstrap toolchain will be available in `../../go-plan9-386-bootstrap.tbz`. |
| 97 | |
| 98 | Finally, you can extract this archive to your Plan 9 machine. |
| 99 | |
| 100 | For example: |
| 101 | |
| 102 | ``` |
| 103 | cd /tmp |
| 104 | tar xzf go-plan9-386-bootstrap.tbz |
| 105 | bind -a /tmp/go-plan9-386-bootstrap/bin /bin |
| 106 | ``` |
| 107 | |
| 108 | Go is now ready to use. |
| 109 | |
| 110 | You'll be able to use this installation of Go to bootstrap future Go releases, by setting the `GOROOT_BOOTSTRAP` environment variable: |
| 111 | |
| 112 | ``` |
| 113 | GOROOT_BOOTSTRAP=/tmp/go-plan9-386-bootstrap |
| 114 | ``` |
| 115 | |
David du Colombier | 16813f4 | 2016-04-20 22:33:24 +0200 | [diff] [blame] | 116 | ## Bootstraping from binaries |
| 117 | |
| 118 | A [binary package](https://storage.googleapis.com/go-builder-data/gobootstrap-plan9-386.tar.gz) for plan9/386 is available. |
| 119 | |
David du Colombier | 06ac229 | 2016-04-20 22:39:06 +0200 | [diff] [blame] | 120 | This binary package is used to bootstrap Go on the plan9/386 builder. |
| 121 | |
David du Colombier | 16813f4 | 2016-04-20 22:33:24 +0200 | [diff] [blame] | 122 | ``` |
| 123 | cd /tmp |
| 124 | hget -o gobootstrap-plan9-386.tar.gz https://storage.googleapis.com/go-builder-data/gobootstrap-plan9-386.tar.gz |
| 125 | mkdir gobootstrap-plan9-386 |
| 126 | cd gobootstrap-plan9-386 |
| 127 | tar xzf ../gobootstrap-plan9-386.tar.gz |
| 128 | ``` |
| 129 | |
| 130 | You'll be able to use this binary package of Go to bootstrap Go, by setting the `GOROOT_BOOTSTRAP` environment variable: |
| 131 | |
| 132 | ``` |
| 133 | GOROOT_BOOTSTRAP=/tmp/gobootstrap-plan9-386 |
| 134 | ``` |
| 135 | |
David du Colombier | 9f40ee8 | 2016-04-20 03:17:04 +0200 | [diff] [blame] | 136 | # Git |
| 137 | |
| 138 | Git is not available on Plan 9. However a [Git wrapper](http://9legacy.org/9legacy/tools/git) is available as a simple rc script. It includes everything you need to use the [go](https://golang.org/cmd/go) tool. |
| 139 | |
| 140 | # Builders |
| 141 | |
| 142 | Three Plan 9 builders are currently running and reporting the results to the [Go Dashboard](http://build.golang.org/): |
| 143 | |
| 144 | * plan9-386 is running Plan 9 from Bell Labs (386 kernel) on Google Compute Engine (new-style builder) |
| 145 | * plan9-arm is running Plan 9 from Bell Labs (arm kernel) on a Raspberry Pi 3 (old-style builder) |
| 146 | * plan9-amd64-9front is running 9front (amd64 kernel) on a virtual machine (old-style builder) |
| 147 | |
| 148 | # Status |
| 149 | |
| 150 | The Plan 9 port of Go is considered experimental and is still a work-in-progress. There is a number of known issues available on the [Go issue tracker](https://golang.org/issues). |
| 151 | |
| 152 | # Issues |
| 153 | |
| 154 | Many issues are currently open on the [Go issue tracker](https://golang.org/issues) with the [OS-Plan9](https://github.com/golang/go/issues?q=is%3Aopen+is%3Aissue+label%3AOS-Plan9) label. |
| 155 | |
David du Colombier | 9f40ee8 | 2016-04-20 03:17:04 +0200 | [diff] [blame] | 156 | # Help |
| 157 | |
| 158 | The Plan 9 port of Go is a community-driven port. Any help to improve the Go port on Plan 9 would be highly appreciated. |
| 159 | |
| 160 | # Maintainer |
| 161 | |
| 162 | Many people have contributed to the Plan 9 port of Go. Since December 2013, the Plan 9 port of Go is maintained by [David du Colombier](https://github.com/0intro). |