Creare un kernel customizzato...

skunk-bsd a libero.it skunk-bsd a libero.it
Gio 6 Lug 2006 15:53:26 CEST


Compilare un kernel Custom

Per qualcuno magari sarà una attività banale che si ripete frequentemente…per me, al momento la cosa è meno immediata. Andiamo con ordine…
Dopo aver aggiornato i sorgenti del mio sistema sono poi passato alla costruzione di un kernel diverso dal generic. Mi sono quindi spostato nella dir

/usr/src/sys/i386/conf

ed ho fatto una copia del file GENERIC in un mio nuovo file su cui poter smanettare liberamente. Non ricordandomi una mazza, o quasi, ho editato il file NOTES per prendere qualche spunto. Ora, quello che ho notato è che non c’è molta corrispondenza tra i due files e di fatto il NOTES mi è servito a poco. Ho visto anche l’handbook ma anche le voci riportate al suo in terno non sono le stesse che vedo sul mio GENERIC.
A questo punto dopo essermi letto quanto riportato nel file dmesg.boot (che incollo di seguito).

------------------------------------------------------------
Copyright (c) 1992-2002 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD 4.5-RC3 #0: Wed Jan 23 08:08:22 GMT 2002
    murray a builder.freebsdmall.com:/usr/src/sys/compile/GENERIC
Timecounter "i8254"  frequency 1193182 Hz
CPU: Pentium/P54C (165.92-MHz 586-class CPU)
  Origin = "GenuineIntel"  Id = 0x52c  Stepping = 12
  Features=0x1bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8>
real memory  = 67108864 (65536K bytes)
avail memory = 60608512 (59188K bytes)
Preloaded elf kernel "kernel" at 0xc0496000.
Intel Pentium detected, installing workaround for F00F bug
md0: Malloc disk
npx0: <math processor> on motherboard
npx0: INT 16 interface
pcib0: <Host to PCI bridge> on motherboard
pci0: <PCI bus> on pcib0
isab0: <SiS 85c503 PCI-ISA bridge> at device 1.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <SiS 5591 ATA33 controller> port 0x4000-0x400f,0-0x3,0-0x7,0-0x3,0-0x7 irq 0 at device 1.1 on pci0
ata0: at 0x1f0 irq 14 on atapci0
ata1: at 0x170 irq 15 on atapci0
pci0: <S3 Trio 64V2/DX/GX graphics accelerator> at 16.0 irq 11
rl0: <RealTek 8139 10/100BaseTX> port 0xfc00-0xfcff mem 0xffbdff00-0xffbdffff irq 10 at device 18.0 on pci0
rl0: Ethernet address: 00:40:f4:38:c7:9b
miibus0: <MII bus> on rl0
rlphy0: <RealTek internal media interface> on miibus0
rlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
orm0: <Option ROM> at iomem 0xc0000-0xc7fff on isa0
fdc0: <NEC 765 or clone> at port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on isa0
fd0: <1440-KB 3.5" drive> on fdc0 drive 0
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0
sio0: type 16550A
sio1 at port 0x2f8-0x2ff irq 3 on isa0
sio1: type 16550A
ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0
ppc0: Generic chipset (NIBBLE-only) in COMPATIBLE mode
plip0: <PLIP network interface> on ppbus0
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
ppi0: <Parallel I/O> on ppbus0
ad0: 4112MB <ST34323A> [8912/15/63] at ata0-master WDMA2
ad1: 2014MB <QUANTUM FIREBALL SE2.1A> [4092/16/63] at ata0-slave WDMA2
ata1-master: simplex device, DMA on primary only
acd0: CDROM <HITACHI CDR-7930> at ata1-master using BIOSPIO
Mounting root from ufs:/dev/ad0s1a
------------------------------------------------------------


Ho costruito il mio kernel come segue (sulla base di quanto presente nel file GENERIC):

------------------------------------------------------------
#cpu            I486_CPU
cpu             I586_CPU
#cpu            I686_CPU
ident           GUARDIAN

Quanto riportato di seguito, oltre la compatibilità per vecchie versione di bsd e qualche atra cosa non so assolutamente cosa comporta

# To statically compile in device wiring instead of /boot/device.hints
#hints          "GENERIC.hints"         # Default places to look for devices.

makeoptions     DEBUG=-g                # Build kernel with gdb(1) debug symbols

