*kernel-2.4のサイズ制限 [#a8a0cc78]
カーネル展開後のサイズが0x0020_E000byteより大きい場合、ブートできないという制限がある。~
現状、ReiserFS等の機能をカーネルに組み込もうとすると、すぐにその制限に達してしまう。~
~
liloによってロードされるzImageのアドレスと、カーネルが展開されるアドレスの関係は以下。~
-''0x8c21_0000'' … (1)liloでロードされるzImageのアドレス
-''0x8c00_2000'' … (2)zImage自身のコードによってカーネルが展開されるアドレス

サイズ0x0020_E000byteの理由は上記二つの配置アドレス差、(1)-(2)による。~
~
*kernel-2.6の制限はどうなっているか? [#qdb71440]
-''0x8c21_0000'' … (1)liloでロードされるzImageのアドレス
-''0x8c80_0000'' … (2')zImage自身のコードによって再配置されるアドレス
-''0x8c00_2000'' … (2)再配置後、zImage自身のコードによってカーネルが展開されるアドレス~

(2')の再配置処理が追加されており、かつ、概アドレスはリンク時に任意に設定可能であるため、~
サイズ制限は(2')-(1)となり、実使用上存在しないと考えて良い。~
*Kernel-2.4 サイズ制限緩和パッチ [#t49ffdaa]
kernel-2.6のカーネル展開ルーチンを、linux-2.4.21-iodata向けにバックポートしたパッチを次に記す。~
本パッチを適用すると、展開後のカーネルサイズ制限は0x0060_0000まで緩和される。~
#pre{{
diff -ur arch/sh/boot/compressed/Makefile~ arch/sh/boot/compressed/Makefile
--- arch/sh/boot/compressed/Makefile~	2003-10-24 22:24:13.000000000 +0900
+++ arch/sh/boot/compressed/Makefile	2005-06-10 14:55:41.000000000 +0900
@@ -18,7 +18,9 @@
 #
 # ZIMAGE_OFFSET is the load offset of the compression loader
 #
-ZIMAGE_OFFSET = $(shell printf "0x%8x" $$[0x80000000+0x$(CONFIG_MEMORY_START)+0x200000+0x10000])
+ZIMAGE_OFFSET = $(shell printf "0x%8x" $$[0x80000000+0x$(CONFIG_MEMORY_START)+0x800000+0x10000])
+
+
 
 ZLINKFLAGS = -Ttext $(ZIMAGE_OFFSET) $(ZLDFLAGS)
 
diff -ur arch/sh/boot/compressed/head.S~ arch/sh/boot/compressed/head.S
--- arch/sh/boot/compressed/head.S~ 	2003-10-24 22:24:13.000000000 +0900
+++ arch/sh/boot/compressed/head.S	2005-06-10 14:54:10.000000000 +0900
@@ -2,10 +2,12 @@
  *  linux/arch/sh/boot/compressed/head.S
  *
  *  Copyright (C) 1999 Stuart Menefy
+ *  Copyright (C) 2003 SUGIOKA Toshinobu
  */
 
 .text
 
+#include <linux/config.h>
 #include <linux/linkage.h>
 
 	.global	startup
@@ -14,7 +16,54 @@
 	mov.l   init_sr, r1
 	ldc     r1, sr
 
-	/* First clear BSS */
+	/* Move myself to proper location if necessary */
+	mova	1f, r0
+	mov.l	1f, r2
+	cmp/eq	r2, r0
+	bt	clear_bss
+	sub	r0, r2
+	mov.l	bss_start_addr, r0
+	mov	#0xe0, r1
+	and	r1, r0			! align cache line
+	mov.l	text_start_addr, r3
+	mov	r0, r1
+	sub	r2, r1
+3:
+	mov.l	@r1, r4
+	mov.l	@(4,r1), r5
+	mov.l	@(8,r1), r6
+	mov.l	@(12,r1), r7
+	mov.l	@(16,r1), r8
+	mov.l	@(20,r1), r9
+	mov.l	@(24,r1), r10
+	mov.l	@(28,r1), r11
+	mov.l	r4, @r0
+	mov.l	r5, @(4,r0)
+	mov.l	r6, @(8,r0)
+	mov.l	r7, @(12,r0)
+	mov.l	r8, @(16,r0)
+	mov.l	r9, @(20,r0)
+	mov.l	r10, @(24,r0)
+	mov.l	r11, @(28,r0)
+#ifdef CONFIG_CPU_SH4
+	ocbwb	@r0
+#endif
+	cmp/hi	r3, r0
+	add	#-32, r0
+	bt/s	3b
+	 add	#-32, r1
+	mov.l	2f, r0
+	jmp	@r0
+	 nop
+
+	.align 2
+1:	.long	1b
+2:	.long	clear_bss
+text_start_addr:
+	.long	startup
+
+	/* Clear BSS */
+clear_bss:
 	mov.l	end_addr, r1
 	mov.l	bss_start_addr, r2
 	mov	#0, r0
}}
*なぜ、このパッチが必要なの? [#p282b6df]
モジュール化すれば良いではないか?という声も聞こえてきそうですが、~
レスキュー用あるいはテスト用に、様々なデバイスからブート可能なカーネルを作っておきたかったからです。~
例えば、一つのカーネルで、次のような機能が実現可能になる(ハズ)。~

-NFSブート
-RAIDブート … LANDISKでもUSBでDISKを増設すればRAID可能かも。
-ReserFSブート
-USBスティックからブート
-USBシリアルコンソール~
~
*レスキュー用Kernel-2.4 [#d34fcdfb]
-''早速作ってみました''~
http://eggplant.ddo.jp/www/download/debian_iohack_base/renewal.tgz~
kernelイメージ(vmlinuz-2.4.21)とカーネルモジュール、.configを含みます。(ゴミも沢山含みますけど)~
~
-''dmesg''
#pre{{
Linux version 2.4.21 (root@landisk) (gcc version 3.0.4) #1 Sat Jun 11 18:57:56 JST 2005
I-O DATA DEVICE, INC. landisk3 support.
On node 0 totalpages: 16384
zone(0): 16384 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: ro root=301 mem=64M console=ttySC1,9600
Setting GDB trap vector to 0x80000100
CPU clock: 266.81MHz
Bus clock: 133.40MHz
Module clock: 33.35MHz
Interval = 5207
Calibrating delay loop... 266.24 BogoMIPS
Memory: 62268k/65536k available (2005k kernel code, 3268k reserved, 281k data, 72k init)
Dentry cache hash table entries: 8192 (order: 4, 65536 bytes)
Inode cache hash table entries: 4096 (order: 3, 32768 bytes)
Mount cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer-cache hash table entries: 4096 (order: 2, 16384 bytes)
Page-cache hash table entries: 16384 (order: 4, 65536 bytes)
CPU: SH7751R
POSIX conformance testing by UNIFIX
PCI: Using configuration type 1
SH7751R PCI: Finished initialization of the PCI controller
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Allocate Area5/6 success.
Julian Shutdown button driver initialized
Starting kswapd
Journalled Block Device driver loaded
Installing knfsd (copyright (C) 1996 okir_@monad.swb.de).
pty: 256 Unix98 ptys configured
SuperH SCI(F) driver initialized
ttySC0 at 0xffe00000 is a SCI
ttySC1 at 0xffe80000 is a SCIF
Real Time Clock Driver v1.10e
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
loop: loaded (max 8 devices)
8139cp: 10/100 PCI Ethernet driver v0.3.0 (Sep 29, 2002)
PCI: Enabling device Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (0000 -> 0003)
eth0: RTL-8139C+ at 0xfd000000, xx:xx:xx:xx:xx:xx, IRQ 5
eth0: PCI cache line size set incorrectly (0 bytes) by BIOS/FW, correcting to 32
PCI: Setting latency timer of device Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ to 64
Uniform Multi-Platform E-IDE driver Revision: 7.00beta4-2.4
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
AEC6880R: IDE controller at PCI slot 00:01.0
PCI: Enabling device Artop Electronic Corp ATP865 (0005 -> 0007)
AEC6880R: chipset revision 6
AEC6880R: not 100% native mode: will probe irqs later
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
AEC6880R: ROM enabled at 0x23bc0000
    ide0: BM-DMA at 0x4420-0x4427, BIOS settings: hda:pio, hdb:pio
    ide1: BM-DMA at 0x4428-0x442f, BIOS settings: hdc:pio, hdd:pio
hda: SAMSUNG SV1604N, ATA DISK drive
blk: queue 8c276734, I/O limit 4095Mb (mask 0xffffffff)
ide0 at 0x4400-0x4407,0x440a on irq 6
hda: attached ide-disk driver.
hda: host protected area => 1
hda: 312581808 sectors (160042 MB) w/2048KiB Cache, CHS=19457/255/63, UDMA(133)
Partition check:
 hda: hda1 hda2 hda3 hda4
SCSI subsystem driver Revision: 1.00
scsi0 : SCSI host adapter emulation for IDE ATAPI devices
usb.c: registered new driver usbdevfs
usb.c: registered new driver hub
PCI: Enabling device NEC Corporation USB 2.0 (0000 -> 0002)
ehci-hcd 00:02.2: NEC Corporation USB 2.0
ehci-hcd 00:02.2: irq 5, pci mem fd000100
usb.c: new USB bus registered, assigned bus number 1
PCI: 00:02.2 PCI cache line size set incorrectly (0 bytes) by BIOS/FW.
PCI: 00:02.2 PCI cache line size corrected to 32.
ehci-hcd 00:02.2: USB 2.0 enabled, EHCI 1.00, driver 2003-Jan-22
hub.c: USB hub found
hub.c: 5 ports detected
PCI: Enabling device NEC Corporation USB (0000 -> 0002)
PCI: Setting latency timer of device NEC Corporation USB to 64
host/usb-ohci.c: USB OHCI at membase 0xfd001000, IRQ 7
host/usb-ohci.c: usb-00:02.0, NEC Corporation USB
usb.c: new USB bus registered, assigned bus number 2
hub.c: USB hub found
hub.c: 3 ports detected
PCI: Enabling device NEC Corporation USB (#2) (0000 -> 0002)
PCI: Setting latency timer of device NEC Corporation USB (#2) to 64
host/usb-ohci.c: USB OHCI at membase 0xfd002000, IRQ 8
host/usb-ohci.c: usb-00:02.1, NEC Corporation USB (#2)
usb.c: new USB bus registered, assigned bus number 3
hub.c: USB hub found
hub.c: 2 ports detected
Initializing USB Mass Storage driver...
usb.c: registered new driver usb-storage
USB Mass Storage support registered.
md: raid0 personality registered as nr 2
md: raid1 personality registered as nr 3
md: md driver 0.90.0 MAX_MD_DEVS=256, MD_SB_DISKS=27
md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 4096 bind 8192)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
VFS: Mounted root (ext2 filesystem) readonly.
Freeing unused kernel memory: 72k freed
Adding Swap: 265064k swap-space (priority -1)
reiserfs: checking transaction log (device 03:04) ...
Using r5 hash to sort names
ReiserFS version 3.6.25
eth0: link up, 100Mbps, full-duplex, lpa 0x41E1
}}

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS