※x86_64環境でgrub2をビルド出来たので、以下は不要になった。
(2010.10.3)

CLFS x86(32bit)

grubがx86_64環境でビルドできないみたいなので、レスキュー環境の意味も込めてx86_64→i386のクロスコンパイルで32ビット環境を作ってみる。

以下のような皮算用があり、CLFSの1.0.0, 1.1.0, 開発版からつまみ食いして構築する予定。

準備

ホスト環境のe2fsprogsを新しくして、ext4で/clfs用のパーティションを作成する。 永らくJFSを使っているので、lost+foundディレクトリが懐かしい。

sed-4.1.5は、eglibc-2.10.1のヘッダと関数名が衝突したので、sed-4.2を使用。

tar-1.22を使用。

e2fsprogs-1.41.6を使用。
(2009.6.27)

grubのコンパイルに失敗する。

if i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I..  -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 -DUSE_MD5_PASSWORDS=1 -DSUPPORT_HERCULES=1 -DSUPPORT_SERIAL=1  -I../stage2 -I../stage1 -I../lib -Wall -Wmissing-prototypes -Wunused -Wshadow -Wpointer-arith -falign-jumps=1 -falign-loops=1 -falign-functions=1 -Wundef -O2 -g -MT asmstub.o -MD -MP -MF ".deps/asmstub.Tpo" -c -o asmstub.o asmstub.c; \
        then mv -f ".deps/asmstub.Tpo" ".deps/asmstub.Po"; else rm -f ".deps/asmstub.Tpo"; exit 1; fi
asmstub.c: In function 'grub_stage2':
asmstub.c:160: error: 'MAP_32BIT' undeclared (first use in this function)
asmstub.c:160: error: (Each undeclared identifier is reported only once
asmstub.c:160: error: for each function it appears in.)
make[2]: *** [asmstub.o] Error 1
make[2]: Leaving directory `/home/clfs/work/grub-0.97/grub'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/clfs/work/grub-0.97'
make: *** [all] Error 2

grub/asmstub.cに追記して、コンパイルできた。

#include <asm/mman.h>

ブート時に、カーネルの伸長でcrc errorが出る。
(2009.6.28)

起動できるカーネルができた。Linux-2.30.1だが、何が決め手だったのかわからない。
(2009.7.4)

/dev/sdbにgrubをセットアップする。

現環境で。

mount /dev/sdb1 /mnt
cp -a /boot/* /mnt
cp -a /clfs/usr/lib/grub/i386-pc/* /mnt/grub/

新環境で。

grub

root (hd1,0)
setup (hd1)

BIOSでSATA2のHDDを優先にすると、新しい方のGRUBで起動しているようにみえる。 そのまま起動してもデバイス名が入れ替わってぐちゃぐちゃな気がするので、この先は保留。