|
发表于 2005-4-12 10:01:00
|
显示全部楼层
fc3, 20050311
http://fedoranews.org/contributors/gene_czarcinski/update_distro/
http://fedoranews.org/contributo ... s-update-distro.pdf
原文的排版很不错, 是 fedora 官方文档的风格
How to update Fedora Core 3 Distribution CDs
by Gene Czarcinski on Feb 27, 2005 (UPDATED 2005-03-11)
The purpose of this document is threefold:
1.
Describe how to update Fedora Core 3 distribution CDs and then create new, updated iso images.
2.
Describe how to create DVD images instead of CD images.
3.
Given an updated distribution, create an updated RescueCD which, optionally, is modified to add additional software.
Some of the information in this document is based on information in Updating and Rebuilding Fedora Core 2 Installation CDs . There is also the currently unmaintained AnacondaDocumentationProject.
While this document describes the process for the i386 distribution, it also applies to the Fedora Core 3 x86_64 distribution and may also be extended to the development tree.
Updating and creating the distribution
Step 1: Preparation
Fedora Core 3 comes with all of the tools necessary to update and rebuild the installation CDs. To perform this does require a fair amount of disk space - approximately 22 GB. Fedora Core 3 is distributed on CD ISO images which total about 4.5 GB. The space requirements are as follows:
1.
Space for the distributed ISO images (4.5 GB).
2.
Space for the expanded installation tree built from the ISO images (4.5 GB). This tree will be updated during the update/rebuild process.
3.
Space for the split trees which will divide the installation tree into ISO image size pieces (4.5 GB).
4.
Space for the updated ISO images (4.5 GB).
5.
Extra working space used during the rebuild process (1 to 3 GB).
Rounding up and being generous results in needing about 2 GB of space. If you rebuild the optional RescueCD, you will need an addition 1 to 2 GB of space.
Although updating and rebuilding the installation CDs could be performed on some other system, we assume this is being done on a Fedora Core 3 system. You will need to install the following packages:
anaconda-10.1.0.2-1
anaconda-help-10.1.0-1
anaconda-runtime-10.1.0.2-1
busybox-anaconda-1.00.rc1-5
Next you need to build the installation tree. All of the following needs to be performed as "root". Assuming that the distributes ISO images are located in another partition, the partition needs to have at least 10 GB of available space (or 15 GB if the new ISO images are to be pleaced there also). In a subdirectory on that partition, execute the following:
export PYTHONPATH=/usr/lib/anaconda
export PATH="$PATH:/usr/lib/anaconda-runtime"
export FCBASE=`pwd`
mkdir -p $FCBASE/fc3/i386
This sets things up. Now do the following:
mount -o ro,loop FC3-i386-disc1.iso /mnt
cp -a /mnt/* $FCBASE/fc3/i386/
umount /mnt/
Then repeat the above for each of the other three ISO binary (i386) images and the four SRPMS ISO images.
Note: If you have the DVD ISO image then you can use it in place of the four binary ISO images. However, you will still need to copy the contents of the four CD SRPMS ISO images.
Note: If you already have an expanded tree which is being used for NFS, etc. installs, then simply copy it.
You have now created the installation tree.
Step 2: Updating
In general, updating a distribution consists of replacing the RPMs and src RPMs with updated versions. You need to make sure you delete the older (replaced) versions. Since the file names will differ between to old and the updated versions of the packages, this can be a lengthy manual process. I am sure that someone has created a script which will remove the older packages and only leave the updated versions.
Caution: A few packages have multiple architectures and you need to be careful not to delete the extra architectures. Specifically on the i386 distribution:
1.
The glibc, nptl, and openssl packages have both i386 and i686 versions of packages.
2.
The kernel and kernel-smp packages have i586 and i686 versions of packages (but no i386).
The x86_64 distribution of Fedora Core 3 contains many packages which have both x86_64 and i386 (or i686 in some case) versions of packages so that both 32-bit and 64-bit applications can be supported.
If you need a special kernel to support what you are doing, you can use the src RPM to rebuild a custom kernel package and then use these rebuilt packages in the updated distribution. How you do this kernel package rebuilding is beyond the scope of this document.
You can also add packages to the distribution by copying them to the $FCBASE/fc3/i386/Fedora/RPMS directory and the $FCBASE/fc3/i386/SRPMS directory (for src.rpm).
To edit the comps file, please see Editing the Comps File.
Step 3: Cleanup
The original build which created the ISO images leaves some extra files which can be removed with the following command:
find $FCBASE/fc3 -name TRANS.TBL -exec rm -f {} \;
find $FCBASE/fc3 -name boot.cat -exec rm -f {} \;
Step 4: Build
OK, you now have an updated installation tree and you need to execute the following commands:
1.
Update the hdlist file with the following command:
genhdlist --productpath=Fedora $FCBASE/fc3/i386
2.
Next, create the package order file:
pkgorder $FCBASE/fc3/i386 i386 Fedora | tee \
$FCBASE/fc3/pkgfile
3.
Next, update the installation files:
buildinstall --pkgorder $FCBASE/fc3/pkgfile \
--version 3 --product "Fedora Core" \
--release "Fedora Core 3" \
--prodpath Fedora \
$FCBASE/fc3/i386
Step 5: Splitting the installation tree
To create CD ISO images, you will need to split the binary and SRPMS into eight CD trees:
rm -fr $FCBASE/fc3/i386-disc[1-9]
splittree.py --arch=i386 \
--total-discs=8 --bin-discs=4 --src-discs=4 \
--release-string="Fedora Core 3" \
--pkgorderfile=$FCBASE/fc3/pkgfile \
--distdir=$FCBASE/fc3/i386 \
--srcdir=$FCBASE/fc3/i386/SRPMS \
--productpath=Fedora
rm -f $FCBASE/fc3/i386-disc1/Fedora/base/hdlist
genhdlist --productpath=Fedora --withnumbers \
--fileorder $FCBASE/fc3/pkgfile \
$FCBASE/fc3/i386-disc[1234]
The split trees are created in $FCBASE/fc3 and are named i386-disc[1-8].
NOTE: The "--distdir=$FCBASE/fc3/i386" parameter DOES NOT end with a "/" intentionally. If it does end with "/", then the split trees will be named -disc[12345678] and be sub-directories of $FCBASE/fc3/i386/ instead of being i386-disc[1-8] under subdirectory $FCBASE/fc3.
The splittree.py program does not currently support splitting the installation tree into DVD size trees. However, this can be performed manually. The options are to modify the installation tree which you just created or to create two new DVD-sized trees. For purposes of this HOWTO, two new direcoty trees will be created:
mkdir -p $FCBASE/fc3/i386-dvd1
mkdir -p $FCBASE/fc3/i386-dvd2
cp -a $FCBASE/fc3/i386/* $FCBASE/fc3/i386-dvd1/
cp -p $FCBASE/fc3/i386/.discinfo $FCBASE/fc3/i386-dvd1/
cp -p $FCBASE/fc3/i386/* $FCBASE/fc3/i386-dvd2/
mv $FCBASE/i386-dvd1/SRPMS $FCBASE/fc3/i386-dvd2/
Another approach (thanks to Andrew Mann) for creating DVD images was simply described in anaconda-devel-list message. This describes the changes needed to splittree.py to handle DVD images:
cp /usr/lib/anaconda-runtime/splittree.py \
./splittree-dvd.py
then around line 79, change
self.target_size = 640.0 * 1024.0 * 1024
to be
self.target_size = 4.4 * 1024.0 * 1024.0 * 1024
You can also change all of the "-disc" to "-dvd" so
that both CD and DVD split trees can coexist.
rm -fr $FCBASE/fc3/i386-dvd[1-9]
./splittree.py --arch=i386 \
--total-dvds=2 --bin-dvds=1 --src-dvds=1 \
--release-string="Fedora Core 3" \
--pkgorderfile=$FCBASE/fc3/pkgfile \
--distdir=$FCBASE/fc3/i386 \
--srcdir=$FCBASE/fc3/i386/SRPMS \
--productpath=Fedora
Now go to step 6 but only create the first (bootable) image and the single SRPMS image.
Step 6: Creating the CD or DVD ISO Images
1.
The first binary or installation image differs from the other images because it is bootable. The following command will create this ISO image:
cd $FCBASE/fc3
mkisofs -R -J -T -v \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-V "Fedora Core 3 (update or whatever)" \
-b isolinux/isolinux.bin -c isolinux/boot.cat \
-x "lost+found" \
-o FC3-i386-disc1.iso\
i386-disc1
or, if you are creating a DVD image, then use:
mkisofs -R -J -T -v \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-V "Fedora Core 3 (updated or whatever)" \
-b isolinux/isolinux.bin -c isolinux/boot.cat \
-x "lost+found" \
-o FC3-i386-dvd1.iso \
i386-dvd1
2.
Continue to create the other CD binary discs ISO images with (skip if doing DVD images):
mkisofs -R -J -T -v \
-V "Fedora Core 3 (updated or whatever)" \
-x "lost+found" \
-o FC3-i386-disc2.iso \
i386-disc2
which is repeated for disc3 and disc4.
3.
Then do the SRPMS which is similar to that done for disc[2-4]:
mkisofs -R -J -R -v \
-V "Fedora Core 3 (updated or whatever)" \
-x "lost+found" \
-o FC3-i386-SRPMS-disc1.iso \
i386-disc5
which is repeated for disc6 -> disc2.iso, disc7 ->disc3.iso, and disc8 -> disc4.iso.
If you are creating a DVD SRPMS image, then do:
mkisofs -R -J -R -v \
-V "Fedora Core 3 (updated or whatever)" \
-x "lost+found" \
-o FC3-i386-SRPMS-dvd1.iso \
i386-dvd2
cd $FCBASE
All done!
Updating and creating the RescueCD
The following process assumes that you have the trees, etc. described above.
Step 1: The RescueCD Tree
Run the commands:
rm -fr $FCBASE/fc3/i386-rescueimage
mk-rescuecd.i386 $FCBASE/fc3/i386 \
$FCBASE/fc3 \
"FC 3" \
Fedora
If you only want a RescueCD with software from the updated packages (such as an updated kernel), then skip to step 4.
Step 2: Increasing RAMDISK Size
If you would like to increase the size of the ramdisk you boot into, then do the following:
1.
Edit $FCBASE/rescue/i386-rescue/isolinux/isolinux.cfg and change the ramdisk_size values from their standard setting of 8192 to something larger such as 16384.
2.
Do:
gunzip < $FCBASE/fc3/i386-rescueimage/isolinux/initrd.img \
> /tmp/initrd.old
mount -o ro,loop /tmp/initrd.old /mnt/xx
3.
Then create the updated image:
dd if=/dev/zero of=/tmp/initrd.new bs=1k count=12288
mke2fs -F -i 4086 /tmp/initrd.new
mount -o loop /tmp/initrd.new /mnt/zz
cp -va /mnt/xx/* /mnt/zz
cp -vp /mnt/xx/.buildstamp /mnt/zz
umount /mnt/xx
umount /mnt/zz
4.
Now gzip and replace the original initrd.img:
gzip -9 </tmp/initrd.new \
> $FCBASE/fc3/i386-rescueimage/isolinux/initrd.img
Step 3: Adding software
Do the following:
mount -o ro,loop \
$FCBASE/fc3/i386-rescueimage/Fedora/base/stage2.img \
/mnt/xx
mkdir $FCBASE/stage2
cp -va /mnt/xx/* $FCBASE/stage2
cp -vp /mnt/xx/.buildstamp $FCBASE/stage2
Now update the stage2 directory with your stuff such as programs into $FCBASE/stage2/usr/bin. Be careful that your software does not need additional libraries, etc. [statically linked programs are the way to go]. Once you have everything updated, then do:
mkcramfs $FCBASE/stage2/ /tmp/stage2.new
cp -vp /tmp/stage2.new \
$FCBASE/fc3/i386-rescueimage/Fedora/base/stage2
Step 4: CD creation
Similar to the bootable installation CD, do the following:
cd $FCBASE/fc3
mkisofs -R -J -T -v \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-V "Fedora Core 3 Rescue CD (or whatever)" \
-b isolinux/isolinux.bin -c isolinux/boot.cat \
-x "lost+found" \
-o FC3-i386-rescuecd.iso \
i386-rescue
cd $FCBASE |
|