#options        SCHED_ULE               # ULE scheduler
options         SCHED_4BSD              # 4BSD scheduler
options         PREEMPTION              # Enable kernel thread preemption
options         INET                    # InterNETworking
options         INET6                   # IPv6 communications protocols
options         FFS                     # Berkeley Fast Filesystem
options         SOFTUPDATES             # Enable FFS soft updates support
options         UFS_ACL                 # Support for access control lists
options         UFS_DIRHASH             # Improve performance on big directories
options         MD_ROOT                 # MD is a potential root device
options         NFSCLIENT               # Network Filesystem Client
options         NFSSERVER               # Network Filesystem Server
options         NFS_ROOT                # NFS usable as /, requires NFSCLIENT
options         MSDOSFS                 # MSDOS Filesystem
options         CD9660                  # ISO 9660 Filesystem
options         PROCFS                  # Process filesystem (requires PSEUDOFS)
options         PSEUDOFS                # Pseudo-filesystem framework
options         GEOM_GPT                # GUID Partition Tables.
options         COMPAT_43TTY            # BSD 4.3 TTY compat [KEEP THIS!]
options         COMPAT_FREEBSD4         # Compatible with FreeBSD4
options         COMPAT_FREEBSD5         # Compatible with FreeBSD5
options         SCSI_DELAY=5000         # Delay (in ms) before probing SCSI
options         KTRACE                  # ktrace(1) support
options         SYSVSHM                 # SYSV-style shared memory
options         SYSVMSG                 # SYSV-style message queues
options         SYSVSEM                 # SYSV-style semaphores
options         _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options         KBD_INSTALL_CDEV        # install a CDEV entry in /dev
options         ADAPTIVE_GIANT          # Giant mutex is adaptive.
options         STOP_NMI                # Stop CPUS using NMI instead of IPI

Come sopra per la sezione sottostante

# Debugging for use in -current
options         KDB                     # Enable kernel debugger support.
options         DDB                     # Support DDB.
options         GDB                     # Support remote GDB.
options         INVARIANTS              # Enable calls of extra sanity checking
options         INVARIANT_SUPPORT       # Extra sanity checks of internal structures, required by INVARIANTS
options         WITNESS                 # Enable checks to detect deadlocks and cycles
options         WITNESS_SKIPSPIN        # Don't run witness on spinlocks for speed

# To make an SMP kernel, the next two lines are needed
#options        SMP                     # Symmetric MultiProcessor Kernel
#device         apic                    # I/O APIC

# Bus support.
#device         eisa
device          pci

# Floppy drives
device          fdc

# ATA and ATAPI devices
device          ata
#device         atadisk         # ATA disk drives
#device         ataraid         # ATA RAID drives
#device         atapicd         # ATAPI CDROM drives
#device         atapifd         # ATAPI floppy drives
#device         atapist         # ATAPI tape drives
#options        ATA_STATIC_ID   # Static device numbering

# SCSI Controllers
Non avendo dispositivi scsi sul mio pc quanto riportato qua sotto l’ho commentato per intero

# SCSI peripherals
come sopra

# RAID controllers interfaced to the SCSI subsystem
come sopra

# RAID controllers
Niente raid, ho commentato tutto

# atkbdc0 controls both the keyboard and the PS/2 mouse
device          atkbdc          # AT keyboard controller
#device         atkbd           # AT keyboard
#device         psm             # PS/2 mouse

#device         kbdmux          # keyboard multiplexer

device          vga             # VGA video card driver

#device         splash          # Splash screen and screen saver support

# syscons is the default console driver, resembling an SCO console
device          sc

#device         agp             # support several AGP chipsets

# Power management support (see NOTES for more options)
#device         apm
# Add suspend/resume support for the i8254.
#device         pmtimer

# PCCARD (PCMCIA) support
# PCMCIA and cardbus bridge support
#device         cbb             # cardbus (yenta) bridge
#device         pccard          # PC Card (16-bit) bus
#device         cardbus         # CardBus (32-bit) bus

# Serial (COM) ports
device          sio             # 8250, 16[45]50 based serial ports
#device         uart            # Generic UART driver

# Parallel port
device          ppc
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

# If you've got a "dumb" serial or parallel PCI card that is
# supported by the puc(4) glue driver, uncomment the following
# line to enable it (connects to sio, uart and/or ppc drivers):
#device         puc

