入口
    OF 1/2 の場合
    OF 3 の場合
      設置後すぐ
      CDROM 無で
    Mac OS の場合
    その他
  NetBSD
  Booting Media
Primary
  bootxx
Secondary
  xcf/elf
    release(7)
    /usr/mdec
ofwboot
  Locore.c
  boot.c
    main()
    boot-file
    chain()
    OF_chain()
kernel(1)
  locore.S
  machdep.c
    initppc()
kernel(2)
  init_main.c
    main()
その他
  installboot
    旧版
    新版
    実例
  DEFAULT CATCH
GENERIC_MD
  mdsetimage

NetBSD/macppc booting

kernel(2)

init_main.c

main()

main は sys/kern/init_main.c に書いてある。 ここからは機種に依存しないコードになる。
そうは言っても、 中ではたびたび arch/macppc/{dev,macppc} 等を呼ぶので、 実際には、かなり機種に依存したことが行なわれる。 参考: http://www.tri-tree.gr.jp/~isaki/NetBSD/diary-200210.html
以下では
sys/kern/init_main.c の内容をこの色で示す
macppc の場合も、例えば
202 consinit(); 203 printf("%s", copyright);
は、 sys/arch/macppc/macppc/machdep.c の次の部分。
568  * consinit
569  * Initialize system console.
570  */     
571 void     
572 consinit() 
573 {
574         static int initted;
575         
576         if (initted) 
577                 return;
578         initted = 1;
579         cninit();
580 }       
すぐその後の
209 /* Do machine-dependent initialization. */ 210 cpu_startup();
は同じく sys/arch/macppc/macppc/machdep.c の次の部分
464 /*
465  * Machine dependent startup code.
466  */
467 void
468 cpu_startup()
469 { 
... 365 /* Configure the system hardware. This will enable interrupts. */ 366 configure();
kern/subr_autoconf.c の次の部分と
228 /* 229 * Configure the system's hardware. 230 */ 231 void 232 configure(void) 233 { 234 int errcnt; 235 236 /* Initialize data structures. */ 237 config_init();
同じ中の次の部分を通してから
184 /* 185 * Initialize the autoconfiguration data structures. Normally this 186 * is done by configure(), but some platforms need to do this very 187 * early (to e.g. initialize the console). 188 */ 189 void 190 config_init(void) 191 {
kern/subr_autoconf.c
254 /* 255 * Do the machine-dependent portion of autoconfiguration. This 256 * sets the configuration machinery here in motion by "finding" 257 * the root bus. When this function returns, we expect interrupts 258 * to be enabled. 259 */ 260 cpu_configure();
macppc/macppc/autoconf.c の中の次の部分を呼ぶ。
63 /*
64  * Determine device configuration for a machine.
65  */
66 void
67 cpu_configure()
68 {
そうして次の部分で / の パスを調べる。(1.243 2005/01/09 03:11:48 mycroft)
505 /* 506 * Now that autoconfiguration has completed, we can determine 507 * the root and dump devices. 508 */ 509 cpu_rootconf(); 510 cpu_dumpconf();
すぐその後で、次のようにして / を mount する。
512 /* Mount the root file system. */ 513 do { 514 domountroothook(); 515 if ((error = vfs_mountroot())) { 516 printf("cannot mount root, error = %d\n", error); 517 boothowto |= RB_ASKNAME; 518 setroot(root_device, 519 (rootdev != NODEV) ? DISKPART(rootdev) : 0); 520 } 521 } while (error != 0); 522 mountroothook_destroy(); 523
次の部分は、時計を見に行く。
524 /* 525 * Initialise the time-of-day clock, passing the time recorded 526 * in the root filesystem (if any) for use by systems that 527 * don't have a non-volatile time-of-day device. 528 */ 529 inittodr(rootfstime); 530
この inittodr はやはり、sys/arch/macppc/macppc/clock.c に定義されている。
 86 inittodr(base)
 87         time_t base;
 88 {
 89         time_t deltat;
 90         u_int rtc_time;
 91 
 92         /*
 93          * If we can't read from RTC, use the fs time.
 94          */
 95         if (adb_read_date_time(&rtc_time) < 0) {
 96                 time.tv_sec = base;
 97                 return;
 98         }
因みに、更にこの adb_read_date_time は adb_direct.c の中にある。
Last Update: Sat, 04 May 2019 00:45:20 GMT 1.66 2008/03/08