-
Notifications
You must be signed in to change notification settings - Fork 0
/
debian-install-efi.html
338 lines (306 loc) · 16.9 KB
/
debian-install-efi.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<!DOCTYPE html>
<html lang="ja">
<head>
<title>EFIブートするUSBメモリでdebianをインストール - pLog</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=1">
<meta http-equiv="X-UA-Compatible" content="IE=11">
<meta name="author" content="pman0214">
<meta name="keywords" content="debian,efi">
<meta name="description" content="EFIブートするUSBメモリを作成し、debianをインストールするまで。">
<link rel="stylesheet" href="http://pman0214.github.io/blog/theme/css/pure-min.css">
<link rel="stylesheet" href="http://pman0214.github.io/blog/theme/css/ext-pure.css">
<link rel="stylesheet" href="http://pman0214.github.io/blog/theme/css/style.css">
<link rel="stylesheet" href="http://pman0214.github.io/blog/theme/css/pygments/github.css">
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://pman0214.github.io/blog/theme/css/grids-responsive-old-ie-min.css">
<![endif]-->
<!--[if gt IE 8]><!-->
<link rel="stylesheet" href="http://pman0214.github.io/blog/theme/css/grids-responsive-min.css">
<!--<![endif]-->
<!--[if lt IE 9]>
<script src="http://pman0214.github.io/blog/theme/js/html5shiv.js"></script>
<![endif]-->
<link href="http://pman0214.github.io/blog/feeds/atom.xml" type="application/atom+xml" rel="alternate" title="pLog Full Atom Feed">
<link href="http://pman0214.github.io/blog/feeds/rss.xml" type="application/rss+xml" rel="alternate" title="pLog Full RSS Feed">
<!-- open graph tags -->
<meta property="og:site_name" content="pLog">
<meta property="og:type" content="article">
<meta property="og:title" content="EFIブートするUSBメモリでdebianをインストール">
<meta property="og:url" content="http://pman0214.github.io/blog/debian-install-efi.html">
<meta property="og:description" content="EFIブートするUSBメモリを作成し、debianをインストールするまで。">
<meta property="article:published_time" content="2015-04-30">
<meta property="article:section" content="linux">
<meta property="article:tag" content="debian">
<meta property="article:tag" content="efi">
</head>
<body>
<header>
<nav id="menu">
<div class="pure-menu pure-menu-horizontal">
<ul class="pure-menu-list">
<li class="pure-menu-item"><a href="http://pman0214.github.io/blog" class="pure-menu-heading pure-menu-link">pLog</a></li>
<li class="pure-menu-item pure-menu-has-children pure-menu-allow-hover">
<a href="#" class="pure-menu-link">Categories</a>
<ul class="pure-menu-children">
<li class="pure-menu-item"><a href="http://pman0214.github.io/blog/category/devel.html" class="pure-menu-link">devel</a></li>
<li class="pure-menu-item"><a href="http://pman0214.github.io/blog/category/info.html" class="pure-menu-link">info</a></li>
<li class="pure-menu-item pure-menu-selected"><a href="http://pman0214.github.io/blog/category/linux.html" class="pure-menu-link">linux</a></li>
<li class="pure-menu-item"><a href="http://pman0214.github.io/blog/category/osx.html" class="pure-menu-link">osx</a></li>
<li class="pure-menu-item"><a href="http://pman0214.github.io/blog/category/python.html" class="pure-menu-link">python</a></li>
<li class="pure-menu-item"><a href="http://pman0214.github.io/blog/category/tex.html" class="pure-menu-link">tex</a></li>
<li class="pure-menu-item menu-item-divided"><a href="http://pman0214.github.io/blog/categories.html" class="pure-menu-link">See all...</a></li>
</ul>
</li>
<li class="pure-menu-item"><a href="http://pman0214.github.io/blog/archives.html" class="pure-menu-link">Archives</a></li>
</ul>
</div>
</nav>
</header>
<div id="layout" class="pure-g">
<div class="pure-u-1 pure-u-lg-3-4">
<main id="main">
<article>
<header>
<h1><a href="http://pman0214.github.io/blog/debian-install-efi.html" rel="bookmark" title="Permalink to EFIブートするUSBメモリでdebianをインストール">EFIブートするUSBメモリでdebianをインストール</a></h1>
<div class="article-info">
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 on-create"><time datetime="2015-04-30T12:55:00+09:00">2015年04月30日 12:55</time></div>
</div>
<div class="category">Category: <a class="pure-button" href="http://pman0214.github.io/blog/category/linux.html">linux</a></div>
<div class="tags">Tags:
<a class="pure-button" href="http://pman0214.github.io/blog/tag/debian.html">debian</a>
<a class="pure-button" href="http://pman0214.github.io/blog/tag/efi.html">efi</a>
</div>
</div>
</header>
<section class="contents">
<h2>概要</h2>
<ul>
<li>EFIブートするUSBメモリを作成し、これを使ってdebianをインストールする。</li>
<li>古いXserveをdebian化しようとした中での例。<ul>
<li>インストールできたものの、うまく起動しない状態で終わってます。多分ドライバ周り・・・。</li>
</ul>
</li>
<li>grubを導入したUSBメモリを用意してしまえば、カーネルや初期RAMディスク、ISOイメージを書き換えるだけでよくなる。この作業はUSBメモリのファイルを書き換えるだけなので、debian機は不要。</li>
</ul>
<h2>必要なもの</h2>
<ul>
<li>2GBくらいのUSBメモリ<ul>
<li>中身は完全に消える。</li>
</ul>
</li>
<li>母艦となるdebian機<ul>
<li>VMでも構わないが、USBメモリをmountできないとダメ。</li>
</ul>
</li>
</ul>
<h2>手順</h2>
<h3>grubの準備</h3>
<p>まずは母艦となるdebianでEFI対応のgrubを用意する。インストールしたいアーキテクチャに合わせたものを用意する。今回はx86の64bit版で。</p>
<div class="highlight"><pre><span></span>sudo apt-get install grub-efi-x86_64-bin
</pre></div>
<p>USBメモリにパーティションを作る。<code>/dev/sdb</code>の部分はUSBメモリのデバイス名を指定する。分からん場合は<code>sudo dmesg</code>とかで調べるべし。</p>
<div class="highlight"><pre><span></span>sudo fdisk /dev/sdb
</pre></div>
<p>あとはよしなに。FAT32にするのが良い。どんなマシンでもFAT32なら読めるみたいなので(確証なし)。partition IDをbにするとWin95 FAT32になる。</p>
<p>FAT32でフォーマット。<code>-v</code>は詳細表示、<code>-c</code>は不良ブロック精査、<code>-F</code>は形式。16にすればFAT16になる。</p>
<div class="highlight"><pre><span></span>sudo mkfs.vfat -v -c -F <span class="m">32</span> /dev/sdb1
</pre></div>
<ul>
<li>Q. mkfs.vfatなんてないんだけど。</li>
<li>A. dosfstoolsを入れるべし。<div class="highlight"><pre><span></span>sudo apt-get install dosfstools
</pre></div>
</li>
</ul>
<p>USBメモリをマウントし、EFIのディレクトリを指定してgrubをUSBメモリに書き込む。</p>
<div class="highlight"><pre><span></span>sudo mount /dev/sdb1 /mnt
sudo grub-install —target<span class="o">=</span>x86_64-efi —efi-directory<span class="o">=</span>/mnt —boot-directory<span class="o">=</span>/mnt/boot —no-floppy
</pre></div>
<p>ちなみに、Macで起動するためにはEFIの下を<code>boot/bootx64.efi</code>にしないとダメらしい。本当かしらん。まぁ、変更しておくということで。</p>
<div class="highlight"><pre><span></span>sudo mv /mnt/efi/boot/grubx64.efi /mnt/efi/boot/bootx64.efi
</pre></div>
<p>grub.cfgを<code>boot/grub</code>に作成する。</p>
<div class="highlight"><pre><span></span>sudo mkdir -p /mnt/boot/grub
sudo vi /mnt/boot/grub/grub.cfg
</pre></div>
<p><code>grub.cfg</code>はこんな感じ。</p>
<div class="highlight"><pre><span></span># Load Graphical modules
insmod efi_gop
insmod efi_uga
# Load Font module
insmod font
# Setup GFXTERM along with loading unifont.pf2 font file
if loadfont ${prefix}/fonts/unifont.pf2
then
insmod gfxterm
set gfxmode="auto"
set gfxpayload=keep
terminal_output gfxterm
set color_normal=light-blue/black
set color_highlight=light-cyan/blue
fi
insmod part_gpt
insmod part_msdos
insmod fat
insmod ext2
# Timeout for menu
set timeout=5
# Set default boot entry as Entry 0
set default=0
menuentry "Debian Install (expert mode)" {
set root=(hd0,msdos1)
linux /boot/vmlinuz root=/dev/sda1 ro video=efifb agp=off priority=low ipv6.disable=1
initrd /boot/initrd.gz
}
menuentry "Debian Install" {
set root=(hd0,msdos1)
linux /boot/vmlinuz root=/dev/sda1 ro video=efifb agp=off ipv6.disable=1
initrd /boot/initrd.gz
}
</pre></div>
<p>これでgrubの準備は完了。</p>
<h3>debianインストーラの導入</h3>
<p>自分はいつも<a href="https://www.debian.org/devel/debian-installer/">debian開発者ページ(?)</a>からインストーラを取得している。
ここで手に入るのはtesting版。だと思う。日次スナップショットはうまく起動しない場合もあるので注意。</p>
<p>「その他のイメージ>インストール先アーキテクチャ>hd-media」とたどる。</p>
<p>ここから<code>vmlinuz</code>(カーネル)と<code>initrd.gz</code>(初期RAMディスク)を取得する。
また、元のページから「netinst CDイメージ」も取得しておく。</p>
<p>あとはこれを配置するだけ。USBメモリをmountし、以下のように配置する。FAT32でフォーマットしてあるとMacからでもWinからでも配置できるので便利。MacのEFIで読めるのはFATとHFS+とかだった気がするけど定かではない。FAT32なら大丈夫だった。</p>
<table>
<thead>
<tr>
<th align="left">ファイル</th>
<th align="left">配置場所</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">netinst CDイメージ(.isoファイル)</td>
<td align="left">USBメモリのトップ/</td>
</tr>
<tr>
<td align="left">vmlinuz</td>
<td align="left">USBメモリのトップ/boot/</td>
</tr>
<tr>
<td align="left">initrd.gz</td>
<td align="left">USBメモリのトップ/boot/</td>
</tr>
</tbody>
</table>
<h2>インストールはどうやるの?</h2>
<p>普通にUSBメモリからEFIで起動させればOK。</p>
<p>インストーラでパーティションを切るときに、EFI用のディレクトリを作成しないとダメ。100MBくらいで十分なはずだけど、200MBくらいを確保している。</p>
<p>Windowsが入っているマシンとかに後からdebianを追加するときは、すでにあるEFIシステムパーティションが利用できる。もちろん、WindowsがEFIブートでインストールされていれば、の話だが。</p>
</section>
<section id="comments">
<!-- Disqus -->
<div id="disqus_thread"></div>
<script>
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE
* SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT:
* https://disqus.com/admin/universalcode/#configuration-variables
*/
var disqus_config = function () {
this.language = 'ja';
this.page.url = 'http://pman0214.github.io/blog/debian-install-efi.html';
this.page.identifier = 'debian-install-efi';
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = '//pman0214-plog.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
</section>
</article>
</main>
</div>
<div class="pure-u-1 pure-u-lg-1-4">
<aside id="sidebar">
<section>
<h1>About pman0214</h1>
<p>ハードからソフトまで分かる研究者。そういうものに私はなりたい。</p>
</section>
<section>
<h1>Links</h1>
<ul class="links">
<li><a href="https://www.f.ait.kyushu-u.ac.jp/~ishida/">Research</a></li>
</ul>
</section>
<section>
<h1>Social Links</h1>
<ul class="links">
<li><a href="https://www.facebook.com/pman0214">facebook</a></li>
<li><a href="https://twitter.com/pman0214">twitter</a></li>
<li><a href="https://github.com/pman0214">github</a></li>
</ul>
</section>
<section class="tags">
<h1>Tags</h1>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/autofs.html">autofs</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/backlogs.html">backlogs</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/bios.html">bios</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/blog.html">blog</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/category.html">category</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/chrome.html">chrome</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/chromium.html">chromium</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/cron.html">cron</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/css-framework.html">css framework</a>
<a class="tag tag-1" href="http://pman0214.github.io/blog/tag/debian.html">debian</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/dpkg.html">dpkg</a>
<a class="tag tag-2" href="http://pman0214.github.io/blog/tag/efi.html">efi</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/emacs.html">emacs</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/fft.html">fft</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/format.html">format</a>
<a class="tag tag-2" href="http://pman0214.github.io/blog/tag/github.html">github</a>
<a class="tag tag-2" href="http://pman0214.github.io/blog/tag/gitlab.html">gitlab</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/gnuplot.html">gnuplot</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/html.html">html</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/ieice.html">ieice</a>
<a class="tag tag-2" href="http://pman0214.github.io/blog/tag/info.html">info</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/install.html">install</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/latex.html">latex</a>
<a class="tag tag-2" href="http://pman0214.github.io/blog/tag/ldap.html">ldap</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/line-style.html">line style</a>
<a class="tag tag-1" href="http://pman0214.github.io/blog/tag/linux.html">linux</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/numpy.html">numpy</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/openwrt.html">openwrt</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/openwrt-package.html">openwrt package</a>
<a class="tag tag-2" href="http://pman0214.github.io/blog/tag/osx.html">osx</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/pandas.html">pandas</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/pelican.html">pelican</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/pl2303.html">pl2303</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/prolific.html">prolific</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/pthread.html">pthread</a>
<a class="tag tag-1" href="http://pman0214.github.io/blog/tag/python.html">python</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/raid.html">raid</a>
<a class="tag tag-2" href="http://pman0214.github.io/blog/tag/raspberry-pi.html">raspberry pi</a>
<a class="tag tag-2" href="http://pman0214.github.io/blog/tag/redmine.html">redmine</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/rfft.html">rfft</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/tex.html">tex</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/thin-client.html">thin client</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/timezone.html">timezone</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/usbserial.html">usbserial</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/valgrind.html">valgrind</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/virtualenv.html">virtualenv</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/windows.html">windows</a>
<a class="tag tag-4" href="http://pman0214.github.io/blog/tag/yatex.html">yatex</a>
<p><a href="http://pman0214.github.io/blog/tags.html">See all...</a></p>
</section>
</aside>
</div>
<!-- #layout --></div>
<footer id="footer">
© 2018 pman0214
|
Powered by <a href="http://docs.getpelican.com/" target="_blank">Pelican</a>
with <a href="https://github.com/pman0214/pelican-pure" target="_blank">Pure theme</a>
</footer>
</body>
</html>