光盘Iso的制作:
一、initrd.gz文件的封装
1)解压光盘
mkdir iso
7z X Debian-5.0.1-amd.iso -o./iso
2)解压initrd.gz
mkdir test && cd test
cp ../iso/install.amd/initrd.gz ./
zcat initrd.gz | cpio -id
rm �Crf initrd.gz
3)添加驱动模块
mkdir -p lib/modules/2.6.26-2-amd64/kernel/drivers/net
mkdir -p lib/modules/2.6.26-2-amd64/kernel/drivers/scsi/megaraid
cp /root/megaraid_sas.ko lib/modules/2.6.26-2-amd64/kernel/drivers/scsi/megaraid/
cp /root/tg3.ko lib/modules/2.6.26-2-amd64/kernel/drivers/net/
4)重新封装initrd.gz
find . | cpio --quiet -H newc -o | gzip -9 -n > ../initrd.gz
cd ../
cp initrd.gz ../iso/install.amd/
二、linux-image软件包的封装:
1)deb包的解压
mkdir tmp
cp iso/pool/main/l/linux-2.6/linux-image-2.6.26-2-amd64_2.6.26-15_amd64.deb tmp/
dpkg -x linux-image-2.6.26-2-amd64_2.6.26-15_amd64.deb tmp/
dpkg -e linux-image-2.6.26-2-amd64_2.6.26-15_amd64.deb tmp/DEBIAN
2)驱动模块的覆盖
cp /root/megaraid_sas.ko tmp/lib/modules/2.6.26-2-amd64/kernel/drivers/scsi/megaraid/
cp /root/tg3.ko tmp/lib/modules/2.6.26-2-amd64/kernel/drivers/net/
3)修改deb包校验信息
vim tmp/DEBIAN/md5sums
9a872ee241a047da620bf23ce4f4f8f0 lib/modules/2.6.26-2-amd64/kernel/drivers/net/tg3.ko
9b6d2789f00f6325a46d4b769d724eb6 lib/modules/2.6.26-2-amd64/kernel/drivers/scsi/megaraid/megaraid_sas.ko
4)deb包的封装
dpkg -b tmp linux-image-2.6.26-2-amd64_2.6.26-15_amd64.deb
cp linux-image-2.6.26-2-amd64_2.6.26-15_amd64.deb iso/pool/main/l/linux-2.6/
三、Packages的修改:
1)修改linux-image软件包的校验信息
cd iso/dists/lenny/main/binary-amd64/
vim Packages
Size: 20952072
MD5sum: 3faa938ae1f97288d1f1d3eb12faf429
SHA1: 1966ba8d97a50f33f1e4a3c51516dfebe08c3192
SHA256: 9d41d5e79d801d0e217429ca1e917454c76f2cb8f43901e6006e189b2da3e121
附:
md5sum linux-image-2.6.26-2-amd64_2.6.26-15_amd64.deb
sha1sum linux-image-2.6.26-2-amd64_2.6.26-15_amd64.deb
sha256sum linux-image-2.6.26-2-amd64_2.6.26-15_amd64.deb
2)生成Packages.gz文件
cat Packages | gzip --best > Packages.gz
四、需要修改的校验文件:
1)修改Packages和Packages.gz的校验信息
vim iso/dists/lenny/Release
c876de397e4f41e8dbba9c31f9e9233b 988964 main/binary-amd64/Packages
89fd3c2d84f55d5e49084a3ad2450335 291966 main/binary-amd64/Packages.gz
2)修改所有文件的校验
vim iso/md5sum.txt
d5f374ae6fbdc374e9d6bf9a5c9e50b7 ./install.amd/initrd.gz
c876de397e4f41e8dbba9c31f9e9233b ./dists/lenny/main/binary-amd64/Packages
89fd3c2d84f55d5e49084a3ad2450335 ./dists/lenny/main/binary-amd64/Packages.gz
96ee92bf6e7c6295d29171261546586a ./dists/lenny/Release
五、封装iso镜像
mkisofs -o debian-5.iso -r -J -no-emul-boot -boot-load-size 4 -boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat iso/