U-Bootで使える初代玄箱(無印)の2.6.25.20Linuxカーネルを作成する。
まずは、コンパイルに必要なプログラムをインストール。
KURO-BOX:/usr/src# aptitude install patch
KURO-BOX:/usr/src# aptitude install libncurses-dev
KURO-BOX:/usr/src# aptitude install bzip2
KURO-BOX:/usr/src# aptitude install module-init-tools
次に、ソースのダウンロードして、解凍する。
KURO-BOX:/usr/src# wget http://www.genbako.com/kurobox-sources-2.6.25.patch
KURO-BOX:/usr/src# wget http://www.genbako.com/kurobox-section-mismatch2625.patch
KURO-BOX:/usr/src# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.25.20.tar.bz2
KURO-BOX:/usr/src# tar -jxpvf linux-2.6.25.20.tar.bz2
次に、パッチを当てる。
KURO-BOX:/usr/src# cd linux-2.6.25.20
KURO-BOX:/usr/src/linux-2.6.25.20# patch -Np1 < ../kurobox-section-mismatch2625.patch
KURO-BOX:/usr/src/linux-2.6.25.20# patch -Np1 < ../kurobox-sources-2.6.25.patch
次に、前準備を行う。
KURO-BOX:/usr/src/linux-2.6.25.20# export ARCH=ppc
KURO-BOX:/usr/src/linux-2.6.25.20# cp config_kurobox .config
KURO-BOX:/usr/src/linux-2.6.25.20# make oldconfig
ここで大事なカーネル設定を行う。
KURO-BOX:/usr/src/linux-2.6.25.20# make menuconfig
Networking > Networking options
<*> Packet socket
[*] Packet socket: mmapped IO
<*> Unix domain sockets
< > Transformation user configuration interface
[ ] Transformation sub policy support (EXPERIMENTAL)
[ ] Transformation migrate database (EXPERIMENTAL)
[ ] Transformation statistics (EXPERIMENTAL)
<M> PF_KEY sockets
[ ] PF_KEY MIGRATE (EXPERIMENTAL) (NEW)
[*] TCP/IP networking
[*] IP: multicasting
[*] IP: advanced router
Choose IP: FIB lookup algorithm (choose FIB_HASH if unsurx x
[*] IP: policy routing
[ ] IP: equal cost multipath (NEW)
[ ] IP: verbose route monitoring (NEW)
[ ] IP: kernel level autoconfiguration
<M> IP: tunneling
<M> IP: GRE tunnels over IP
[*] IP: broadcast GRE over IP
[*] IP: multicast routing
[*] IP: PIM-SM version 1 support
[*] IP: PIM-SM version 2 support
[ ] IP: ARP daemon support (EXPERIMENTAL)
[ ] IP: TCP syncookie support (disabled per default)
<M> IP: AH transformation
<M> IP: ESP transformation
<M> IP: IPComp transformation
<*> IP: IPsec transport mode
<*> IP: IPsec tunnel mode
<*> IP: IPsec BEET mode
< > Large Receive Offload (ipv4/tcp)
<*> INET: socket monitoring interface
[ ] TCP: advanced congestion control --->
[*] TCP: MD5 Signature Option support (RFC2385) (EXPERIMENTAL)
< > IP virtual server support (EXPERIMENTAL) (NEW) --->
< > The IPv6 protocol
[ ] Security Marking
[*] Network packet filtering framework (Netfilter) --->
[*] Network packet filtering debugging
[*] Advanced netfilter configuration (NEW)
[*] Bridged IP/ARP packets filtering (NEW)
Core Netfilter Configuration --->
<M> Netfilter NFQUEUE over NFNETLINK interface
<M> Netfilter LOG over NFNETLINK interface
<M> Netfilter connection tracking support
-*- Connection tracking flow accounting
-*- Connection mark tracking support
[*] Connection tracking events
<M> SCTP protocol connection tracking support (EXPERIMENTAL)
<M> UDP-Lite protocol connection tracking support
<M> Amanda backup protocol support
<M> FTP protocol support
<M> H.323 protocol support
<M> IRC protocol support
<M> NetBIOS name service protocol support
<M> PPtP protocol support
<M> SANE protocol support (EXPERIMENTAL)
<M> SIP protocol support
<M> TFTP protocol support
<M> Connection tracking netlink interface
{M} Netfilter Xtables support (required for ip_tables)
<M> "CLASSIFY" target support
<M> "CONNMARK" target support
<M> "DSCP" and "TOS" target support
<M> "MARK" target support
<M> "NFQUEUE" target Support
<M> "NFLOG" target support
<M> "NOTRACK" target support
-M- "RATEEST" target support
<M> "TRACE" target support
<M> "TCPMSS" target support
<M> "TCPOPTSTRIP" target support (EXPERIMENTAL)
<M> "comment" match support
<M> "connbytes" per-connection counter match support
<M> "connlimit" match support"
<M> "connmark" connection mark match support
<M> "conntrack" connection tracking match support
<M> "dccp" protocol match support
<M> "dscp" and "tos" match support
<M> "esp" match support
<M> "helper" match support
<M> "iprange" address range match support
<M> "length" match support
<M> "limit" match support
<M> "mac" address match support
<M> "mark" match support
<M> "owner" match support
<M> IPsec "policy" match support
<M> "multiport" Multiple port match support
<M> "physdev" match support
<M> "pkttype" packet type match support
<M> "quota" match support
<M> "rateest" match support
<M> "realm" match support
<M> "sctp" protocol match support (EXPERIMENTAL)
<M> "state" match support
<M> "statistic" match support
<M> "string" match support
<M> "tcpmss" match support
<M> "time" match support
<M> "u32" match support
<M> "hashlimit" match support
IP: Netfilter Configuration --->
<M> IPv4 connection tracking support (required for NAT)
[*] proc/sysctl compatibility with old connection tracking (NEW)
<M> IP Userspace queueing via NETLINK (OBSOLETE)
<M> IP tables support (required for filtering/masq/NAT)
<M> "recent" match support
<M> "ecn" match support
<M> "ah" match support
<M> "ttl" match support
<M> "addrtype" address type match support
<M> Packet filtering
<M> REJECT target support
<M> LOG target support
<M> ULOG target support
<M> Full NAT
<M> MASQUERADE target support
<M> REDIRECT target support
<M> NETMAP target support
<M> Basic SNMP-ALG support
<M> Packet mangling
<M> ECN target support
<M> TTL target support
<M> CLUSTERIP target support (EXPERIMENTAL)
<M> raw table support (required for NOTRACK/TRACE)
<M> ARP tables support
<M> ARP packet filtering
<M> ARP payload mangling
Bridge: Netfilter Configuration --->
<M> Ethernet Bridge tables (ebtables) support
<M> ebt: broute table support
<M> ebt: filter table support
<M> ebt: nat table support
<M> ebt: 802.3 filter support
<M> ebt: among filter support
<M> ebt: ARP filter support
<M> ebt: IP filter support
<M> ebt: limit match support
<M> ebt: mark filter support
<M> ebt: packet type filter support
<M> ebt: STP filter support
<M> ebt: 802.1Q VLAN filter support
<M> ebt: arp reply target support
<M> ebt: dnat target support
<M> ebt: mark target support
<M> ebt: redirect target support
<M> ebt: snat target support
<M> ebt: log support
<M> ebt: ulog support (OBSOLETE)
< > The DCCP Protocol (EXPERIMENTAL) --->
< > The SCTP Protocol (EXPERIMENTAL) --->
< > The TIPC Protocol (EXPERIMENTAL) --->
< > Asynchronous Transfer Mode (ATM)
<M> 802.1d Ethernet Bridging
<M> 802.1Q VLAN Support
< > DECnet Support
< > ANSI/IEEE 802.2 LLC type 2 Support
< > The IPX protocol
< > Appletalk protocol support
< > CCITT X.25 Packet Layer (EXPERIMENTAL)
< > LAPB Data Link Driver (EXPERIMENTAL)
< > Acorn Econet/AUN protocols (EXPERIMENTAL)
< > WAN router
[ ] QoS and/or fair queueing --->
Network testing --->
Networking > Wireless
{*} Improved wireless configuration API
[*] nl80211 new netlink interface support (NEW)
-*- Wireless extensions
<M> Generic IEEE 802.11 Networking Stack (mac80211)
Rate control algorithm selection --->
[ ] Enable packet alignment debugging (NEW)
[ ] Enable debugging output (NEW)
{M} Generic IEEE 802.11 Networking Stack (DEPRECATED)
[ ] Enable full debugging output (NEW)
-M- IEEE 802.11 WEP encryption (802.1x)
< > IEEE 802.11i CCMP support (NEW)
< > IEEE 802.11i TKIP encryption (NEW)
< > Software MAC add-on to the IEEE 802.11 networking stack (NEW)
Device Drivers > Networking device support
[ ] Netdevice multiple hardware queue support
<M> Dummy net driver support
< > Bonding driver support
< > MAC-VLAN support (EXPERIMENTAL)
< > EQL (serial line load balancing) support
<M> Universal TUN/TAP device driver support
< > Virtual ethernet pair device
< > ARCnet support --->
< > PHY Device support and infrastructure --->
[*] Ethernet (10 or 100Mbit) --->
[*] Ethernet (1000 Mbit) --->
[ ] Ethernet (10000 Mbit) --->
[ ] Token Ring driver support --->
Wireless LAN --->
[ ] Wireless LAN (pre-802.11)
[*] Wireless LAN (IEEE 802.11)
< > Intel PRO/Wireless 2100 Network Connection (NEW)
< > Intel PRO/Wireless 2200BG and 2915ABG Network Connection (NEW)
< > Marvell 8xxx Libertas WLAN driver support (NEW)
< > Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards (NEW)
<M> Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)
< > Hermes in PLX9052 based PCI adaptor support (Netgear MA30
< > Hermes in TMD7160 based PCI adaptor support (NEW)
< > Nortel emobility PCI adaptor support (NEW)
< > Prism 2.5 PCI 802.11b adaptor support (NEW)
< > Atmel at76c50x chipset 802.11b support (NEW)
< > Intersil Prism GT/Duette/Indigo PCI/Cardbus (NEW)
<M> USB ZD1201 based Wireless device support
< > Wireless RNDIS USB support (NEW)
< > Realtek 8180/8185 PCI support (NEW)
<M> Realtek 8187 USB support
< > ADMtek ADM8211 support (NEW)
< > Softmac Prism54 support (NEW)
< > Atheros 5xxx wireless cards support (NEW)
< > Intel Wireless WiFi 4965AGN (NEW)
< > Intel PRO/Wireless 3945ABG/BG Network Connection (NEW)
<M> IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP)
[*] Support downloading firmware images with Host AP driver
[*] Support for non-volatile firmware download
< > Host AP driver for Prism2/2.5/3 in PLX9052 PCI adaptors
< > Host AP driver for Prism2.5 PCI adaptors (NEW)
< > Broadcom 43xx wireless support (mac80211 stack) (NEW)
< > Broadcom 43xx-legacy wireless support (mac80211 stack) (NEW)
<M> ZyDAS ZD1211/ZD1211B USB-wireless support
[*] ZyDAS ZD1211 debugging
< > Ralink driver support (NEW)
USB Network Adapters --->
< > USB CATC NetMate-based Ethernet device support (EXPERIMENTAL)
< > USB KLSI KL5USB101-based ethernet device support
< > USB Pegasus/Pegasus-II based ethernet device support
<M> USB RTL8150 based ethernet device support (EXPERIMENTAL)
< > Multi-purpose USB Networking Framework
[ ] Wan interfaces support --->
[ ] FDDI driver support
[ ] HIPPI driver support (EXPERIMENTAL)
< > PPP (point-to-point protocol) support
< > SLIP (serial line) support
[ ] Fibre Channel driver support
< > Network console logging support (EXPERIMENTAL)
とりあえず、iptable、IPsec、マルチキャスト、IPIP/GRE トンネル、Dummy インタフェース、ブリッジング、802.1Q VLANとUSB無線LANのいくつかを有効にして設定を保存。
そしてついにコンパイル。ここでuImageを作成します。
KURO-BOX:/usr/src/linux-2.6.25.20# make uImage
scripts/kconfig/conf -s arch/ppc/Kconfig
CHK include/linux/version.h
UPD include/linux/version.h
CHK include/linux/utsrelease.h
UPD include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-ppc
CC arch/ppc/kernel/asm-offsets.s
~省略~
LD .tmp_vmlinux2
KSYM .tmp_kallsyms2.S
AS .tmp_kallsyms2.o
LD vmlinux
SYSMAP System.map
SYSMAP .tmp_System.map
OBJCOPY arch/ppc/boot/images/vmlinux.bin
GZIP arch/ppc/boot/images/vmlinux.gz
UIMAGE arch/ppc/boot/images/uImage
Image Name: Linux-2.6.25.20-kurobox
Created: Sat Jul 2 21:40:24 2011
Image Type: PowerPC Linux Kernel Image (gzip compressed)
Data Size: 1460604 Bytes = 1426.37 kB = 1.39 MB
Load Address: 0x00000000
Entry Point: 0x00000000
Image: arch/ppc/boot/images/uImage is ready
無事にuImageが作成できたので続けて、モジュールの作成とインストール
KURO-BOX:/usr/src/linux-2.6.25.20# make modules
KURO-BOX:/usr/src/linux-2.6.25.20# make modules_install
作成しuImageを格納するために既存のものをバックアップする
KURO-BOX:/usr/src/linux-2.6.25.20# cd /boot
KURO-BOX:/boot# ls -la
drwxr-xr-x 3 root root 4096 2011-06-26 22:35 .
drwxr-xr-x 21 root root 4096 2011-04-10 05:23 ..
-rw-r--r-- 1 tmp-kun tmp-kun 31064 2008-05-04 22:18 .config
-rw-r--r-- 1 root root 718574 2011-06-26 18:20 System.map
-rw-r--r-- 1 root root 1465831 2011-06-26 22:01 uImage
lrwxrwxrwx 1 tmp-kun tmp-kun 6 2011-04-10 05:25 vmlinux.UBoot -> uImage
-rwxr-xr-x 1 tmp-kun tmp-kun 3063942 2008-05-04 22:18 vmlinux.bin
KURO-BOX:/boot# mv System.map System.map.org
KURO-BOX:/boot# mv uImage uImage.org
作成したuImageとコピーする。
KURO-BOX:/boot# cp -p /usr/src/linux-2.6.25.20/arch/ppc/boot/images/uImage /boot
KURO-BOX:/boot# cp -p /usr/src/linux-2.6.25.20/System.map /boot
最終的にはこんな感じ
KURO-BOX:/boot# ls -la
drwxr-xr-x 3 root root 4096 2011-06-26 22:35 .
drwxr-xr-x 21 root root 4096 2011-04-10 05:23 ..
-rw-r--r-- 1 tmp-kun tmp-kun 31064 2008-05-04 22:18 .config
-rw-r--r-- 1 root root 718574 2011-06-26 18:20 System.map
-rw-r--r-- 1 tmp-kun tmp-kun 694437 2008-05-04 22:18 System.map.org
-rw-r--r-- 1 root root 1465831 2011-06-26 22:01 uImage
-rw-r--r-- 1 tmp-kun tmp-kun 1432414 2008-05-04 22:18 uImage.org
lrwxrwxrwx 1 tmp-kun tmp-kun 6 2011-04-10 05:25 vmlinux.UBoot -> uImage
-rwxr-xr-x 1 tmp-kun tmp-kun 3063942 2008-05-04 22:18 vmlinux.bin
これで、再起動後、起動確認。
KURO-BOX:~# uname -a
Linux KURO-BOX 2.6.25.20-kurobox #3 Sun Jun 26 21:59:59 JST 2011 ppc GNU/Linux
カーネルのバージョンが更新されていることを確認する