とても安定した FreeBSD です。恐らく、現在最も安定したリリースの1つでしょう! ということで、ここでは 4.11-RELEASEにセキュリティパッチを当てた 4.11-RELEASE-p17を対象に進めていきます。 なお、コンパイル済み SMPカーネルを公開していますので、インストールするだけならカーネルを作る必要はありません。インストール方法をご覧ください。
野首さんが、SMP化パッチを公開されています。
パッチ作成の努力に感謝しつつ、ありがたく使いましょう。
FreeBSD Info (NOKUBI Hirotaka)
http://www.ff.iij4u.or.jp/~nokubi/
5.0-current, 5.0-RELEASEのパッチしか公開されていませんが、4.11-RELEASE-p17でも、ほぼそのまま適用できます(後述)。
あらかじめ FreeBSD 4.11-RELEASEのインストールされたマシンを用意してください。i386 or PC98版であれば大丈夫です。他の機種では試したことがないので、よく分かりません
野首さんの SMPパッチ (smp_pc98-2003_03_30-5.0-RELEASE.diff.gz) を入手してください。
パッチを当てます。
# cd /usr/src/sys # gunzip smp_pc98-2003_03_30-5.0-RELEASE.diff.gz # patch -p < smp_pc98-2003_03_30-5.0-RELEASE.diff
apic_vector.s を書き換えます。
詳細は FreeBSD98-testersメーリングリストの 5495をご覧ください。同じく野首さんが、パッチについて投稿しています。ここで改めて野首さんに敬意と感謝の意を表したいと思います。ありがとうございました m(__)m
# vi /usr/src/sys/i386/isa/apic_vector.s
132行目付近に、以下の /* HN2 */ のコメントの行を追加してください。
126:#define UNMASK_IRQ(irq_num) \ 127: IMASK_LOCK ; /* into critical reg */ \ 128: testl $IRQ_BIT(irq_num), _apic_imen ; \ 129: je 7f ; /* bit clear, not masked */ \ 130: andl $~IRQ_BIT(irq_num), _apic_imen ;/* clear mask bit */ \ 131: movl IOAPICADDR(irq_num),%ecx ; /* ioapic addr */ \ 132: orl %ecx, %ecx ; /* HN2 */ \ 133: je 7f ; /* HN2 */ \ 134: movl REDIRIDX(irq_num), %eax ; /* get the index */ \ 135: movl %eax,(%ecx) ; /* write the index */ \ 136: movl IOAPIC_WINDOW(%ecx),%eax ; /* current value */ \ 137: andl $~IOART_INTMASK,%eax ; /* clear the mask */ \ 138: movl %eax,IOAPIC_WINDOW(%ecx) ; /* new value */ \ 139:7: ; \ 140: IMASK_UNLOCK
パッチを当てたソースコードは、以下からダウンロードできます。4.11-RELEASE-p16のソースコードまるごとです。
ftp://rs20.nextfoods.jp/pub/FreeBSD-PC98/tars/src.4.11-p16.smp.tgz
カーネルコンフィグを書き換えましょう。以下は、インストール用のカーネル(フロッピーディスクに収まるように、余計なデバイスを除いたカーネル)を作る例です。GENERICを Rv20/Rs20, RvII26/RsII26向けに書き換えています。
以下のカーネルコンフィグでは、標準構成以外のデバイス(例えば、UIDE-133/98-Aなど)は認識しません。追加で使いたいデバイスがあるときは、適宜コメントを外してカーネルに組み込みましょう。フロッピーディスクの容量は小さいので、あまりにもたくさんのデバイスを組み込むとインストールディスクに収まりません。インストール時は、ディスクデバイスやネットワークデバイスなどの最小限のみを組み込み、インストール後にキチンとしたカーネルを作ることをお勧めします。
# vi /usr/src/sys/pc98/conf/GENERIC
# # GENERIC -- Generic kernel configuration file for FreeBSD/pc98 # # For more information on this file, please read the handbook section on # Kernel Configuration Files: # # http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html # # The handbook is also available locally in /usr/share/doc/handbook # if you've installed the doc distribution, otherwise always see the # FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the # latest information. # # An exhaustive list of options and more detailed explanations of the # device lines is also present in the ./LINT configuration file. If you are # in doubt as to the purpose or necessity of a line, check first in LINT. # # $FreeBSD: src/sys/pc98/conf/GENERIC,v 1.142.2.37 2004/12/08 22:33:11 rsm Exp $ machine pc98 cpu I686_CPU ident GENERIC maxusers 0 #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols options PC98 #PC98 #options MATH_EMULATE #Support for x87 emulation options INET #InterNETworking #options INET6 #IPv6 communications protocols options FFS #Berkeley Fast Filesystem options FFS_ROOT #FFS usable as root device [keep this!] options SOFTUPDATES #Enable FFS soft updates support options UFS_DIRHASH #Improve performance on big directories options MFS #Memory Filesystem options MD_ROOT #MD is a potential root device options NFS #Network Filesystem options NFS_ROOT #NFS usable as root device, NFS required options MSDOSFS #MSDOS Filesystem options CD9660 #ISO 9660 Filesystem options CD9660_ROOT #CD-ROM usable as root, CD9660 required options PROCFS #Process filesystem options COMPAT_43 #Compatible with BSD 4.3 [KEEP THIS!] options SCSI_DELAY=15000 #Delay (in ms) before probing SCSI options EPSON_BOUNCEDMA #use bounce buffer for 15-16M #options EPSON_MEMWIN #EPSON memory window support options UCONSOLE #Allow users to grab the console options LINE30 options USERCONFIG #boot -c editor options VISUAL_USERCONFIG #visual boot -c editor options KTRACE #ktrace(1) support options SYSVSHM #SYSV-style shared memory options SYSVMSG #SYSV-style message queues options SYSVSEM #SYSV-style semaphores options P1003_1B #Posix P1003_1B real-time extensions options _KPOSIX_PRIORITY_SCHEDULING options ICMP_BANDLIM #Rate limit bad replies # To make an SMP kernel, the next two are needed options SMP # Symmetric MultiProcessor Kernel options APIC_IO # Symmetric (APIC) I/O device isa device pci # Floppy drives device fdc0 at isa? port IO_FD1 irq 11 drq 2 device fd0 at fdc0 drive 0 device fd1 at fdc0 drive 1 device fd2 at fdc0 drive 2 device fd3 at fdc0 drive 3 # IDE controller and disks device wdc0 at isa? port IO_WD1 irq 9 device wd0 at wdc0 drive 0 device wd1 at wdc0 drive 2 device wd2 at wdc0 drive 1 device wd3 at wdc0 drive 3 # ATAPI devices on wdc device wcd #IDE CD-ROM #device wfd #IDE Floppy (e.g. LS-120) #device wst #IDE Tape (e.g. Travan) # SCSI Controllers device adv device ahc # AHA2940 and onboard AIC7xxx devices #device amd # AMD 53C974 (Tekram DC-390(T)) #device isp # Qlogic family #device ncr # NCR/Symbios Logic #device sym # NCR/Symbios Logic (newer chipsets) #options SYM_SETUP_LP_PROBE_MAP=0x40 # Allow ncr to attach legacy NCR devices when # both sym and ncr are configured # PC-9801-100 #device aic0 at isa? port 0x1840 irq 5 flags 0x10000 # # WD33C93 SCSI card (55/92 like board) # #options BS_TARG_SAFEMODE # PC-9801-92 #device bs0 at isa? port IO_SCSI irq 5 drq 3 flags 0 # SC-98 # device bs0 at isa? port IO_SCSI irq 5 drq 3 flags 0x10000 # HA-55BS2 and later #device bs0 at isa? port IO_SCSI irq 5 drq 3 flags 0x20000 # ELECOM type #device bs0 at isa? port IO_SCSI irq 5 drq 3 flags 0x30000 # SMIT #device bs0 at isa? port IO_SCSI irq 5 drq 3 iomem 0xdd000 iosiz 0x1000 flags 0x40000 # Logitec LHA-20x #device bs0 at isa? port IO_SCSI irq 5 drq 3 flags 0x50000 # # host adapter using WD33C93[ABC] chip (C bus) # #device ct0 at isa? # GENERIC #device ct0 at isa? flags 0x10000 # SC98 #device ct0 at isa? flags 0x20000 # TEXA #device ct0 at isa? flags 0x30000 # ELECOM #device ct0 at isa? iomem 0xdc000 flags 0x40000 # SMIT #device ct0 at isa? flags 0x50000 # LOGITEC #device ncv # NCR 53C500 #device nsp # Workbit Ninja SCSI-3 #device stg # TMC 18C30/18C50 # SCSI peripherals device scbus # SCSI bus (required) device da # Direct Access (disks) device sa # Sequential Access (tape etc) device cd # CD device pass # Passthrough device (direct SCSI access) # keyboard driver device pckbd0 at isa? port IO_KBD irq 1 #options KBD_INSTALL_CDEV device gdc0 at isa? # splash screen/screen saver pseudo-device splash # syscons is the default console driver, resembling an SCO console device sc0 at isa? # Floating point support - do not disable. device npx0 at nexus? port IO_NPX irq 8 # Power management support (see LINT for more options) #device apm0 at nexus? disable flags 0x20 # Advanced Power Management #device pmc0 at isa? port 0x8f0 #device canbus #device canbepm # PCCARD (PCMCIA) support #device card #device pcic0 at isa? irq 0 port 0x3e0 # Serial (COM) ports # options COM_MULTIPORT # # COM1 device sio0 at isa? port IO_COM1 irq 4 # COM2 (2nd CCU) device sio1 at isa? port 0x238 irq 5 flags 0x12000000 # PC-9861K, PC-9801-101, MDC-926Rs #device sio1 at isa? port IO_COM2 irq 5 flags 0x01000000 #device sio2 at isa? port IO_COM3 irq 6 flags 0x02000000 # PC-9801-120 (PnP off) #device sio1 at isa? port 0x8b0 irq 5 flags 0x11000000 # MC-16550II, MC-RS98 #device sio1 at isa? port 0xd2 irq 5 flags 0x14000101 #device sio2 at isa? port 0x8d2 flags 0x14000101 # RSB-2000, RSB-3000, B98-02 #device sio1 at isa? port 0xb0 flags 0x15000101 #device sio2 at isa? port 0xb1 flags 0x15000101 # RSB-384 #device sio1 at isa? port 0xb0 flags 0x16000000 #device sio2 at isa? port 0xb1 flags 0x16000000 # RSA-98III #device sio1 at isa? port 0x50e0 irq 5 flags 0x18000101 #device sio2 at isa? port 0x51e0 flags 0x18000101 # ESP98 #options COM_ESP #device sio1 at isa? port 0x18b0 irq 5 flags 0x19000000 device mse0 at isa? port IO_MSE irq 13 # NEW Parallel port device ppc0 at isa? irq 14 device ppbus # Parallel port bus (required) device lpt # Printer device plip # TCP/IP over parallel device ppi # Parallel port interface device #device vpo # Requires scbus and da # OLD Parallel port # Please stay olpt driver after ppc driver device olpt0 at isa? port IO_LPT # PCI Ethernet NICs. #device de # DEC/Intel DC21x4x (``Tulip'') #device em # Intel PRO/1000 adapter Gigabit Ethernet Card (``Wiseman'') #device txp # 3Com 3cR990 (``Typhoon'') #device vx # 3Com 3c590, 3c595 (``Vortex'') # PCI Ethernet NICs that use the common MII bus controller code. # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support #device dc # DEC/Intel 21143 and various workalikes device fxp # Intel EtherExpress PRO/100B (82557, 82558) #device pcn # AMD Am79C97x PCI 10/100 NICs #device rl # RealTek 8129/8139 #device sf # Adaptec AIC-6915 (``Starfire'') #device sis # Silicon Integrated Systems SiS 900/SiS 7016 #device ste # Sundance ST201 (D-Link DFE-550TX) #device tl # Texas Instruments ThunderLAN #device tx # SMC EtherPower II (83c170 ``EPIC'') #device vr # VIA Rhine, Rhine II #device wb # Winbond W89C840F #device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') #device bge # Broadcom BCM570x (``Tigon III'') # ISA Ethernet NICs. # # DP8390 NIC # 'device ed' requires 'device miibus' # # ed0: generic driver/EtherEZ98 # ed1: LANEED LD-BDN # ed2: EGY-98 # ed3: LGY-98 # ed4: ICM-IF-2766/EN-2298-T # ed5: SIC-98 # ed6: PC-9801-108 # ed7: LA-98 # ed8: C-NET(98) # ed9: C-NET(98)E/L # ed10: EC/EP-98X # ed11: SB-9801 # ed12: NC5098 # #device ed0 at isa? port 0x00d0 irq 6 # EtherEZ98 #device ed0 at isa? port 0x10d0 irq 6 iomem 0xc8000 #device ed5 at isa? port 0x00d0 irq 6 iomem 0xd0000 iosiz 16384 flags 0x600000 # SIU-98-E #device ed5 at isa? port 0x00d0 irq 6 iomem 0xd0000 iosiz 32768 flags 0x610000 #device ed1 at isa? port 0x00d8 irq 6 flags 0x200000 #device ed3 at isa? port 0x00d0 irq 6 flags 0x400000 #device ed4 at isa? port 0x56d0 irq 5 flags 0x500000 #device ed2 at isa? port 0x00d8 irq 6 flags 0x300000 #device ed7 at isa? port 0x00d0 irq 6 flags 0x900000 # PC-9801-77 #device ed7 at isa? port 0x00d0 irq 6 flags 0x910000 #device ed6 at isa? port 0x0770 irq 6 flags 0x800000 #device ed9 at isa? port 0x03d0 irq 6 flags 0xb00000 # C-NET(98)E/L(0x55ED) #device ed9 at isa? port 0x03d0 irq 6 flags 0xb10000 #device ed8 at isa? port 0xa3d0 irq 6 iomem 0xd0000 iosiz 16384 flags 0xa00000 # EN1646 #device ed10 at isa? port 0x00d0 irq 3 flags 0xd00000 #device ed10 at isa? port 0x00d0 irq 3 flags 0xd10000 #device ed11 at isa? port 0x00d0 irq 3 flags 0xe00000 # SN-9801-2 #device ed11 at isa? port 0x00d0 irq 3 flags 0xe00001 #device ed12 at isa? port 0x20d0 irq 3 flags 0xf00000 # # MB86960A NIC # # fe0: RE1000/1000Plus/AccessPC N98C+/LAC-98 # fe1: C-NET(98)P2/C-NET(9N)E # # FE_8BIT_SUPPORT is needed to support LAC-98 # #options FE_8BIT_SUPPORT # LAC-98 support #device fe0 at isa? port 0x00d0 irq 3 #device fe1 at isa? port 0x73d0 irq 5 #device ep #device lnc0 at isa? port 0x03d0 irq 6 #device snc0 at isa? port 0x888 irq 6 iomem 0xc0000 # Xircom Ethernet #device xe # PRISM I IEEE 802.11b wireless NIC. #device awi # WaveLAN/IEEE 802.11 wireless NICs. Note: the WaveLAN/IEEE really # exists only as a PCMCIA device, so there is no ISA attachment needed # and resources will always be dynamically assigned by the pccard code. #device wi # Aironet 4500/4800 802.11 wireless NICs. Note: the declaration below will # work for PCMCIA and PCI cards, as well as ISA cards set to ISA PnP # mode (the factory default). If you set the switches on your ISA # card for a manually chosen I/O address and IRQ, you must specify # those parameters here. #device an # requires PCCARD (PCMCIA) support to be activated #device sn #device snd #device sb0 at isa? port 0x20d2 irq 10 drq 3 #device sbxvi0 at isa? drq 3 #device sbmidi0 at isa? port 0x80d2 #device opl0 at isa? port 0x28d2 #device nss0 at isa? port 0xa460 irq 12 #device mss0 at isa? port 0xf40 irq 12 drq 1 #device mpu0 at isa? port 0xe0d0 irq 6 #device joy0 at isa? port 0x04d2 # The newpcm driver (use INSTEAD of snd0 and all VOXWARE drivers!). # # Windows Sound System #device pcm0 at isa? port 0xf40 irq 12 drq 1 flags 0x10000 # # Sound Blaster 16 (This device need the bridge driver.) #device pcm #device sbc0 at isa? port 0x20d2 irq 10 drq 3 # Pseudo devices - the number indicates how many units to allocate. pseudo-device loop # Network loopback pseudo-device ether # Ethernet support pseudo-device sl 1 # Kernel SLIP pseudo-device ppp 1 # Kernel PPP pseudo-device tun # Packet tunnel. pseudo-device pty # Pseudo-ttys (telnet etc) pseudo-device md # Memory "disks" pseudo-device gif # IPv6 and IPv4 tunneling pseudo-device faith 1 # IPv6-to-IPv4 relaying (translation) # The `bpf' pseudo-device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! pseudo-device bpf #Berkeley packet filter #pseudo-device compat_atdisk #IBM-PC HDD support # USB support #device uhci # UHCI PCI->USB interface #device ohci # OHCI PCI->USB interface #device usb # USB Bus (required) #device ugen # Generic #device uhid # "Human Interface Devices" #device ukbd # Keyboard #device ulpt # Printer #device umass # Disks/Mass storage - Requires scbus and da #device ums # Mouse #device uscanner # Scanners #device urio # Diamond Rio MP3 Player # USB Ethernet, requires mii #device aue # ADMtek USB ethernet #device axe # ASIX Electronics USB ethernet #device cue # CATC USB ethernet #device kue # Kawasaki LSI USB ethernet # FireWire support #device firewire # FireWire bus code #device sbp # SCSI over FireWire (Requires scbus and da) #device fwe # Ethernet over FireWire (non-standard!)
コンパイルですが、その前に /etc/make.conf を確認しましょう。
# vi /etc/make.conf
以下のように設定しておくと、PentiumPro向けに最適化が施されます。また、必要になるのはカーネルだけですので、モジュールをコンパイルしないように設定しておきます。もし、メモリが少ないマシン (64MB以下???) でコンパイルする場合は、-pipeオプションを外しましょう。メモリ不足で、コンパイルに失敗する可能性があります。
CFLAGS = -O2 -pipe -march=pentiumpro COPTFLAGS = -O2 -pipe -march=pentiumpro NO_MODULES = true
コンパイルしましょう。
# cd /usr/src/sys/pc98/conf # config GENERIC # cd ../../compile/GENERIC # make depend # make
コンパイルに成功すれば、以下のように生成されます。
# ls -la kernel -rwxr-xr-x 1 root wheel 2427319 3 24 14:31 kernel
以上のようにして作ったカーネル置いておきます。
ftp://rs20.nextfoods.jp/pub/FreeBSD-PC98/tars/kernel.4.11-p16.inst.smp
FreeBSD(98) 4.11-RELEASEのインストールディスクイメージを書き換えて、SMP対応のインストールディスクを作成します。作業の前に、kern144.flp, mfsroot.flpをダウンロードしておきましょう。
# ls kern144.flp kernel mfsroot.flp
インストールディスク用に、カーネルを gzip圧縮します。
# ls kernel # gzip kernel # ls kernel.gz
ディスクイメージに kernel.gzを書き込みましょう
# vnconfig vn0 kern144.flp # mount /dev/vn0 /mnt # cp kernel.gz /mnt # umount /mnt # vnconfig -u vn0
ディスクイメージを、フロッピーディスクに書き込みましょう。なお、mfsroot.flpは、そののままで大丈夫です。特に書き換える必要はありません。
# dd if=kern144.flp of=/dev/fd0.1440 # dd if=mfsroot.flp of=/dev/fd0.1440
これで、インストールをする準備ができました。以上のようにして作った kern144.flpは、以下からダウンロードできます。
ftp://rs20.nextfoods.jp/pub/FreeBSD-PC98/tars/kern144.smp.flp