annotate user/matac42/singularity-xv6.md @ 120:d03247694a4b

backup 2023-05-09
author autobackup
date Tue, 09 May 2023 00:10:03 +0900 (2023-05-08)
parents 7c70b573b54f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
1 # singularityなxv6の作成
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
2
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
3 学科サーバー上のsingularityを用いた
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
4
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
5 ## 作成したsif
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
6
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
7 `amane:/ie-ryukyu/singularity/xv6`においてある
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
8
91
7c70b573b54f backup 2021-09-22
autobackup
parents: 88
diff changeset
9 ### 単にxv6を起動したい場合
88
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
10
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
11 `$cd /ie-ryukyu/singularity/xv6`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
12
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
13 `$singularity shell --fakeroot --writable xv6.sif`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
14
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
15 `Singularity> cd /xv6/xv6-riscv`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
16
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
17 `Singularity> make qemu`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
18
91
7c70b573b54f backup 2021-09-22
autobackup
parents: 88
diff changeset
19 ### debugしたい場合
88
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
20
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
21 `$cd /ie-ryukyu/singularity/xv6`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
22
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
23 `$singularity shell --fakeroot --writable xv6.sif`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
24
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
25 `Singularity> cd /xv6/xv6-riscv`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
26
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
27 `Singularity> make qemu-gdb`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
28
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
29 別端末、同ディレクトリにて
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
30
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
31 `$singularity shell --fakeroot --writable xv6.sif`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
32
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
33 `Singularity> cd /xv6/xv6-riscv`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
34
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
35 `Singularity> gdb-multiarch`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
36
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
37 ## sif作成の手順
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
38
91
7c70b573b54f backup 2021-09-22
autobackup
parents: 88
diff changeset
39 自分でsifを作りたいときはこのセクションを参考にすると良い
7c70b573b54f backup 2021-09-22
autobackup
parents: 88
diff changeset
40
88
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
41 ### defファイルを作成する
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
42
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
43 `$cd /ie-ryukyu/singularity/xv6`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
44
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
45 xv6.def
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
46 ```
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
47 BootStrap: docker
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
48 From: debian:10.10
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
49
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
50 %post
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
51 apt update
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
52 apt install -y \
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
53 git \
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
54 zsh \
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
55 build-essential \
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
56 gdb-multiarch \
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
57 qemu-system-misc \
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
58 gcc-riscv64-linux-gnu \
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
59 binutils-riscv64-linux-gnu
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
60 ```
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
61
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
62 ### build
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
63
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
64 `$singularity build --sandbox --fakeroot xv6 xv6.def`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
65
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
66 ### singularityのシェルに入る
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
67
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
68 `$singularity shell --fakeroot --writable xv6`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
69
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
70 ### 作業ディレクトリを作成する
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
71
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
72 `Singularity> mkdir /xv6`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
73
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
74 `Singularity> cd /xv6`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
75
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
76 ### 足りなかったもの追加
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
77
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
78 `Singularity> apt install vim`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
79
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
80 `Singularity> vim /root/.gdbinit`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
81
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
82 /root/.gdbinit
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
83 ```
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
84 add-auto-load-safe-path /xv6/xv6-riscv/.gdbinit
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
85 set auto-load safe-path /
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
86 ```
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
87
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
88 ### xv6をcloneする
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
89
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
90 `Singularity> git clone git@github.com:mit-pdos/xv6-riscv.git`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
91
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
92 `Singularity> cd xv6-riscv`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
93
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
94 ### makeしてみる
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
95
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
96 `Singularity> make qemu` (Ctrl+a xで抜ける)
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
97
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
98 `Singularity> make qemu-gdb` (Ctrl+a xで抜ける)
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
99
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
100 ### sifに変換する
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
101
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
102 singularityのシェルを抜けてから
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
103
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
104 `$singularity build --fakeroot xv6.sif xv6`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
105
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
106 ### sifを用いてsingularityのシェルに入る
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
107
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
108 `$singularity shell xv6.sif`