annotate user/matac42/singularity-xv6.md @ 88:fd9f5bb6fb3d

backup 2021-09-16
author autobackup
date Thu, 16 Sep 2021 00:10:04 +0900
parents
children 7c70b573b54f
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
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
9 ### 単にxv6を起動する
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
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
19 ### debugする
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
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
39 ### defファイルを作成する
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
40
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
41 `$cd /ie-ryukyu/singularity/xv6`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
42
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
43 xv6.def
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
44 ```
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
45 BootStrap: docker
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
46 From: debian:10.10
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
47
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
48 %post
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
49 apt update
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
50 apt install -y \
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
51 git \
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
52 zsh \
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
53 build-essential \
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
54 gdb-multiarch \
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
55 qemu-system-misc \
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
56 gcc-riscv64-linux-gnu \
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
57 binutils-riscv64-linux-gnu
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
58 ```
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
59
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
60 ### build
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
61
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
62 `$singularity build --sandbox --fakeroot xv6 xv6.def`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
63
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
64 ### singularityのシェルに入る
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
65
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
66 `$singularity shell --fakeroot --writable xv6`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
67
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
68 ### 作業ディレクトリを作成する
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
69
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
70 `Singularity> mkdir /xv6`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
71
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
72 `Singularity> cd /xv6`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
73
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
74 ### 足りなかったもの追加
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
75
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
76 `Singularity> apt install vim`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
77
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
78 `Singularity> vim /root/.gdbinit`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
79
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
80 /root/.gdbinit
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
81 ```
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
82 add-auto-load-safe-path /xv6/xv6-riscv/.gdbinit
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
83 set auto-load safe-path /
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
84 ```
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
85
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
86 ### xv6をcloneする
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
87
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
88 `Singularity> git clone git@github.com:mit-pdos/xv6-riscv.git`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
89
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
90 `Singularity> cd xv6-riscv`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
91
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
92 ### makeしてみる
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
93
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
94 `Singularity> make qemu` (Ctrl+a xで抜ける)
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
95
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
96 `Singularity> make qemu-gdb` (Ctrl+a xで抜ける)
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
97
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
98 ### sifに変換する
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
99
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
100 singularityのシェルを抜けてから
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
101
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
102 `$singularity build --fakeroot xv6.sif xv6`
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
103
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
104 ### sifを用いてsingularityのシェルに入る
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
105
fd9f5bb6fb3d backup 2021-09-16
autobackup
parents:
diff changeset
106 `$singularity shell xv6.sif`