# PCI Ethernet NICs.
#device         de              # DEC/Intel DC21x4x (``Tulip'')
#device         em              # Intel PRO/1000 adapter Gigabit Ethernet Card
#device         ixgb            # Intel PRO/10GbE Ethernet Card
#device         le              # AMD Am7900 LANCE and Am79C9xx PCnet
#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         bce             # Broadcom BCM5706/BCM5708 Gigabit Ethernet
#device         bfe             # Broadcom BCM440x 10/100 Ethernet
#device         bge             # Broadcom BCM570xx Gigabit Ethernet
#device         dc              # DEC/Intel 21143 and various workalikes
#device         fxp             # Intel EtherExpress PRO/100B (82557, 82558)
#device         lge             # Level 1 LXT1001 gigabit Ethernet
#device         nge             # NatSemi DP83820 gigabit Ethernet
#device         nve             # nVidia nForce MCP on-board Ethernet Networking
#device         pcn             # AMD Am79C97x PCI 10/100 (precedence over 'le')
#device         re              # RealTek 8139C+/8169/8169S/8110S
device          rl              # RealTek 8129/8139
#device         sf              # Adaptec AIC-6915 (``Starfire'')
#device         sis             # Silicon Integrated Systems SiS 900/SiS 7016
#device         sk              # SysKonnect SK-984x & SK-982x gigabit Ethernet
#device         ste             # Sundance ST201 (D-Link DFE-550TX)
#device         ti              # Alteon Networks Tigon I/II gigabit Ethernet
#device         tl              # Texas Instruments ThunderLAN
#device         tx              # SMC EtherPower II (83c170 ``EPIC'')
#device         vge             # VIA VT612x gigabit Ethernet
#device         vr              # VIA Rhine, Rhine II
#device         wb              # Winbond W89C840F
#device         xl              # 3Com 3c90x (``Boomerang'', ``Cyclone'')

# ISA Ethernet NICs.  pccard NICs included.
#device         cs              # Crystal Semiconductor CS89x0 NIC
# 'device ed' requires 'device miibus'
#device         ed              # NE[12]000, SMC Ultra, 3c503, DS8390 cards
#device         ex              # Intel EtherExpress Pro/10 and Pro/10+
#device         ep              # Etherlink III based cards
#device         fe              # Fujitsu MB8696x based cards
#device         ie              # EtherExpress 8/16, 3C507, StarLAN 10 etc.
#device         sn              # SMC's 9000 series of Ethernet chips
#device         xe              # Xircom pccard Ethernet

# Wireless NIC cards
#device         wlan            # 802.11 support
#device         wlan_wep        # 802.11 WEP support
#device         wlan_ccmp       # 802.11 CCMP support
#device         wlan_tkip       # 802.11 TKIP support
#device         an              # Aironet 4500/4800 802.11 wireless NICs.
#device         ath             # Atheros pci/cardbus NIC's
#device         ath_hal         # Atheros HAL (Hardware Access Layer)
#device         ath_rate_sample # SampleRate tx rate control for ath
#device         awi             # BayStack 660 and others
#device         ral             # Ralink Technology RT2500 wireless NICs.
#device         wi              # WaveLAN/Intersil/Symbol 802.11 wireless NICs.
#device         wl              # Older non 802.11 Wavelan wireless NIC.

# Pseudo devices.
#device         loop            # Network loopback
#device         random          # Entropy device
#device         ether           # Ethernet support
#device         sl              # Kernel SLIP
#device         ppp             # Kernel PPP
#device         tun             # Packet tunnel.
#device         pty             # Pseudo-ttys (telnet etc)
#device         md              # Memory "disks"
#device         gif             # IPv6 and IPv4 tunneling
#device         faith           # IPv6-to-IPv4 relaying (translation)

# The `bpf' device enables the Berkeley Packet Filter.
# Be aware of the administrative consequences of enabling this!
# Note that 'bpf' is required for DHCP.
#device         bpf             # Berkeley packet filter

# USB support
Non avendo nessuna porta usb sul mio pc, quanto indicato qua sotto l’ho commentato tutto

# FireWire support
#device         firewire        # FireWire bus code
#device         sbp             # SCSI over FireWire (Requires scbus and da)
#device         fwe             # Ethernet over FireWire (non-standard!)
------------------------------------------------------------

Rispetto al file in esame il mio pc ha una configurazione decisamente più minimale, infatti, gran parte del suo contenuto l’ho commentato.
Tendenzialmente io compilerei questo file. Prima di farlo però, viste le caratteristiche del mio pc (poco performanti), preferirei lasciarmi un discreto margine di successo :)
Secondo voi ho scritto grosse fesserie??

Grazie,
saluti



Maggiori informazioni sulla lista aiuto