OLD | NEW |
1 This directory contains a simple example of how one might | 1 This directory contains a simple example of how one might |
2 start Go running on bare hardware. There is currently code | 2 start Go running on bare hardware. There is currently code |
3 for 386 and arm. | 3 for 386 and arm. |
4 | 4 |
5 | 5 |
6 386 | 6 386 |
7 | 7 |
8 It is very primitive but can run go/test/sieve.go, the concurrent | 8 It is very primitive but can run go/test/sieve.go, the concurrent |
9 prime sieve, on a uniprocessor. | 9 prime sieve, on a uniprocessor. |
10 | 10 |
11 To run, first build the tools by running all.bash with GOARCH=386 | 11 To run, first build the tools by running all.bash with GOARCH=386 |
12 and GOOS set to your normal GOOS (linux, darwin). Then: | 12 and GOOS set to your normal GOOS (linux, darwin). Then: |
13 | 13 |
14 export GOOS=tiny | 14 export GOOS=tiny |
15 cd $GOROOT/src/pkg/runtime | 15 cd $GOROOT/src/pkg/runtime |
16 make clean | 16 make clean |
17 make install | 17 make install |
18 cd tiny | 18 cd tiny |
19 8g $GOROOT/test/sieve.go | 19 8g $GOROOT/test/sieve.go |
20 8l sieve.8 | 20 8l sieve.8 |
21 8l -a sieve.8 >sieve.asm # can consult sieve.asm for debugging | 21 8l -a sieve.8 >sieve.asm # can consult sieve.asm for debugging |
22 dd if=/dev/zero of=disk count=10000 | 22 dd if=/dev/zero of=disk count=10000 |
23 cat bootblock 8.out | dd of=disk conv=notrunc | 23 cat bootblock 8.out | dd of=disk conv=notrunc |
24 | 24 |
25 Use the built-in print(text string) function to print to the | 25 Use the built-in print(text string) function to print to the |
26 console. | 26 console. |
27 | 27 |
| 28 |
28 BOCHS | 29 BOCHS |
29 | 30 |
30 You may have to tweak the .bochsrc depending on your system, | 31 You may have to tweak the .bochsrc depending on your system, |
31 and you may need to install the Bochs emulator. | 32 and you may need to install the Bochs emulator. |
32 | 33 |
33 $ cp dot-bochsrc .bochsrc | 34 $ cp dot-bochsrc .bochsrc |
34 $ $EDITOR .bochsrc # tweak it if required | 35 $ $EDITOR .bochsrc # tweak it if required |
35 $ bochs | 36 $ bochs |
36 | 37 |
37 | 38 |
38 ORACLE xVM VIRTUALBOX | 39 ORACLE xVM VIRTUALBOX |
39 | 40 |
40 Get VirtualBox installed, and the do: | 41 Install VirtualBox. Then: |
41 | 42 |
42 ... build 'disk', described above | 43 Build 'disk' (described above under '386'). |
| 44 |
43 $ VBoxManage convertfromraw disk go-tiny.vdi | 45 $ VBoxManage convertfromraw disk go-tiny.vdi |
44 $ VirtualBox | 46 $ VirtualBox |
45 create a new VM; as disk use the go-tiny.vdi image. | 47 create a new VM; as disk use the go-tiny.vdi image. |
46 start the vm. | 48 start the vm. |
47 | 49 |
| 50 |
48 QEMU / KVM | 51 QEMU / KVM |
49 | 52 |
50 This should work the same for qemu and kvm (really: qemu-kvm). | 53 This should work the same for qemu and kvm (really: qemu-kvm). |
51 | 54 |
52 ... build 'disk', described above | 55 Build 'disk' (described above under '386'). |
| 56 |
53 $ qemu -hda disk | 57 $ qemu -hda disk |
54 | 58 |
55 | 59 |
56 ARM | 60 ARM |
57 | 61 |
58 First build the toolchain using GOARCH=arm and GOOS=linux. When | 62 First build the toolchain using GOARCH=arm and GOOS=linux. When |
59 you build your embedded code set GOARCH=tiny. | 63 you build your embedded code set GOARCH=tiny. |
60 | 64 |
61 export GOOS=tiny | 65 export GOOS=tiny |
62 cd $GOROOT/src/pkg/runtime | 66 cd $GOROOT/src/pkg/runtime |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | 114 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
111 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | 115 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
112 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 116 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
113 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | 117 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
114 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | 118 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
115 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 119 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
116 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 120 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
117 | 121 |
118 http://pdos.csail.mit.edu/6.828/xv6/ | 122 http://pdos.csail.mit.edu/6.828/xv6/ |
119 | 123 |
OLD | NEW |