JF-INDEX (document list of JF Project)

$B%3%a%s%H$+$iFI$`(B Linux $B%+!<%M%k(B

Sano Taketoshi <[email protected]>

Sat May 22 01:50:53 JST 1999


NLUG ($BL>8E20(B Linux $B%f!<%6!<%0%k!<%W(B) $BBh(B 3 $B2sJY6/2q$N$?$a$K(B $B:n@.$7$?;qNA$G$9!#(B $B:#2sFI$`$N$O(B Linux $B%+!<%M%k(B 2.2.5 $B$G$9!#(B $Be$G!"EE8;(B ON $B$N$"$H!"%+!<%M%k$N%m!<%I!"(B $B%V!<%H%"%C%W$+$i(B /sbin/init $B$,

1. $B$O$8$a$K(B

2. $B%7%9%F%`$N5/F0!'35MW(B

3. $B%+!<%M%k$N%m!<%I(B

4. BIOS $B>pJs$N

5. $B%+!<%M%kK\BN$NE83+(B

6. $B%G%P%$%9%I%i%$%P!<$N@_Dj(B

7. init $B$N5/F0(B

8. $BHV30(B: Makefile $B$K$D$$$F(B

9. $B=*$o$j$K(B


1. $B$O$8$a$K(B

1.1 $B!V%+!<%M%k!W$H$O(B

$B$?$V$s!"0lEY$/$i$$$I$3$+$GL\$K$7$?$3$H$,$"$k$+$b$7$l$^$;$s$,(B $B!V(BLinux$B!W$H$$$&L>A0$OEv;~%U%#%s%i%s%I$NBg3X@8$G$"$C$?(B Linus Torvalds $B$5$s$,<+J,$N:n$C$?!V%+!<%M%k!W$K!"<+J,$NL>A0$+$i(B $B0lIt$rA0$G$9!#(B

$B$5$F!"$=$3$GLdBj!#!V%+!<%M%k!W$C$F2?$G$7$g$&(B ?

$B!V%+!<%M%k!W$H$O!"%7%9%F%`Fb$GF0:nCf$N3F%W%m%0%i%`$+$i=P$5$l$k(B $BMW5a$K1~$8$F%a%b%j!<$d%G%#%9%/$J$I$N%O!<%I%&%'%";q8;$N4IM}$d!"(B CPU $B;~4V$NG[J,$J$I$r9T$J$&(B OS $B$NCf?uItJ,$G$9!#(B

$BNc$($P(B "top" $B%3%^%s%I$r

cat test.pr >/dev/lp0

$B$J$I$NA`:n$K$h$C$F%Q%i%l%k%]!<%H$X$N?.9f=PNO$r%F%9%H$7$?(B $B7P83$O$"$j$^$;$s$+(B ? $B$3$N!V(B /dev/lp0 $B$K=PNO$7$?%G!<%?$O$=$N$^$^%Q%i%l%k%]!<%H$K=PNO$5$l$k!W(B $B$H$$$&F0:n$O%+!<%M%kFb$N(B lp $B%I%i%$%P$K$h$C$F

1.2 Linux $B%+!<%M%k(B

$B0J2$B$^$:$O!"%P!<%8%g%s(B 2.2.5 $B$N%+!<%M%k$rE83+$7$F!"$=$N%H%C%W%G%#%l%/%H%j(B $B$K0\F0$7$F$_$^$7$g$&!#$=$&!"DL>o(B /usr/src/linux/ $B$H$7$F8+$k$3$H$,(B $B$G$-$k>l=j$G$9!#(B

$B$^$:$O$I$s$J%U%!%$%k$,$"$k$+!"(B "ls" $B$GD4$Y$F$_$^$9!#(B

      $ ls -F
      COPYING         Makefile        arch/           init/           mm/
      CREDITS         README          drivers/        ipc/            net/
      Documentation/  REPORTING-BUGS  fs/             kernel/         scripts/
      MAINTAINERS     Rules.make      include/        lib/

$B:G=i$KFI$s$G$*$/$Y$-%U%!%$%k$O(B "README" $B$G$9$M!#$3$l$O(B $B%+!<%M%k$G$J$/$F$b!"0lHL$N%"%W%j%1!<%7%g%s$N%=!<%9$G$bF1$8$G$9!#(B $B$,!"$3$3$G$O$3$N%U%!%$%k$NFbMF$K$D$$$F$O>JN,$7$F!"$=$NBe$o$j$K(B "CREDITS" $B$H(B "MAINTAINERS" $B$H$$$&(B 2 $B$D$N%U%!%$%k(B $B$NFbMF$K$D$$$F>R2p$7$?$$$H;W$$$^$9!#(B

1.3 $B%3!<%I:n@.$K9W8%$7$??M!9(B

"CREDITS" $B%U%!%$%k$NKAF,$K$O(B

        This is at least a partial credits-file of people that have
        contributed to the Linux project.  It is sorted by name and
        formatted to allow easy grepping and beautification by
        scripts.  The fields are: name (N), email (E), web-address
        (W), PGP key ID and fingerprint (P), description (D), and
        snail-mail address (S).
        Thanks,

                        Linus

$B$H=q$+$l$F$$$^$9!#$3$N%U%!%$%k$K$O(B Linux $B%+!<%M%k$N3+H/$K9W8%$7$?(B $B?M!9(B ($B$N0lIt(B) $B$NL>A0$,=q$+$l$F$$$k!"$H$$$&$o$1$G$9!#(B

$BNc$($P!"@hF|(B TV $B$NFC=8$GA0$b(B

      N: Niibe Yutaka
      D: PLIP driver
      D: Asynchronous socket I/O in the NET code

$B$H5-:\$5$l$F$$$^$9!#$b$A$m$s!"(BLinus $B$5$s$NL>A0$O(B

      N: Linus Torvalds
      D: Original kernel hacker

$B$H$7$C$+$j:\$C$F$$$^$9$7!"(B ac $B%Q%C%A$GM-L>$J(B Alan Cox $B$d(B fat32 $BBP1~$rA0$b$"$j$^$9!#(B

      N: Alan Cox
      D: Linux Networking (0.99.10->2.0.29)
      D: Original Appletalk, AX.25, and IPX code
      D: Current 3c501 hacker. >>More 3c501 info/tricks wanted<<.
      D: Watchdog timer drivers
      D: Linux/SMP x86 (up to 2.0 only)
      D: Initial Mac68K port
      D: Video4Linux design, bw-qcam and PMS driver ports.
      D: 2.1.x modular sound

      N: Gordon Chaffee
      D: vfat, fat32, joliet, native language support

      N: Hannu Savolainen
      D: Kernel sound drivers

$BB>$K$b!"(BSlackware $B$N(B Patrick Volkerding$B!"(B Debian $B$N(B Ian A. Murdock $B$H(B Ian Jackson $BB>!"$=$l$K(B $B$$$m$$$m$H3FJ}LL$GM-L>$J(B Eric S. Raymond $B$d(B XFree86 $B$N(B Dirk Hohndel ($BH`$b(B TV $B$GA0$b$"$j$^$9$7!"(BLDP $B4X78

      N: Patrick Volkerding
      D: Produced the Slackware distribution, updated the SVGAlib
      D: patches for ghostscript, worked on color 'ls', etc.

      N: Ian A. Murdock
      D: Creator of Debian distribution

      N: Ian Jackson
      D: FAQ maintainer and poster of the daily postings
      D: FSSTND group member
      D: Debian core team member and maintainer of several Debian packages

      N: Eric S. Raymond
      D: terminfo master file maintainer
      D: Editor: Installation HOWTO, Distributions HOWTO, XFree86 HOWTO
      D: Author: fetchmail, Emacs VC mode, Emacs GUD mode

      N: Dirk Hohndel
      D: The XFree86[tm] Project

      N: Harald Koenig
      D: XFree86 (S3), DCF77, some kernel hacks and fixes

      N: Michael K. Johnson
      D: The Linux Documentation Project
      D: Kernel Hackers' Guide
      D: Procps
      D: Proc filesystem
      D: Maintain tsx-11.mit.edu
      D: LP driver

      N: Matt Welsh
      D: Linux Documentation Project coordinator
      D: Author, _Running_Linux_ and I&GS guide
      D: Linuxdoc-SGML formatting system
      D: Keithley DAS1200 device driver
      D: Maintainer of sunsite WWW and FTP, moderator c.o.l.answers

$B$A$g$C$H(B " egrep '^N:' CREDITS |wc" $B$H$7$F(B $B?t$($F$_$?$H$3$m!"(B2.2.5 $B%+!<%M%k$N(B CREDITS $B%U%!%$%k$K$O(B $B$6$C$H(B 273 $B?M$NL>A0$,5s$,$C$F$$$k$h$&$G$9!#(B(2.0.36 $B$GD4$Y$F$_$?$i(B 204 $B?M$G$7$?(B) $B$3$NCf$K=q$+$l$F$$$kL>A0$r2??MCN$C$F$$$k$+!"(B $B?t$($F$_$k$H(B Linux $B3&$X$N%O%^%jEY$,$o$+$C$F$*$b$7$m$$$+$b$7$l$^$;$s!#(B

$B$=$&$=$&!"!V%3%a%s%H!W$K$3$@$o$j$r;}$D$b$N$H$7$F$O!"(B $B$3$N%U%!%$%k$N:G8e$b8+F($5$J$$$h$&$K$7$F$*$/$3$H$,I,MW$G$9!#(B

      # Don't add your name here, unless you really _are_ after Marc
      # alphabetically. Leonard used to be very proud of being the 
      # last entry, and he'll get positively pissed if he can't even
      # be second-to-last.  (and this file really _is_ supposed to be
      # in alphabetic order) 

"pissed off" $B$C$F$$$&$N$O!"!V7c$7$/E\$k!W$H$+(B $B!VF,$K$/$k!W$H$$$&0UL#$i$7$$$G$9$M!#2?$F$$$&$+!"%+!<%M%k3+H/P$^$7$$5$$,$7$^$9!#(B

$B$"$H!"$b$&$R$H$DK:$l$F$^$7$?!#$3$l$G$9!#(B

      N: Lars Wirzenius
      D: Linux System Administrator's Guide
      D: Co-moderator, comp.os.linux.announce
      D: Original sprintf in kernel
      D: Personal information about Linus
      D: Original kernel README
      D: Linux News (electronic magazine)
      D: Meta-FAQ, originator
      D: INFO-SHEET, former maintainer
      D: Author of the longest-living linux bug

$B:G8e$N9T$KCmL\$7$F$/$@$5$$!#$J$+$J$+%f!<%b%"$N$"$kJ}$N$h$&$G$9!#(B

$BIaDL!V<+J,$,%P%0$rF~$l$?!W$H$$$&$N$O!"$"$^$j<+K}$G$-$k$3$H$G$O$J$$$N$G!"(B $B%3!<%I3+H/$X$N9W8%$Ke5-$NJ8$,$o$6$o$6=q$$$F$"$k$H$$$&$N$O!"(B $B$?$V$s$3$N(B Wirzenius $B$5$s$,<+J,$G!V$3$&=q$$$F$/$l!W$H0MMj$5$l$?$s$8$c$J$$$+$H(B $BA[A|$7$F$$$^$9!#(B

$B>e5-$N!V:G$bD9$/@8$-$N$S$?%P%0$NCxo$J$i$"$^$j8xI=$7$?$/$J$$$H;W$&$h$&$J2a5n$N!V%P%0!W$N$3$H$G$5$(!"(B $B!V>P$$!W$NBP>]$K$7$F$7$^$*$&$H$$$&%P%$%?%j%F%#$H$$$&$+!"(B $B%f!<%b%"$N%;%s%9$r46$8$^$9!#(B $B!V$I$&$@$$(B ? $B$3$N26$,$+$NM-L>$J!X:G$bD9$/2r7h(B $B$5$l$:$K;D$C$?%P%0!Y$NCx

1.4 $BC4Ev

$B$5$F!"$=$m$=$m

              List of maintainers and how to submit kernel changes

      Please try to follow the guidelines below.  This will make things
      easier on the maintainers.  Not all of these guidelines matter for every
      trivial patch so apply some common sense.

$B$H=q$+$l$F$$$^$9!#$D$^$j4pK\E*$K$O(B Linux $B%+!<%M%k$r<+J,$N]$K!"$=$N%Q%C%A$r$I$3$KAw$l$P(B $BI8=`$H$7$F:NMQ$5$l$k$N$+!"$H$$$&$B$7$+$7!"$3$N%U%!%$%k$K$b

      THE REST
      P:      Linus Torvalds
      S:      Buried alive in reporters

$B$A$J$_$K!"(B2.0.36 $B$^$G$N(B 2.0.xx $B7O$G$O$3$&$J$C$F$$$^$7$?!#(B

      REST:
      P:      Linus Torvalds
      S:      Buried alive in email

$B$3$3?tG/$N(B Linux $B$H(B Linus $B$5$s$ru67$NJQ2=$r(B $BJ*8l$C$F$$$k$h$&$G$9!#(B


2. $B%7%9%F%`$N5/F0!'35MW(B

$B$3$3$G$O%7%9%F%`$NEE8;(B ON $B$+$i(B /sbin/init $B$,5/F0$5$l$k$^$G$N(B $BN.$l$rBg$^$+$K@bL@$7$^$9!#(B

2.1 $B%+!<%M%k$N%m!<%I(B

PC/AT $B8_495!$G$O%^%6!<%\!<%I$N(B BIOS $B$,($B!VFCDj$N%a%b%j!<0LCV!W$H$O(B segment 0h / address 7C00h $B$^$?$O(B [0000:7C00] $B$G$9$,!"(BLinux $B%+!<%M%k$NCf$G$O(B offset $B$,(B 0 $B$+$i(B $B;O$a$i$l$k$h$&$K(B segment $B$r(B 7C0 $B$K$7$F$$$k$i$7$$$H$$$&>pJs$r(B $BD:$-$^$7$?!#(B)

PC $B>e$GMxMQ$5$l$k3F(B OS $B$O!"$3$N(B BIOS $B$K$h$k%V!<%H$rA0Ds$H$7$F!"(B $B:G=i$KFI9~$^$l$k%3!<%I$+$i;O$^$C$F=g$K<+J,$h$jBg$-$$%3!<%I$r(B $B%m!<%I$7!":G=*E*$KI,MW$J%3!<%I$r$9$Y$F%a%b%j!<$KFI$_9~$s$G(B $B$B$3$N0lO"$NF0:n$r0lHL$K%V!<%H%9%H%i%C%W!"$H8F$S$^$9!#(B $B%V!<%H$O(B boot ($BD97$(B)$B!"%9%H%i%C%W$O(B strap ($B3WI3(B) $B$N$3$H$G!"(B $B<+J,$,Mz$$$F$$$kD97$$NI3$r<+J,$G0z$CD%$C$FBN$r;}$A>e$2$h$&$H$9$k$3$H$K(B $BNc$($F$$$^$9!#(B

$B$J$*!V(BBootstrap$B!W$K$D$$$F$N2r@b$,(B http://www.oreilly.com/reference/dictionary/terms/B/Bootstrap.htm

$B$K$"$j$^$9$N$G!"6=L#$N$"$kJ}$OD4$Y$F$_$k$3$H$r$*4+$a$7$^$9!#(B $B$J$*$3$N(B Web $B%Z!<%8$K$O!V(B"Bootstrap" $B$N$3$H$r(B IBM $BMQ8l$G(B IPL, Initial Program Load $B$H8F$V!W$H=q$+$l$F$$$^$9!#(B

Linux $B%+!<%M%k$NFbIt$K$O!"(B($B$"$i$?$a$FJ9$/$H6C$+$l$k$+$b$7$l$^$;$s$,(B) $B$9$/$J$/$H$b(B i386 $B7O$G$O%O!<%I%G%#%9%/$+$i<+A0$G%V!<%H$5$;$k$?$a$N(B $B%3!<%I$OMQ0U$5$l$F$$$^$;$s!#(B $B%O!<%I%G%#%9%/$+$i$N%V!<%H$G$O(B LILO $B$d(B LOADLIN $B$J$I$N%V!<%H%m!<%@!<$r(B $BMxMQ$9$k$3$H$,A0Ds$H$J$C$F$$$^$9!#(B

$B%U%m%C%T!<$+$i$N5/F0$N>l9g!"%+!<%M%kFb$G:G=i$K%m!<%I$5$l$k%3!<%I$O(B arch/i386/boot/bootsect.S $B$G$9!#$3$N%3!<%I$OF1$8%G%#%l%/%H%j$K$"$k(B arch/i386/boot/setup.S $B$N%3!<%I$H!"%+!<%M%k$N;D$j$r%m!<%I$7$F(B setup.S $B$K@)8f$r0\9T$7$^$9!#(B

2.2 BIOS $B>pJs$N

arch/i386/boot/setup.S $B$O%a%b%j!<%5%$%:$d%G%#%9%/>pJs!"(B $B$^$?%3%s%=!<%kMQ%S%G%*%+!<%I$N>pJs$d(B APM BIOS $B$N%A%'%C%/$J$I!"(B $B%7%9%F%`$K4X$9$k$$$m$$$m$J>pJs$r(B BIOS $B$+$ie$KJ]B8$7$^$9!#(B

$B$5$i$K(B LILO $B$J$I$N%V!<%H%m!<%@!<$r;HMQ$7$?>l9g$K$O!"(B $B5/F0;~$K%-!<%\!<%I$+$iF~NO$5$l$?%+!<%M%k%*%W%7%g%s$r(B $B8e$G;2>H$G$-$k$h$&$K%a%b%j!<>e$NFCDj$N>l=j$K%3%T!<$9$k$N$b(B setup.S $B$N;E;v$G$9!#(B

setup.S $B$O(B BIOS $B>pJs$N

2.3 $B%+!<%M%kK\BN$NE83+(B

arch/i386/boot/compressed/head.S $B$O$$$/$D$+$N%A%'%C%/$H(B SMP $B$N>l9g$KI,MW$J=hM}$ruBV$G%a%b%j!<$K%m!<%I$5$l$F$$$k%+!<%M%kK\BN$r(B $BE83+$7$^$9!#(B

$B%3%s%=!<%k%b%K%?!<$K(B

Uncompressing Linux...

$B$H$$$&I=<($,=PNO$5$l$k$N$O!"$3$N(B decompress_kernel() $B$N$BE83+$,=*N;$9$k$H!"(Barch/i386/boot/compressed/head.S $B$O(B $B?7$7$/%a%b%j!<>e$K8=$o$l$?K\Mh$N%+!<%M%k%3!<%I$X$H(B $B=hM}$r0\9T$7$^$9!#(B

2.4 $B%G%P%$%9%I%i%$%P!<$N@_Dj(B

arch/i386/boot/compressed/head.S $B$K$h$C$FE83+$5$l$?(B $B!VK\Mh$N%+!<%M%k%3!<%I!W$N@hF,$KB8:_$7$F$$$k$N$O(B arch/i386/kernel/head.S $B$G$9!#(B

$B$3$N%3!<%I$O$B$3$N(B start_kernel() $B$G$O$3$3$^$G$K%7%9%F%`$+$i=8$a$F$-$F!"(B $B%a%b%j!<>e$NFCDj0LCV$KJ]B8$5$l$F$$$k$$$m$$$m$J>pJs$r;H$C$F!"(B $B%a%b%j!<4IM}$d%?%9%/%9%1%8%e!<%k$K4XO"$9$k%+!<%M%kFb$N(B $B3F%G%P%$%9%I%i%$%P!<$r@_Dj$7$F$$$-$^$9!#(B $B$^$?%3%s%=!<%k=PNO$N@_Dj$rstart_kernel() $B$OF1$8(B init/main.c $B$K$"$k(B init() $B$r(B kernel_thread () $B$r;H$C$F5/F0$7$?8e!"$d$O$jF1$8(B init/main.c $B$K(B $B$"$k(B cpu_idle() $B$r$B$5$F!"(Bstart_kernel() $B$+$i(B kernel_thread() $B$r7PM3$7$F(B $B5/F0$5$l$?(B init/main.c $B$GDj5A$5$l$F$$$k(B init() $B$G$9$,!"(B $B:G=i$K(B lock_kernel() ($B$3$l$O(B SMP $B$N>l9g$K$N$_0UL#$,$"$j$^$9(B) $B$r(B $B$B$3$N(B do_basic_setup() $B$b(B init/main.c $B$NCf$GDj5A$5$l$F$$$^$9$,!"(B $B%P%9$N=i4|2=$d3F%G%P%$%9%I%i%$%P$N=i4|2=!"%U%!%$%k%7%9%F%`(B $B4XO"%3!<%I$N=i4|2=!"%k!<%H%U%!%$%k%7%9%F%`$N%^%&%s%H$J$I$r(B $B$3$3$G

2.5 init $B$N5/F0(B

init/main.c $B$GDj5A$5$l$F$$$k(B init() $B$O(B do_basic_setup() $B$+$i(B $B=hM}$,La$C$F$/$k$H!"5/F0;~$K$N$_I,MW$H$5$l$?%a%b%j!

/sbin/init, /etc/init, /bin/init, /bin/sh

$B$r=gHV$K;n$7$F!":G=i$K8+$D$+$C$?

2.6 $B%7%9%F%`5/F0(B

$B$3$l0J9_$N=hM}$O!"(B/etc/inittab $B$G$N@_Dj$d(B /etc/rc.d $B$^$?$O(B /etc/init.d $B$H(B /etc/rc?.d $B$K$h$k5/F0%9%/%j%W%H$N@_Dj$J$I$K(B $B$h$C$FF0:n$,7h$^$j$^$9!#$3$l$K$D$$$F$O!"$?$V$s4{$K$4>5CN$N(B $B$+$?$bB?$$$N$G$O$J$$$G$7$g$&$+!#(B

$B!V%+!<%M%k$N5/F0!W$K$D$$$F$N35MW$O$3$l$G=*$o$j$G$9!#(B $Be$K=R$Y$?3FCJ3,$G;HMQ$5$l$k%3!<%I$K$D$$$F(B $B%3%a%s%H$rMj$j$KD4$Y$F$$$/$3$H$K$7$^$9!#(B


3. $B%+!<%M%k$N%m!<%I(B

$B>e5-$N!V35MW!W$G@bL@$7$?$h$&$K!"%U%m%C%T!<$+$i$N5/F0$N>l9g!"(B $B%+!<%M%kFb$G:G=i$K%m!<%I$5$l$k%3!<%I$O(B arch/i386/boot/bootsect.S $B$G$9!#(B

$B$^$:$O!"$3$N%U%!%$%k$+$iD/$a$F$_$k$3$H$K$7$^$7$g$&!#(B

3.1 bootsect.S - $BKAF,$N%3%a%s%H(B

!
!       bootsect.s              Copyright (C) 1991, 1992 Linus Torvalds
!       modified by Drew Eckhardt
!       modified by Bruce Evans (bde)
!
! bootsect.s is loaded at 0x7c00 by the bios-startup routines, and moves
! itself out of the way to address 0x90000, and jumps there.
!
! bde - should not jump blindly, there may be systems with only 512K low
! memory.  Use int 0x12 to get the top of memory, etc.
!
! It then loads 'setup' directly after itself (0x90200), and the system
! at 0x10000, using BIOS interrupts. 
!
! NOTE! currently system is at most (8*65536-4096) bytes long. This should 
! be no problem, even in the future. I want to keep it simple. This 508 kB
! kernel size should be enough, especially as this doesn't contain the
! buffer cache as in minix (and especially now that the kernel is 
! compressed :-)
!
! The loader has been made as simple as possible, and continuous
! read errors will result in a unbreakable loop. Reboot by hand. It
! loads pretty fast by getting whole tracks at a time whenever possible.

$B>e$N!V35MW!W$K=q$$$?$3$H$,!"$7$C$+$jKAF,$K%3%a%s%H$H$7$F(B $B5-:\$5$l$F$$$^$9$M!#(B

$B!V(Bbootsect.s $B$O(B BIOS $B$N%V!<%H%7!<%1%s%9$K$h$C$F(B $B%a%b%j!<>e$N%"%I%l%9(B 0x7c00 $B$K%m!<%I$5$l$k!#(B $B$B$R$H$DHt$P$7$F(B

$B!V8e(B (0x90200) $B$K(B 'setup' $B$r!"$^$?%7%9%F%`$r(B 0x10000 $B$K(B BIOS $B%$%s%?%i%W%H$r;H$C$F%m!<%I$9$k!W(B

$B$=$N$B!VCm0U(B! $B8=:_!"%7%9%F%`$O:GBg$G$b(B (8*65536-4096) $B%P%$%H$^$G$ND9$5(B $B$G$"$k!#$3$N@)8B$K$D$$$F$O!"Nc$(>-Mh$K$*$$$F$b!"LdBj$r@8$8$k$3$H$OL5$$!#(B $BJ*;v$O$J$k$Y$/C1=c$K$7$F$*$-$?$$$b$N$@!#$3$N%+!<%M%k%5%$%:(B 508 kB $B$H(B $B$$$&@)8B$O!"(Bminix $B$N$h$&$K%P%C%U%!!<%-%c%C%7%e$r4^$s$G$$$k$o$1$G$O(B $B$J$$$3$H$r9M$($k$H(B ($B$=$7$F$^$?!"8=:_%+!<%M%k$O05=L$5$l$?>uBV$G%m!<%I(B $B$5$l$F$$$k$3$H$r9M$($k$H(B :) $B$^$C$?$/==J,$JBg$-$5$H8@$($k$O$:$G$"$k!#!W(B

$B$+$i

3.2 bootsect.S - $B%Q%i%a!<%?Dj5A(B

$B$=$m$=$m!"%3!<%I$NCf?H$KF~$C$F$_$^$7$g$&!#(B

#include <linux/config.h> /* for CONFIG_ROOT_RDONLY */
#include <asm/boot.h>

.text

SETUPSECS = 4                           ! default nr of setup-sectors
BOOTSEG   = 0x07C0                      ! original address of boot-sector
INITSEG   = DEF_INITSEG                 ! we move boot here - out of the way
SETUPSEG  = DEF_SETUPSEG                ! setup starts here
SYSSEG    = DEF_SYSSEG                  ! system loaded at 0x10000 (65536).
SYSSIZE   = DEF_SYSSIZE                 ! system size: number of 16-byte clicks

$B:G=i$N9T!"(B#include <linux/config.h> $B$O(B include/linux/config.h $B$NDj5A$r;H$&!"$H$$$&$3$H$G$9!#(B $B$G!"$3$N%X%C%@!<%U%!%$%k$NCf?H$O$3$&$J$C$F$^$9!#(B

#ifndef _LINUX_CONFIG_H
#define _LINUX_CONFIG_H

#include <linux/autoconf.h>

#endif

$B$3$l$@$1!#$3$l$O(B include/linux/autoconf.h $B$NDj5A$r;H$$$J$5$$!"$H(B $B$$$&$3$H$G$9!#$G!"$3$N%U%!%$%k$rC5$7$F$_$k$H!"$"$j$^$;$s!#(B

$B$B:#2s$O;~4V$NET9g$G!"$3$N%U%!%$%k$r:n$i$l$kJN,$7!"#include <asm/boot.h> $B$rD4$Y$F$_$k(B $B$3$H$K$7$^$9!#(B

$B$3$A$i$O(B include/asm-i386/boot.h $B$,C5$7$F$$$k%U%!%$%k$G(B

#ifndef _LINUX_BOOT_H
#define _LINUX_BOOT_H

/* Don't touch these, unless you really know what you're doing. */
#define DEF_INITSEG     0x9000
#define DEF_SYSSEG      0x1000
#define DEF_SETUPSEG    0x9020
#define DEF_SYSSIZE     0x7F00

/* Internal svga startup constants */
#define NORMAL_VGA      0xffff          /* 80x25 mode */
#define EXTENDED_VGA    0xfffe          /* 80x50 mode */
#define ASK_VGA         0xfffd          /* ask for it at bootup */

#endif

$B$H=q$+$l$F$$$^$9!#$3$N$"$?$j$b!"(B2.0.36 $B$HHf3S$7$FJQ99$5$l$?ItJ,$G$9$M!#(B (2.0.36 $B$G$O$3$NDj5A$,(B include/linux/config.h $B$K$"$j$^$7$?(B)

$B$5$F!"OC$r$b$H$N(B bootsect.S $B$KLa$7$^$9!#(B

.text

SETUPSECS = 4                           ! default nr of setup-sectors
BOOTSEG   = 0x07C0                      ! original address of boot-sector
INITSEG   = DEF_INITSEG                 ! we move boot here - out of the way
SETUPSEG  = DEF_SETUPSEG                ! setup starts here
SYSSEG    = DEF_SYSSEG                  ! system loaded at 0x10000 (65536).
SYSSIZE   = DEF_SYSSIZE                 ! system size: number of 16-byte clicks

$B$3$NItJ,$N:G=i$K$"$k(B ".text" $B$O!"$3$3$K=q$+$l$F$$$k$N$,(B $BF0:n;~$K$B$3$3$G;2>H$5$l$F$$$k(B

DEF_INITSEG, DEF_SETUPSEG, DEF_SYSSEG, DEF_SYSSIZE
$B$O4{$K8+$F$-$?$h$&$K!"(Binclude/asm/boot.h $B$GDj5A$5$l$F$$$^$7$?!#(B

$B$3$NItJ,$N2<$K$b!"$$$/$D$+JQ?tDj5A$,B3$$$F$$$^$9$,!">JN,$7$F(B $B

3.3 bootsect.S - $B

$B

! ld86 requires an entry symbol. This may as well be the usual one.
.globl  _main
_main:
#if 0 /* hook for debugger, harmless unless BIOS is fussy (old HP) */
        int     3
#endif
        mov     ax,#BOOTSEG
        mov     ds,ax
        mov     ax,#INITSEG
        mov     es,ax
        mov     cx,#256
        sub     si,si
        sub     di,di
        cld
        rep
        movsw
        jmpi    go,INITSEG

! ax and es already contain INITSEG

$B$3$3$G(B "#BOOTSEG" $B$O(B BIOS $B$K$h$C$F(B bootsect.S $B$N(B $B%3!<%I$,%m!<%I$5$l$?%"%I%l%9!"(B"#INITSEG" $B$O(B bootsect.S $B$,<+J,<+?H$r%3%T!<$7$F=hM}$r0\$9(B($B%8%c%s%W$9$k(B) $B%"%I%l%9$G$9!#$3$3$G$O(B "movsw" $B$^$G$N9T$G!V<+J,<+?H$N(B $B%3%T!$B$3$N$"$H$7$P$i$/%U%m%C%T!<%I%i%$%V$r$&$^$/F0:n$5$;$k$?$a$N=`Hw$,(B $B9T$J$o$l$^$9!#$=$7$F

load_setup:
        xor     ah,ah                   ! reset FDC 
        xor     dl,dl
        int     0x13    

$B:G=i$O%U%m%C%T!<%I%i%$%V%3%s%H%m!<%i$r%j%;%C%H$9$k$H$3$m$+$i;O$^$C$F(B

        xor     dx, dx                  ! drive 0, head 0
        mov     cl,#0x02                ! sector 2, track 0
        mov     bx,#0x0200              ! address = 512, in INITSEG
        mov     ah,#0x02                ! service 2, nr of sectors
        mov     al,setup_sects          ! (assume all on head 0, track 0)
        int     0x13                    ! read it
        jnc     ok_load_setup           ! ok - continue

$B%I%i%$%V!"%X%C%I!"%;%/%?!e$K%m!<%I$7$F$$$^$9!#%m!<%I@h$N%"%I%l%9$O(B "INITSEG" $B$N%"%I%l%9(B 0x9000 $B$K(B 0x200 $B$r2C$($?(B 0x9200 $B$H$J$j$^$9!#(B

setup.S $B$N%m!<%I$r40N;$9$k$H(B "Loading" $B$H$$$&(B $B%a%C%;!<%8$rI=<($7$F!"

got_sectors:

! Restore es

        mov     ax,#INITSEG
        mov     es,ax

! Print some inane message

        mov     ah,#0x03                ! read cursor pos
        xor     bh,bh
        int     0x10
        
        mov     cx,#9
        mov     bx,#0x0007              ! page 0, attribute 7 (normal)
        mov     bp,#msg1
        mov     ax,#0x1301              ! write string, move cursor
        int     0x10

! ok, we've written the message, now
! we want to load the system (at 0x10000)

        mov     ax,#SYSSEG
        mov     es,ax           ! segment of 0x010000
        call    read_it
        call    kill_motor
        call    print_nl

$B>e$N(B "int 0x10" $B$O2hLLI=<(@)8f$N(B BIOS $B%$%s%?%i%W%H(B $B$G$"$j!"(B "#msg1" $B$O(B bootsect.S $B$N=*$j$N$[$&$G(B

          msg1:
                  .byte 13,10
                  .ascii "Loading"

$B$H$7$FDj5A$5$l$F$$$^$9!#$3$3$G(B ".byte" $B$N(B 13 $B$O(B CR ($B%-%c%j%C%8%j%?!<%s(B)$B!"(B 10 $B$O(BLF ($B%i%$%s%U%#!<%I(B) $B$G$9!#(B

$B$5$F!"%7%9%F%`K\BN$N%m!<%I$G$9$,!"$3$l$O>e$K=q$+$l$?(B "call read_it"$B$K$h$C$F8F$S=P$5$l$k(B

! This routine loads the system at address 0x10000, making sure
! no 64kB boundaries are crossed. We try to load it as fast as
! possible, loading whole tracks whenever we can.
!
! in:   es - starting address segment (normally 0x1000)
!
sread:  .word 0                 ! sectors read of current track
head:   .word 0                 ! current head
track:  .word 0                 ! current track

read_it:

$B0J9_$NItJ,!"FC$K

rp_read:
#ifdef __BIG_KERNEL__
#define CALL_HIGHLOAD_KLUDGE .word 0x1eff,0x220 ! call far * bootsect_kludge
                                ! NOTE: as86 can't assemble this
        CALL_HIGHLOAD_KLUDGE    ! this is within setup.S
#else
        mov ax,es
        sub ax,#SYSSEG
#endif
        cmp ax,syssize          ! have we loaded all yet?
        jbe ok1_read
        ret

$B$3$3$G(B "CALL_HIGHLOAD_KLUDGE" $B$O%3%a%s%H$K$"$k$h$&$K(B $B$A$g$&$I$3$NItJ,$N$9$3$7A0$K%m!<%I$7$?(B setup.S $B$N%3!<%I$K4^$^$l$F(B $B$$$k(B bootsect_kludge $B$KBP1~$7$?%"%I%l%9$+$i;O$^$k%3!<%I$G$9!#(B setup.S $B$NCf$G$O(B "bootsect_kludge" $B$O

bootsect_kludge:
                .word   bootsect_helper,SETUPSEG

$B$^$?$3$N(B bootsect_helper $B$O(B setup.S $B$NCf$G0J2<$N$h$&$K(B $BDj5A$5$l$F$$$^$9!#(B

! This routine only gets called, if we get loaded by the simple
! bootsect loader _and_ have a bzImage to load.
! Because there is no place left in the 512 bytes of the boot sector,
! we must emigrate to code space here.
!
bootsect_helper:

$B%3%a%s%H$K$7$C$+$j!V(Bbootsect.S $B$K$h$C$F(B bzImage $B7A<0$N%+!<%M%k$,(B $B%m!<%I$5$l$?>l9g$K8B$C$F$B$5$F!"(Bbootsect.S $B$NCf$G!"

read_track:
        pusha
        pusha   
        mov     ax, #0xe2e      ! loading... message 2e = .
        mov     bx, #7
        int     0x10
        popa            

$B$3$3$N(B 0x10 $B$O2hLLI=<($r9T$J$&(B BIOS $B%$%s%?%i%W%H%3!<%k$G$9!#(B $B4{$K(B setup.S $B$N%3!<%I$r%m!<%I$7$?;~E@$G!"(B "Loading" $B$H$$$&%a%C%;!<%8$,2hLL$K=PNO$5$l$F$$$k$O$:$J$N$G!"$3$3$G$O(B "." $B$N=PNO$N$_$r9T$J$C$F$$$^$9!#(B

        mov     dx,track
        mov     cx,sread
        inc     cx
        mov     ch,dl
        mov     dx,head
        mov     dh,dl
        and     dx,#0x0100
        mov     ah,#2
        
        push    dx                              ! save for error dump
        push    cx
        push    bx
        push    ax

        int     0x13
        jc      bad_rt
        add     sp, #8
        popa
        ret

BIOS $B%$%s%?%i%W%H(B "Int 0x13" $B$Ne$N%7%9%F%`%U%!%$%k$,%a%b%j!<$K%m!<%I$5$l$F$$$-$^$9!#(B

$B%m!<%I$,40N;$9$k$H!"@h$K0zMQ$7$?(B

        call    read_it
        call    kill_motor
        call    print_nl

$B$r=g$K$B$=$N8e!"%k!<%H%G%P%$%9$N%A%'%C%/$r7P$F(B

! after that (everything loaded), we jump to
! the setup-routine loaded directly after
! the bootblock:

        jmpi    0,SETUPSEG

"SETUPSEG" $B$KB8:_$9$k(B setup.S $B$N%3!<%I$K(B $B%8%c%s%W$7$^$9!#(B


4. BIOS $B>pJs$N

$B$5$F!"(Barch/i386/boot/setup.S $B$K?J$_$^$7$g$&!#(B

$B$^$:$O%U%!%$%kKAF,$N%3%a%s%H$+$i!#(B

!
!       setup.S         Copyright (C) 1991, 1992 Linus Torvalds
!
! setup.s is responsible for getting the system data from the BIOS,
! and putting them into the appropriate places in system memory.
! both setup.s and system has been loaded by the bootblock.
!
! This code asks the bios for memory/disk/other parameters, and
! puts them in a "safe" place: 0x90000-0x901FF, ie where the
! boot-block used to be. It is then up to the protected mode
! system to read them from there before the area is overwritten
! for buffer-blocks.
!
! Move PS/2 aux init code to psaux.c
! ([email protected]) 03Oct92
!
! some changes and additional features by Christoph Niemann,
! March 1993/June 1994 ([email protected])
!
! add APM BIOS checking by Stephen Rothwell, May 1994
! ([email protected])
!
! High load stuff, initrd support and position independency
! by Hans Lermen & Werner Almesberger, February 1996
! <[email protected]>, <[email protected]>
!
! Video handling moved to video.S by Martin Mares, March 1996
! <[email protected]>
!
! Extended memory detection scheme retwiddled by [email protected] (david
! parsons) to avoid loadlin confusion, July 1997

$B$I$&$G$7$g$&(B ? $B$b$&$3$N%3%a%s%H$@$1FI$a$P!"$3$N%U%!%$%k$K(B $B=q$+$l$F$$$k%3!<%I$,2?$r$7$F$$$k$N$+!"$@$$$?$$$o$+$C$?$h$&$J(B $B5$$K$J$j$^$;$s$+(B ?

$BMW$9$k$K!V(Bsetup.S $B$O(B BIOS $B$+$i%7%9%F%`$K4X$9$k%G!<%?$rl=j$KJ]4I$9$k$?$a$N%3!<%I$G$"$k!#!W(B $B$H$$$&$3$H$G$9!#(B

$B$^$"!"$3$l$@$1$G$O$"$s$^$j$J$N$G!"$A$g$C$HLLGr$=$&$J$H$3$m$r(B $BH4$-=P$7$F$_$k$H!"(B

! SETUP-header, must start at CS:2 (old 0x9020:2)
!
                .ascii  "HdrS"          ! Signature for SETUP-header
                .word   0x0201          ! Version number of header format
                                        ! (must be >= 0x0105
                                        ! else old loadlin-1.5 will fail)
realmode_swtch: .word   0,0             ! default_switch,SETUPSEG
start_sys_seg:  .word   SYSSEG
                .word   kernel_version  ! pointing to kernel version string
  ! note: above part of header is compatible with loadlin-1.5 (header v1.5),
  !        must not change it

type_of_loader: .byte   0               ! = 0, old one (LILO, Loadlin,
                                        !      Bootlin, SYSLX, bootsect...)
                                        ! else it is set by the loader:
                                        ! 0xTV: T=0 for LILO
                                        !       T=1 for Loadlin
                                        !       T=2 for bootsect-loader
                                        !       T=3 for SYSLX
                                        !       T=4 for ETHERBOOT
                                        !       V = version
loadflags:                      ! flags, unused bits must be zero (RFU)
LOADED_HIGH     = 1             ! bit within loadflags,
                                ! if set, then the kernel is loaded high
CAN_USE_HEAP    = 0x80          ! if set, the loader also has set heap_end_ptr
                                ! to tell how much space behind setup.S
                                | can be used for heap purposes.
                                ! Only the loader knows what is free!
#ifndef __BIG_KERNEL__
                .byte   0x00
#else
                .byte   LOADED_HIGH
#endif

"type_of_loader" $B$N$H$3$m$G(B LILO, Loadlin, bootsect-loader, SYSLX, ETHERBOOT $B$,%j%9%H$5$l$F$$$^$9!#(B Linux $B$N%+!<%M%k%m!<%@!<$b7k9=$B$3$N:G=i$NItJ,$G$O%m!<%@!<$N%A%'%C%/$r$7$F$$$^$9!#8E$$%m!<%@!<$G$O(B "big kernel" $B$r$&$^$/07$($J$$$?$a!"$=$&$$$&>l9g$K$O(B $B7Y9p$rH/$7$F;_$k$h$&$K$J$C$F$$$^$9!#(B

$B%m!<%@!<$N%A%'%C%/$,=*$o$k$H!"%a%b%j!<%5%$%:$N%A%'%C%/$,(B $B;O$^$j$^$9!#(B

loader_ok:
! Get memory size (extended mem, kB)

#ifndef STANDARD_MEMORY_BIOS_CALL
        push    ebx

        xor     ebx,ebx         ! preload new memory slot with 0k
        mov     [0x1e0], ebx

        mov     ax,#0xe801
        int     0x15
        jc      oldstylemem

"int 0x15" $B$H(B #0xe801 $B$rAH$_9g$o$;$F(B $B%a%b%j!<%5%$%:$r%A%'%C%/$7$F$$$^$9!#(B

! Memory size is in 1 k chunksizes, to avoid confusing loadlin.
! We store the 0xe801 memory size in a completely different place,
! because it will most likely be longer than 16 bits.
! (use 1e0 because that's what Larry Augustine uses in his
! alternative new memory detection scheme, and it's sensible
! to write everything into the same place.)

$B

! Set the keyboard repeat rate to the max

        mov     ax,#0x0305
        xor     bx,bx           ! clear bx
        int     0x16

$B$=$7$F%3%s%=!<%kMQ%S%G%*%+!<%I$N%A%'%C%/!#(B

! Check for video adapter and its parameters and allow the
! user to browse video modes.

        call    video   ! NOTE: we need DS pointing to boot sector

$B$3$N(B "call video" $B$G8F$S=P$5$l$F$$$k$N$O(B $BF1$8%G%#%l%/%H%j$K$"$k(B arch/i386/boot/video.S $B$NCf$G(B $BDj5A$5$l$F$$$k4X?t$G$9!#(B

$B0J8e!"3F%O!<%I%&%'%"$r%A%'%C%/$7$F$$$kItJ,$G!"%3%a%s%H$@$1(B $B=&$C$F$$$/$H(B

! Get hd0 data

! Get hd1 data

! Check that there IS a hd1 :-)

! check for Micro Channel (MCA) bus

! Check for PS/2 pointing device

#ifdef CONFIG_APM
! check for APM BIOS

!
! Redo the installation check as the 32 bit connect
! modifies the flags returned on some BIOSs
!

done_apm_bios:
#endif

$B$J$I$N=hM}$,$"$j$^$9!#(B

$B$3$N8e!"$$$h$$$h(B

! Now we want to move to protected mode ...

! we get the code32 start address and modify the below 'jmpi'
! (loader may have changed it)

! Now we move the system to its rightful place
! ...but we check, if we have a big-kernel.
! in this case we *must* not move it ...

! then we load the segment descriptors

! If we have our code not at 0x90000, we need to move it there now.
! We also then need to move the parameters behind it (command line)
! Because we would overwrite the code on the current IP, we move
! it in two steps, jumping high after the first one.

! that was painless, now we enable A20

! wait until a20 really *is* enabled; it can take a fair amount of
! time on certain systems; Toshiba Tecras are known to have this
! problem.  The memory location used here is the int 0x1f vector,
! which should be safe to use; any *unused* memory location < 0xfff0
! should work here.  

$B$H!"(B32bit protect mode $B$X$N0\9T$N=`Hw$r?J$a$F$$$-$^$9!#(B

$B:G8e$N(B "wait until a20 really ..." $B$O(B 2.0.xx $B7O(B $B%+!<%M%k$G(B bzImage $B$K$9$k$H5/F0$G$-$J$+$C$?El$BB3$$$F!"%$%s%?%i%W%H4X78$N=hM}!#(B

! make sure any possible coprocessor is properly reset..

! well, that went ok, I hope. Now we have to reprogram the interrupts :-(
! we put them right after the intel-reserved hardware interrupts, at
! int 0x20-0x2F. There they won't mess up anything. Sadly IBM really
! messed this up with the original PC, and they haven't been able to
! rectify it afterwards. Thus the bios puts interrupts at 0x08-0x0f,
! which is used for the internal hardware interrupts as well. We just
! have to reprogram the 8259's, and it isn't fun.

! Well, that certainly wasn't fun :-(. Hopefully it works, and we don't
! need no steenking BIOS anyway (except for the initial loading :-).
! The BIOS routine wants lots of unnecessary data, and it's less
! "interesting" anyway. This is how REAL programmers do it.
!
! Well, now's the time to actually move into protected mode. To make
! things as simple as possible, we do no register set-up or anything,
! we let the GNU-compiled 32-bit programs do that. We just jump to
! absolute address 0x1000 (or the loader supplied one),
! in 32-bit protected mode.
!
! Note that the short jump isn't strictly needed, although there are
! reasons why it might be a good idea. It won't hurt in any case.
!

$B$I$&$d$i(B Linus $B$5$s$O:G=i$K3+H/$r;O$a$?:"!"$3$N$"$?$j$N=hM}$K(B $BAjEv6lO+$7$?$i$7$/!"(B"Sadly IBM messed this up" $B$H$+(B "and it isn't fun." $B$^$?(B "Well, that certainly wasn't fan :-(." $B$J$s$F$N$b$"$j$^$9!#0lJ}$G!"<+J,[email protected]$K$O$=$l$J$j$K0&Ce$b(B $B;}$C$F$$$k$h$&$G!"(B"This is how REAL programmers do it." $B$J$I$H=q$$$F$"$C$?$j$b$7$^$9!#(B

JF $B$N;qNA$K(B "Linux HISTORY" $B$H$$$&J8=q$,$"$j$^$9$,!"(B $B$=$NCf$K$3$s$J0l@a$,$"$j$^$9!#(B

> 1) $B%+!<%M%k$r:n$C$F$$$k$H$-$K$O!"(B $B$@$$$?$$$I$&$d$C$F%G%P%C%0$7$^$9$+(B ?

$B;H$C$F$$$k%^%7%s$H!":n6H$N?J$_6q9g$K$h$j$^$9!#(B $B$b$C$H%7%s%W%k$J%7%9%F%`$J$i$?$$$F$$%;%C%H%"%C%W$O$b$C$H4JC1$G$9!#(B $B%W%m%F%/%H%b!<%I$N(B 386 $B$G;d$,$d$i$J$1$l$P$J$i$J$+$C$?$3$H$r$+$-$^$9!#(B

$B0lHVLq2p$J=j$O0lHV:G=i$G$9!#(Bprintf $BEy$,;H$($k:GDc8B$N%7%9%F%`$r(B $BZ5r$r;D$92K$b$"$j$^$;$s!#(B

printf() $B$b$?$$$7$FLr$KN)$A$^$;$s!#%j%V!<%H$9$l$P2hLL$b$-$l$$$5$C$Q$j$G$9!#(B $B$=$l$+$i!"(BVRAM $B$bC!$+$J$1$l$P$@$a$G$9!#(B VRAM $B$O%;%0%a%s%H$,4V0c$C$F$$$?$j$9$k$HMn$C$3$A$F$/$l$^$9!#(B $B%G%P%C%,$J$s$F9M$($k$@$1L5BL$G$9!#(B386 $B$N%W%m%F%/%H%b!<%I$^$G(B $B$D$$$F$$$/%G%P%C%,$J$s$FJ9$$$?$3$H$,$"$j$^$;$s!#(B386 $B%(%_%e%l!<%?$d!"(B $B0lIt$N=EAuHw$N%^%7%s$J$i$J$s$H$+$J$k$+$b$7$l$^$;$s$,!"BgDq$OBLL\$G$9!#(B

$B;d$,;H$C$?$N$O!"$?$@$N;~4V2T$.$N%k!<%W$G$7$?!#(B

       die:
                jmp die

$B$3$N$h$&$J$b$N$r$3$3$>$H$$$&$H$3$m$KF~$l$^$9!#;_$^$C$F$7$^$($P(B OK $B$G$9$7!"(B $B%j%V!<%H$7$F$7$^$C$?$i!"$9$/$J$/$H$b$3$N(B die $B%k!<%W$NA0$,2x$7$$$H$o$+$j$^$9!#(B $BJQ$o$j$K%5%&%s%I%]!<%H$bMxMQ$G$-$^$9$,!";d$O(B PC $B$N%O!<%I$O$$$8$C$?$3$H$,(B $B$J$+$C$?$N$G!"A4A3;H$$$^$;$s$G$7$?!#$3$l0J30$KJ}K!$,$J$$$o$1$G$O$"$j$^$;$s!#(B $B;d$O%+!<%M%k$r=q$3$&$H;W$C$F;O$a$?$N$G$O$J$/!"$?$@(B 386 $B$N%?%9%/%9%$%C%AEy$K(B $B$D$$$FCN$j$?$+$C$?$@$1$G$9!#$7$+$7!"$H$K$+$/$3$&$7$F=q$-;O$a$^$7$?!#(B (91$BG/$N(B4$B7n$N$3$H$G$7$?(B)

$B:GDc8B$N%7%9%F%`$,=PMh>e$,$j!"%9%/%j!<%s$r=PNO$K;H$($k$h$&$K$J$k$H!"(B $B>/!93Z$K$J$j$^$9!#$7$+$7!"$3$3$G3d$j9~$_$rM-8z$K$7$J$1$l$P$J$j$^$;$s!#(B $B%I%+!A%s!#(B $B$$$-$J$j%j%V!<%H$7$F!"$^$?:G=i$NJ}K!$K5ULa$j!#A4$F$,$3$ND4;R$G!"(B $B$*$h$=(B 2$B$+7n$+$1$F!"(B386 $B$N$^$o$j$r$^$H$b$KF0$/$h$&$K$7$^$7$?!#(B $B$=$l$+$i$O!"%j%V!<%H$7$J$$$h$&$K$H5$$r;H$$$J$,$i!"F1;~$K4pK\E*$J$b$N(B ($B%Z!<%8%s%0!"%?%$%^3d$j9~$_!"C1=c$J%?%9%/%9%$%C%A%c!"%;%0%a%s%H$N%F%9%H(B) $B$r:n$k$H$$$&$3$H$r$7$J$$$G:Q$`$h$&$K$J$j$^$7$?!#(B

$B$3$N$"$?$j$NOC$rFI$`$H!"(Bsetup.S $B$N%$%s%?%i%W%H4X78$N=hM}$d(B $B%W%m%F%/%H%b!<%I$X$N0\9T$K4X$9$k=hM}$K$"$k%3%a%s%H$NGX7J$,(B $B2?$H$J$/$o$+$k$h$&$J5$$,$7$F$-$^$;$s$+(B ?

$B$J$*!"(Bsetup.S $B$N=hM}$O:G8e$K%+!<%M%kK\BN$N%"%I%l%9$X(B $B%8%c%s%W$7$F=*N;$7$^$9!#(B

! NOTE: For high loaded big kernels we need a
!       jmpi    0x100000,__KERNEL_CS
!
!       but we yet haven't reloaded the CS register, so the default size 
!       of the target offset still is 16 bit.
!       However, using an operant prefix (0x66), the CPU will properly
!       take our 48 bit far pointer. (INTeL 80386 Programmer's Reference
!       Manual, Mixing 16-bit and 32-bit code, page 16-6)
        db      0x66,0xea       ! prefix + jmpi-opcode
code32: dd      0x1000          ! will be set to 0x100000 for big kernels
        dw      __KERNEL_CS


5. $B%+!<%M%kK\BN$NE83+(B

$B$5$F(B arch/i386/boot/setup.S $B$+$i=hM}$r0z$-7Q$$$@!V%+!<%M%kK\BN!W$G$9$,!"(B $BuBV$G%a%b%j!$B$B$3$l$O!"(Barch/i386/boot/compressed/head.S $B$K$"$k(B

/*
 * Do the decompression, and jump to the new kernel..
 */
        subl $16,%esp   # place for structure on the stack
        pushl %esp      # address of structure as first arg
        call SYMBOL_NAME(decompress_kernel)
        orl  %eax,%eax 
        jnz  3f
        xorl %ebx,%ebx
        ljmp $(__KERNEL_CS), $0x100000

$B$K$h$C$F

int decompress_kernel(struct moveparams *mv)
{
        if (SCREEN_INFO.orig_video_mode == 7) {
                vidmem = (char *) 0xb0000;
                vidport = 0x3b4;
        } else {
                vidmem = (char *) 0xb8000;
                vidport = 0x3d4;
        }

        lines = SCREEN_INFO.orig_video_lines;
        cols = SCREEN_INFO.orig_video_cols;

        if (free_mem_ptr < 0x100000) setup_normal_output_buffer();
        else setup_output_buffer_if_we_run_high(mv);

        makecrc();
        puts("Uncompressing Linux... ");
        gunzip();
        puts("Ok, booting the kernel.\n");
        if (high_loaded) close_output_buffer_if_we_run_high(mv);
        return high_loaded;
}

$B$H$7$FDj5A$5$l$F$*$j!"$5$i$K$3$NCf$G;H$o$l$F$$$k(B gunzip() $B$K(B $B$D$$$F$O(B lib/infalte.c $B$NCf$GDj5A$5$l$F$$$^$9!#(B

($B$3$l$G5/F0;~$K(B "Uncompressing Linux... " $B$H$$$&(B $B%a%C%;!<%8$r=P$7$F$$$k$N$,2?=h$+!"$o$+$j$^$7$?$M!#(B)

$B$5$F!"(Barch/i386/boot/compressed/head.S $B$NKAF,$K=q$+$l$F$$$k(B $B%3%a%s%H$r0J2<$K0zMQ$7$F$_$^$7$g$&!#(B

/*
 *  linux/boot/head.S
 *
 *  Copyright (C) 1991, 1992, 1993  Linus Torvalds
 */

/*
 *  head.S contains the 32-bit startup code.
 *

$B$*$d(B ? $B%U%!%$%kL>$,0c$$$^$9$M!#$3$l$O(B Linux $B%+!<%M%k$,8=:_$N$h$&$K(B $BB?$/$N5!$G$7$g$&!#(B $BEv;~$O8=:_$N$h$&$K%"!<%-%F%/%A%c$K0MB8$7$?ItJ,$,J,N%$5$l$F$$$^$;$s(B $B$G$7$?$+$i!#(B

$B$5$F!"05=L$5$l$F$$$?%+!<%M%kK\BN$bE83+$5$l$^$7$?!#

/*
 * Do the decompression, and jump to the new kernel..
 */
        subl $16,%esp   # place for structure on the stack
        pushl %esp      # address of structure as first arg
        call SYMBOL_NAME(decompress_kernel)
        orl  %eax,%eax 
        jnz  3f
        xorl %ebx,%ebx
        ljmp $(__KERNEL_CS), $0x100000

/*
 * We come here, if we were loaded high.
 * We need to move the move-in-place routine down to 0x1000
 * and then start it with the buffer addresses in registers,
 * which we got from the stack.
 */
3:
        movl $move_routine_start,%esi
        movl $0x1000,%edi
        movl $move_routine_end,%ecx
        subl %esi,%ecx
        cld
        rep
        movsb

        popl %esi       # discard the address
        popl %esi       # low_buffer_start
        popl %ecx       # lcount
        popl %edx       # high_buffer_start
        popl %eax       # hcount
        movl $0x100000,%edi
        cli             # make sure we don't get interrupted
        ljmp $(__KERNEL_CS), $0x1000 # and jump to the move routine

/*
 * Routine (template) for moving the decompressed kernel in place,
 * if we were high loaded. This _must_ PIC-code !
 */
move_routine_start:
        rep
        movsb
        movl %edx,%esi
        movl %eax,%ecx  # NOTE: rep movsb won't move if %ecx == 0
        rep
        movsb
        xorl %ebx,%ebx
/*
 * Well, the kernel relies on %esp pointing into low mem,
 * with the decompressor loaded high this is no longer true,
 * so we set esp here.
 */
        mov  $0x90000,%esp
        ljmp $(__KERNEL_CS), $0x100000
move_routine_end:

"decompress_kernel" $B$N$9$08e$N(B "jnz" $B$G(B "3:"$B$X%8%c%s%W$;$:$K!"(B $B$=$N$^$^(B"ljmp $(__KERNEL_CS), $0x100000" $B$9$k>l9g(B (zImage) $B$H!"$$$C$?$s(B "3:" $B$X%8%c%s%W$7$F(B "move_routine_start:" $B$H(B "move_routine_end:" $B$N4V$GE83+$7$?%+!<%M%k$N>l=j$N0\F0$r9T$J$C$F$+$i(B "ljmp $(__KERNEL_CS), $0x100000" $B$9$k>l9g(B (bzImage) $B$,(B $B$"$j$^$9!#(B


6. $B%G%P%$%9%I%i%$%P!<$N@_Dj(B

$B$5$F!"E83+$5$l$?%+!<%M%kK\BN$G:G=i$K

/*
 *  linux/arch/i386/head.S -- the 32-bit startup code.
 *
 *  Copyright (C) 1991, 1992  Linus Torvalds
 *
 *  Enhanced CPU detection and feature setting code by Mike Jagdis
 *  and Martin Mares, November 1997.
 */

$B!V(B32bit $B%9%?!<%H%"%C%W!W!V6/2=$5$l$?(B CPU $B8!=P$H5!G=@_Dj!W$H$$$C$?(B $BJ8$,JB$s$G$$$^$9!#(B

$B$3$l$b%3%a%s%H$rDI$$$+$1$F$_$^$7$g$&!#(B

 * References to members of the boot_cpu_data structure.

 * swapper_pg_dir is the main page directory, address 0x00101000

 * Set segments to known values

 *      New page tables may be in 4Mbyte page mode and may
 *      be using the global pages. 
 *
 *      NOTE! We have to correct for the fact that we're
 *      not yet offset PAGE_OFFSET..

 * Setup paging (the tables are already set up, just switch them on)

 * Clear BSS first so that there are no surprises...

 * start system 32-bit setup. We need to re-do some of the things done
 * in 16-bit mode for the "real" operations.

 * Initialize eflags.  Some BIOS's leave bits like NT set.  This would
 * confuse the debugger if this code is traced.
 * XXX - best to initialize before switching to protected mode.

 * Copy bootup parameters out of the way. First 2kB of
 * _empty_zero_page is for boot parameters, second 2kB
 * is for the command line.

/* check if it is 486 or 386. */

 * XXX - this does a lot of unnecessary setup.  Alignment checks don't
 * apply at our cpl of 0 and the stack ought to be aligned already, and
 * we don't need to preserve eflags.

$B$I$&$d$i!"%a%b%j!<4IM}%F!<%V%k$d(B CPU $B$N%U%i%C%0@_Dj$J$I$r(B $B9T$J$C$F$$$k$h$&$G$9!#(B

$B$3$N(B head.S $B$O:G8e$K(B start_kernel $B$r

        xorl %eax,%eax
        lldt %ax
        cld                     # gcc2 wants the direction flag cleared at all times
        call SYMBOL_NAME(start_kernel)
L6:
        jmp L6                  # main should never return here, but
                                # just in case, we know what happens.

head.S $B$+$i8F$S=P$5$l$k(B start_kernel $B$O(B init/main.c $B$K$"$j$^$9!#(B $B$3$N%U%!%$%k$NKAF,$K$"$k%3%a%s%H$r0zMQ$7$^$9!#(B

/*
 *  linux/init/main.c
 *
 *  Copyright (C) 1991, 1992  Linus Torvalds
 *
 *  GK 2/5/95  -  Changed to support mounting root fs via NFS
 *  Added initrd & change_root: Werner Almesberger & Hans Lermen, Feb '96
 *  Moan early if gcc is old, avoiding bogus kernels - Paul Gortmaker, May '96
 *  Simplified starting of init:  Michael A. Griffith <[email protected]> 
 */

$BB3$$$F!"(Bstart_kernel $B$N:G=i$NItJ,$G$9!#(B

asmlinkage void __init start_kernel(void)
{
        char * command_line;

#ifdef __SMP__
        static int boot_cpu = 1;
        /* "current" has been set up, we need to load it now */
        if (!boot_cpu)
                initialize_secondary();
        boot_cpu = 0;
#endif

/*
 * Interrupts are still disabled. Do necessary setups, then
 * enable them
 */
        printk(linux_banner);
        setup_arch(&command_line, &memory_start, &memory_end);
        memory_start = paging_init(memory_start,memory_end);
        trap_init();
        init_IRQ();
        sched_init();
        time_init();
        parse_options(command_line);

"linux_banner" $B$H$$$&$N$O(B init/version.c $B$KDj5A$,(B $B$"$j$^$9!#Nc$($P(B ($B$3$l$O;d$,:#;H$C$F$$$k(B 2.0.36 $B$NNc$G$9$,(B)

Linux version 2.0.36 (root@pika) (gcc version 2.7.2.3) #1 Wed Feb 10 21:57:36 JST 1999

$B$H$$$C$?46$8$N$b$N$G$9!#5/F0;~$K$3$N!V%P%J!$BJN,$7$^$9$,!"5/F0;~$K(B BIOS $B$+$i(B $B<}=8$7$?>pJs$r(B ($BB>$N%G%P%$%9%I%i%$%P!<$+$i%"%/%;%9$G$-$k$h$&(B) $B$"$i$?$a$F(B $B@0M}$7$F$$$^$9!#(B"paging_init" $B$O(B arch/i386/mm/setup.c $B$K(B $B$"$j$^$9!#%a%b%j!<%Z!<%8%F!<%V%k$N@_Dj$r9T$J$$$^$9!#(B "trap_init" $B$O(B arch/i386/kernel/traps.c $B$K$"$C$F(B IDT $B%F!<%V%k(B $B$N=i4|2=$r$B$3$N$"$H!"$$$/$D$b=i4|2=%k!<%A%s$r

        kernel_thread(init, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);

$B$KE~C#$7$^$9!#$3$3$G0z?t$H$7$F;XDj$5$l$F$$$k(B "init" $B$O(B $BF1$8(B init/main.c $B$NCf$GDj5A$5$l$F$$$k$b$N$G$9!#(B

static int init(void * unused)
{
        lock_kernel();
        do_basic_setup();

        /*
         * Ok, we have completed the initial bootup, and
         * we're essentially up and running. Get rid of the
         * initmem segments and start the user-mode stuff..
         */
        free_initmem();
        unlock_kernel();

        if (open("/dev/console", O_RDWR, 0) < 0)
                printk("Warning: unable to open an initial console.\n");

        (void) dup(0);
        (void) dup(0);

$B$3$N(B "init" $B$NCf$G8F$S=P$5$l$F$$$k(B lock_kernel $B$O(B SMP $B$N5!3#$K$N$_4X78$9$k$b$N$G$9!#(B

$B$lD4$Y$F$_$?$$$H$3$m(B $B$J$N$G$9$,!":#2s$O;~4V$,L5$/$J$C$F$7$^$C$?$N$G>JN,$7$^$9!#(B

$B$b$76=L#$,$"$l$P!"@'Hs<+J,$GD4$Y$F$_$F2<$5$$!#(B


7. init $B$N5/F0(B

$B>e$N9`L\$G0lIt>R2p$7$?(B init/main.c $B$GDj5A$5$l$F$$$k!"%+!<%M%kFb$N(B "init" $B4X?t$G$9$,!":G8e$O$3$s$JIw$K$J$C$F$$$^$9!#(B

        /*
         * We try each of these until one succeeds.
         *
         * The Bourne shell can be used instead of init if we are 
         * trying to recover a really broken machine.
         */

        if (execute_command)
                execve(execute_command,argv_init,envp_init);
        execve("/sbin/init",argv_init,envp_init);
        execve("/etc/init",argv_init,envp_init);
        execve("/bin/init",argv_init,envp_init);
        execve("/bin/sh",argv_init,envp_init);
        panic("No init found.  Try passing init= option to kernel.");

$B$D$^$j!"$3$3$,(B "man 8 init" $B$K5-:\$5$l$F$$$k(B $B!V%+!<%M%k%V!<%H$N:G8e$N%9%F%C%W!W$H$$$&$o$1$G$9!#(B


8. $BHV30(B: Makefile $B$K$D$$$F(B

$B%+!<%M%k$,%m!<%I$5$l$?;~$K!"$I$N%U%!%$%k$KF~$C$F$$$k%3!<%I$,(B $B$B$^$:%H%C%W%G%#%l%/%H%j$N(B Makefile $B$K$O!"

include arch/$(ARCH)/Makefile

vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
        $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
                --start-group \
                $(CORE_FILES) \
                $(FILESYSTEMS) \
                $(NETWORKS) \
                $(DRIVERS) \
                $(LIBS) \
                --end-group \
                -o vmlinux
        $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map

$B:#2s$NOC$G$O(B i386 $B$rA0Ds$H$7$F$$$k$N$G(B "arch/i386/Makefile" $B$r(B $B;2>H$7$F$_$k$H!"(B

HEAD := arch/i386/kernel/head.o arch/i386/kernel/init_task.o

zImage: vmlinux
        @$(MAKEBOOT) zImage

$B$H$$$&5-=R$,8+$D$+$j$^$9!#$3$l$H>e5-$N%H%C%W%G%#%l%/%H%j$N(B Makefile $B$H$+$i!"%H%C%W%G%#%l%/%H%j$N(B vmlinux $B$N@hF,$,(B "arch/i386/kernel/head.o" $B$G$"$k$3$H$,$o$+$j$^$9!#(B $B0lJ}!"%H%C%W%G%#%l%/%H%j$N(B Makefile $B$K$O!"

boot: vmlinux
        @$(MAKE) -C arch/$(ARCH)/boot

$B$3$N5-=R$+$i!"%V!<%H%$%a!<%8$N:n@.$K$D$$$FCN$j$?$1$l$P!"(B "arch/i386/boot" $B%G%#%l%/%H%j$N(B Makefile $B$r(B $BD4$Y$F$_$k$HNI$5$=$&$@!"$H$$$&$3$H$,$o$+$j$^$9!#(B

$B$=$3$G(B "arch/i386/boot" $B%G%#%l%/%H%j$N(B Makefile $B$r(B $B8+$F$_$k$H!"

zImage: $(CONFIGURE) bootsect setup compressed/vmlinux tools/build
        $(OBJCOPY) compressed/vmlinux compressed/vmlinux.out
        tools/build bootsect setup compressed/vmlinux.out $(ROOT_DEV) > zImage

compressed/vmlinux: $(TOPDIR)/vmlinux
        @$(MAKE) -C compressed vmlinux

setup: setup.o
        $(LD86) -s -o $@ $<

setup.o: setup.s
        $(AS86) -o $@ $<

setup.s: setup.S video.S Makefile $(BOOT_INCL) $(TOPDIR)/include/linux/version.h
        $(CPP) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@

bootsect: bootsect.o
        $(LD86) -s -o $@ $<

bootsect.o: bootsect.s
        $(AS86) -o $@ $<

bootsect.s: bootsect.S Makefile $(BOOT_INCL)
        $(CPP) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@

$B$3$3$+$i!"(Bbootsect.S $B$+$i(B bootsect.s $B$,:n@.$5$l!"$5$i$K(B bootsect.o $B$r(B $B7PM3$7$F(B bootsect $B$K$J$k$3$H!"F1$8$/(B setup.S $B$H(B vide.S $B$+$i(B setup.s $B$,(B $B:n@.$5$l!"$5$i$K(B setup.o $B$r7PM3$7$F(B setup $B$K$J$k$3$H$,$o$+$j$^$9!#(B $B$^$?$3$&$7$F$G$-$?(B bootsect $B$H(B setup $B$,$=$l$>$l(B zImage $B%U%!%$%k$N(B $B@hF,$H(B 2 $BHVL\$K3:Ev$9$k$3$H$b$o$+$j$^$9!#(B($B=>$C$F!"%U%m%C%T!<$+$i(B $B%+!<%M%k$r%V!<%H$9$k$H:G=i$K(B bootsect.S $B$N%3!<%I$,$B$=$7$F$5$i$K!"(Barch/i386/boot/compressed/Makefile $B$r8+$k$H(B $B0J2<$N5-=R$,$"$j$^$9!#(B

HEAD = head.o
SYSTEM = $(TOPDIR)/vmlinux

OBJECTS = $(HEAD) misc.o

vmlinux: piggy.o $(OBJECTS)
        $(LD) $(ZLINKFLAGS) -o vmlinux $(OBJECTS) piggy.o

head.o: head.S $(TOPDIR)/include/linux/tasks.h
        $(CC) $(AFLAGS) -traditional -c head.S

piggy.o:        $(SYSTEM)
        tmppiggy=_tmp_$$$$piggy; \
        rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \
        $(OBJCOPY) $(SYSTEM) $$tmppiggy; \
        gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \
        echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \
        $(LD) -m elf_i386 -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-i386 -T $$tmppiggy.lnk; \
        rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk

$B$3$l$+$i!"(Bcompressed/vmlinux $B$N@hF,$O(B head.S $B$N%3!<%I$G$"$k$3$H$,(B $B$o$+$j$^$9!#(B

$B0J>e$N$3$H$r$^$H$a$k$H(B

  1. arch/i386/boot/bootsect.S ($B%U%m%C%T!<%V!<%H;~!":G=i$K
  2. arch/i386/boot/setup.S (+ video.S)
  3. arch/i386/boot/compressed/head.S (+ misc.c)
  4. arch/i386/kernel/head.S

$B$H$$$&$3$H$K$J$j$^$9!#(B


9. $B=*$o$j$K(B

9.1 $B$*4j$$(B

$B$H$j$"$($:$J$s$H$+$^$H$a$F$_$^$7$?$,!"$J$K$V$s!";d$b$^$@$^$@(B $BCN$i$J$$$3$H$,$?$/$5$s$"$j$^$9!#$3$3$K=q$$$?Cf$K$b4V0c$$$,(B $B$"$k$+$b$7$l$^$;$s!#(B $B$b$72~NI$N$?$a$N%"%I%P%$%9$r$*;}$A$G$7$?$i!"@'Hs65$($F$/$@$5$$!#(B $B$h$m$7$/$*4j$$$7$^$9!#(B

9.2 $B$3$NJ8=q$NG[I[$K$D$$$F(B

 copyrighted (c) 1999 Taketoshi Sano

$B$3$NJ8=q$O(B GNU $B%Q%V%j%C%/%i%$%;%s%9(B (GPL) $B%P!<%8%g%s(B 2 $B$+$=$l0J9_(B $B$N>r7o!"$"$k$$$OI8=`E*$J(B Linux $B%I%-%e%a%s%H%W%m%8%'%/%H(B (LDP) $B$N>r7o$K(B $B4p$E$$$?G[I[$J$i$P<+M3$K$7$F$$$?$@$$$F$+$^$$$^$;$s!#$3$l$i$N%i%$%;%s%9(B $B$O$3$N%I%-%e%a%s%H$,F~r7o$O(B ($BK]Lu$r$N$>$/(B) $B$$$+$J$k=$@5$b5v2D$7$F$$$^$;$s!#=$@5$5$l$?%P!<%8%g%s$O(B GPL $B$N4p$G$N$_G[I[$5$l$k$b$N$H$9$k$3$H$,2DG=$G$9!#(B


sgml21html conversion date: Wed Feb 23 10:56:21 JST 2000