トップ «前の日記(2011-04-14) 最新 次の日記(2011-04-16)» 編集

ヨタの日々

2001|08|09|10|11|12|
2002|01|02|03|04|05|06|07|08|09|10|11|12|
2003|01|02|03|04|05|06|07|08|09|10|11|12|
2004|01|02|03|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|01|02|03|04|05|06|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|08|09|10|11|12|
2016|01|02|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|04|05|06|07|08|09|10|11|12|
2021|01|02|03|04|05|06|07|08|09|10|11|12|
2022|01|02|03|04|05|06|07|08|09|10|11|12|
2023|01|02|03|04|05|06|07|08|12|
2024|01|02|03|04|

2011-04-15 :-(

_ 午前

0500 起床

0830 始業

1100 打ち合わせ

_ 午後

1315 打ち合わせ

1700 退勤

_

1900 NetBSD と遊ぼう

2100 飯

_ [NetBSD]NetBSD でアレ

オレ「rm -rf / 初めてやりました」

上司「 ちゃんと /bin/rm にしたか?」

とツッコミを貰ったので追試。

結局同じだった。

_ [NetBSD]NetBSD でアレ(2)

筒井さんから「/dev/rwd0a のほうが萌える」とツッコミを貰ったので追試。

  • /dev/rwd0a は Read-Only file system
  • /dev/rwd0c は Device not configured
  • /dev/rwd0d は上書きできた

/dev/rwd0d を上書きしたあとに reboot などが出来なくなった。/sbin はある。ふむ...?

_ NetBSD boot

wiki だから和訳する意味はあまりなさそうだが

あわせて読みたい: ブートセレクタとブートローダの話

_ How NetBSD boots on x86 - NetBSD Wiki

x86 での NetBSD のブート手順

Stage 0: Master Boot Record ( ステージ 0: マスターブートレコード )

  • MBR source: sys/arch/i386/stand/mbr/mbr.S ( ソース )
  • MBR binaries: /usr/mdec/mbr_* ( バイナリ )
  • Error messages: ( エラーメッセージ )
    • "Error x"
    • "No active partition" - self-explanatory
    • "Disk read error"
    • "No operating system" - PBR magic number was wrong
    • "Invalid CHS read" - CHS vs LBA check selected LBA reads, but BIOS does not support them

MBR is read by the BIOS and then validated (checked for magic number 0xaa55 at the end). If validation fails, BIOS may print evil error message and/or try next boot device; otherwise, BIOS passes control to MBR.

MBR は BIOS により読まれてから検証される( 最後がマジックナンバー 0xaa55 であるかをチェックする )。検証が失敗した場合、BIOS は悪魔のエラーメッセージを表示するか、または MBR の制御を通り越し、次のブートデバイスを試みる。

Unless it was compiled with NO_BANNER, MBR displays its banner: "NetBSD MBR Boot". Next, it checks if CHS or LBA addressing must be used in further BIOS I/O calls. Since partition table entry stores both linear and CHS address, linear address is computed from CHS address, and if it matches stored linear address - MBR will use CHS addressing. LBA addressing will be tried otherwise, even if it is not supported by BIOS.

NO_BANNER 付きでコンパイルされたのでなければ、MBR はバナー "NetBSD MBR Boot" を表示する。次に、CHS または LBA アドレッシングが BIOS I/O 呼び出しで使用されなければならないかチェックする。パーティションテーブルエントリーは、線形と CHS アドレスの両方に格納されている。線形アドレスは、CHS アドレスから計算される。格納されている線形アドレスと整合したら、MBR は CHS アドレッシングを使う。LBA アドレッシングは、BIOS が対応してないときに使われる。

PBR is then loaded from 1st sector of active partition (or, if boot selector was compiled into this MBR, it may be loaded from another partition or disk).

PBR はアクティブパーティションの 1st セクターからロードされる( または MBR 内にブートセレクターがコンパイルされていたら、他のパーティションテーブルかディスクからロードされる )。

Stage 1: Partition Boot Record, bootxx ( ステージ 1: パーティションブートレコード, bootxx )

  • PBR source: sys/arch/i386/stand/bootxx/pbr.S ( ソース )
  • bootxx source: sys/arch/i386/stand/bootxx/bootxx.S ( バイナリ )
  • combined PBR+bootxx binaries: /usr/mdec/bootxx_* ( PBR と bootxx の結合バイナリ )
  • Error messages: ( エラーメッセージ )
    • '2' or "Disk read"
    • 'B' or "Not a bootxx image" - phase 1 bootstrap's magic number was wrong
    • 'P' or "No NetBSD partition"
    • 'L' or "Invalid CHS read" - see above

PBR loads phase 1 bootstrap (bootxx) from next 15 sectors on disk, validates and runs it.

PBR はフェーズ 1 ブートストラップ (bootxx) をディスク内の次の 15 セクターからロードする。

bootxx displays its banner: NetBSD/(machine) (filesystem) Primary Bootstrap and tries to load phase 2 bootstrap (boot2) from several locations:

bootxx はバナー 「NetBSD/(machine) (filesystem) Primary Bootstrap」を表示し、フェーズ 2 ブートストラップ ( boot2 )をいくつかの場所からロードを試みる。

  • start of MBR partition; or ( MBR パーティションの先頭か )
  • start of MBR partition + RAIDframe offset; or ( MBR パーティションの先頭 + RAIDframe オフセット か )
  • start of partition 'a' in disklabel. ( ディスクラベルのパーティション a の先頭 )
  • bootxx error messages:
    • "Boot failed (errno <...>): <...>"
    • All further messages are printed by boot2. For example, a single "0" and no other messages on PC console means that boot2 has autodetected and is using serial console.

Stage 2 ( ステージ 2 )

  • boot2 source: sys/arch/i386/stand/boot/ ( ソース )
  • boot2 binary: /boot ( バイナリ )

Glossary ( 用語 )

  • BIOS: Basic Input-Output System
  • MBR: Main Boot Record, stored at LBA 0
  • PBR: Partition Boot Record, stored in first sector of bootable partition
  • CHS: Cylinder, Head, Sector addressing
  • LBA: Linear Block Address[ing]