No edit summary |
(Adding build notes for Anaconda development) |
||
Line 2: | Line 2: | ||
[http://www.brianlane.com Homepage] | [http://www.brianlane.com Homepage] | ||
== Anaconda Development == | |||
Development System | |||
* Fedora 12 | |||
* squid proxy to cache packages | |||
* lighttpd to serve up updates.img | |||
* tftpd to serve up pxe boot images | |||
* mock + pungi for building | |||
== mock setup == | |||
* <code> yum install mock </code> | |||
* Edit the <code>/etc/mock/</code> file for the distribution or copy it to a new name and edit | |||
** Add <code>proxy=http://proxy.home:3128</code> to the main section. | |||
** comment out mirrorlist entries | |||
** Open up the mirror list url(s) in a browser and pick a mirror, use the same one for base and updates | |||
** Add <code>baseurl=<mirror url></code> in each section instead of mirrorlist | |||
** Do this for each section with a mirrorlist | |||
* Setup the initial mock environment, replace the fedora-13-i386 with the mock file edited above | |||
** <code>mock -r fedora-13-i386 --init</code> | |||
** <code>mock -r fedora-13-i386 --no-clean --install pungi</code> | |||
* Enter the chroot - <code> mock -r fedora-13-i386 --shell </code> | |||
** Edit <code> /usr/lib/anaconda-runtime/buildinstall </code> | |||
*** add <code> proxy=http://proxy.home:3128 </code> to the main section of the yum config embedded in it. | |||
** Edit <code> /usr/lib/python2.6/site-packages/pypungi/__init__.py </code> to add: | |||
<pre> | |||
diff --git a/src/pypungi/__init__.py b/src/pypungi/__init__.py | |||
index e57e72a..d30eefa 100644 | |||
--- a/src/pypungi/__init__.py | |||
+++ b/src/pypungi/__init__.py | |||
@@ -206,6 +206,8 @@ class Pungi(pypungi.PungiBase): | |||
thisrepo.cost = repo.cost | |||
if repo.ignoregroups: | |||
thisrepo.enablegroups = 0 | |||
+ if repo.proxy: | |||
+ thisrepo.proxy = repo.proxy | |||
self.ayum.repos.add(thisrepo) | |||
self.ayum.repos.enableRepo(thisrepo.id) | |||
self.ayum._getRepos(thisrepo=thisrepo.id, doSetup = True) | |||
-- | |||
1.6.6.1 | |||
</pre> | |||
This patch should be in the next release of pungi, but check to make sure just to be safe. | |||
Now you have a mock chroot environment setup that will use the proxy cache for packages. | |||
== Building boot images == | |||
Use the compose and pungi.ks files below, place them into /root/ in the mock to be built: | |||
* pungi.ks | |||
<pre> | |||
# un-comment the applicable repo | |||
repo --name=fedora --baseurl=http://mirrors.cat.pdx.edu/fedora/linux/development/13/i386/os/ --proxy=http://proxy.home:3128 | |||
# Very small install footprint | |||
%packages | |||
@base | |||
kernel | |||
syslinux | |||
nomtools | |||
anaconda | |||
%end | |||
</pre> | |||
* compose | |||
<pre> | |||
#!/bin/bash | |||
echo "*** Running pungi --force --nosource --nodebuginfo --nosplitmedia -G -C -B -c /root/pungi.ks --ver=13" | |||
pungi --cachedir=/extra/released/pungi/cache --force --nosource --nodebuginfo --nosplitmedia -G -C -B -c /root/pungi.ks --ver=13 | |||
echo "*** Done." | |||
</pre> | |||
* <code> chmod a+x compose </code> | |||
* <code> exit </code> | |||
* <code> mock -r fedora-13-i386 --chroot "/root/compose" </code> | |||
Change the --ver to match whichever release you are building for | |||
== Building updates == | |||
Anaconda includes the ability to update itself by passing <code>updates=http://path/to/update.img</code> to the kernel at boot time. This allows you to use the same boot media and test changes to stage2 of the installer. | |||
* This assumes a working mock chroot (ie. I built boot images with this one first) | |||
* You need a git repo of Anaconda, I branch for the build so I don't clutter up master with build by-products. | |||
** <code> git clone git://git.fedorahosted.org/anaconda.git </code> | |||
** <code> cd anaconda; git checkout -b build-upates </code> | |||
* bind the anaconda directory to the mock being used (needs to be done as root) | |||
** <code> mkdir /var/lib/mock/fedora-13-i386/root/root/anaconda/ </code> | |||
** <code> mount -o bind /home/bcl/projs/anaconda/ /var/lib/mock/fedora-13-i386/root/root/anaconda/ </code> | |||
* enter the chroot | |||
** <code> mock -v -r fedora-13-i386 --shell </code> | |||
** Install the development tools group | |||
*** <code> yum groupinstall "development tools" </code> | |||
** grab a copy of the current anaconda*src.rpm from someplace and install the dependencies with: | |||
*** <code> yum-builddep anaconda*src.rpm </code> | |||
** now build anaconda | |||
*** <code> ./autogen.sh </code> | |||
*** <code> ./configure </code> | |||
*** <code> make updates </code> | |||
** <code> exit </code> | |||
* copy the updates.img over to the updates directory and optionally rename it | |||
** <code> cp /var/lib/mock/fedora-13-i386/root/root/anaconda/updates.img /home/tftpboot/images/updates/ </code> | |||
You can skip installing development tools and anaconda deps for subsequent iterations. | |||
Now add <code> updates=http://proxy.home/updates/updates.img </code> to the kernel parameters when booting the install media. | |||
== Build with a test anaconda.rpm == | |||
Normally when a punji build is done it pulls anaconda from the repo/proxy cache. Instead you want it to use your new build (ie. when doing stage1 development which cannot be updated by updates= being passed to the kernel) | |||
* <code> mount -o bind /home/bcl/Red_Hat/projs/anaconda/ /var/lib/mock/fedora-13-i386/root/root/anaconda/ </code> | |||
* <code> mock -v -r fedora-13-i386-proxy --shell </code> | |||
* <code> cd /root/anaconda </code> | |||
* Removed the cached files. Otherwise it pull pull from there and not update to the latest | |||
** <code> rm -rf /13 </code> | |||
** <code> rm -rf /extra/released/pungi/cache </code> | |||
* <code> ./autogen.sh </code> | |||
* <code> ./configure </code> | |||
* <code> make scratch </code> | |||
* <code> rpmbuild -ts --nodeps anaconda...tar.gz </code> | |||
* <code> yum-builddep /builddir/build/SRPMS/anaconda...src.rpm </code> | |||
* <code> rpmbuild --rebuild /builddir/build/SRPMS/anaconda...src.rpm </code> | |||
* <code> mkdir /repo </code> | |||
* <code> cp /builddir/build/RPMS/anaconda...rpm /repo </code> | |||
* <code> createrepo /repo </code> | |||
* edit <code> /root/pungi.ks </code> and add | |||
** <code> repo --name=local --baseurl=file:///repo/ </code> | |||
* <code> exit </code> | |||
* <code> mock -v -r fedora-13-i386 --chroot "/root/compose" </code> | |||
* <code> rsync -avc /var/lib/mock/fedora-13-i386/root/13/i386/os/images/ /home/tftpboot/images/fedora/13/i386/ </code> | |||
Boot with the pxe image and see what happens | |||
== Update boot.iso with new anaconda rpm == | |||
After you have a working boot.iso you can easily update it with the files from the new anaconda rpm you built above. Use the [[http://bcl.fedorapeople.org/scripts/upd_bootiso | upd_bootiso]] script to do this: | |||
<code>upd_bootiso boot.iso anaconda-13.35-1.fc13.i686.rpm</code> | |||
This will extract the files from initrd.img and install.img on the boot.iso, update the files and then re-build the boot.iso | |||
This is considerably faster than using mock + pungi to compose a whole new iso from scratch. |
Revision as of 00:15, 20 March 2010
Nothing to see here yet.
Anaconda Development
Development System
- Fedora 12
- squid proxy to cache packages
- lighttpd to serve up updates.img
- tftpd to serve up pxe boot images
- mock + pungi for building
mock setup
yum install mock
- Edit the
/etc/mock/
file for the distribution or copy it to a new name and edit- Add
proxy=http://proxy.home:3128
to the main section. - comment out mirrorlist entries
- Open up the mirror list url(s) in a browser and pick a mirror, use the same one for base and updates
- Add
baseurl=<mirror url>
in each section instead of mirrorlist - Do this for each section with a mirrorlist
- Add
- Setup the initial mock environment, replace the fedora-13-i386 with the mock file edited above
mock -r fedora-13-i386 --init
mock -r fedora-13-i386 --no-clean --install pungi
- Enter the chroot -
mock -r fedora-13-i386 --shell
- Edit
/usr/lib/anaconda-runtime/buildinstall
- add
proxy=http://proxy.home:3128
to the main section of the yum config embedded in it.
- add
- Edit
/usr/lib/python2.6/site-packages/pypungi/__init__.py
to add:
- Edit
diff --git a/src/pypungi/__init__.py b/src/pypungi/__init__.py index e57e72a..d30eefa 100644 --- a/src/pypungi/__init__.py +++ b/src/pypungi/__init__.py @@ -206,6 +206,8 @@ class Pungi(pypungi.PungiBase): thisrepo.cost = repo.cost if repo.ignoregroups: thisrepo.enablegroups = 0 + if repo.proxy: + thisrepo.proxy = repo.proxy self.ayum.repos.add(thisrepo) self.ayum.repos.enableRepo(thisrepo.id) self.ayum._getRepos(thisrepo=thisrepo.id, doSetup = True) -- 1.6.6.1
This patch should be in the next release of pungi, but check to make sure just to be safe.
Now you have a mock chroot environment setup that will use the proxy cache for packages.
Building boot images
Use the compose and pungi.ks files below, place them into /root/ in the mock to be built:
- pungi.ks
# un-comment the applicable repo repo --name=fedora --baseurl=http://mirrors.cat.pdx.edu/fedora/linux/development/13/i386/os/ --proxy=http://proxy.home:3128 # Very small install footprint %packages @base kernel syslinux nomtools anaconda %end
- compose
#!/bin/bash echo "*** Running pungi --force --nosource --nodebuginfo --nosplitmedia -G -C -B -c /root/pungi.ks --ver=13" pungi --cachedir=/extra/released/pungi/cache --force --nosource --nodebuginfo --nosplitmedia -G -C -B -c /root/pungi.ks --ver=13 echo "*** Done."
chmod a+x compose
exit
mock -r fedora-13-i386 --chroot "/root/compose"
Change the --ver to match whichever release you are building for
Building updates
Anaconda includes the ability to update itself by passing updates=http://path/to/update.img
to the kernel at boot time. This allows you to use the same boot media and test changes to stage2 of the installer.
- This assumes a working mock chroot (ie. I built boot images with this one first)
- You need a git repo of Anaconda, I branch for the build so I don't clutter up master with build by-products.
git clone git://git.fedorahosted.org/anaconda.git
cd anaconda; git checkout -b build-upates
- bind the anaconda directory to the mock being used (needs to be done as root)
mkdir /var/lib/mock/fedora-13-i386/root/root/anaconda/
mount -o bind /home/bcl/projs/anaconda/ /var/lib/mock/fedora-13-i386/root/root/anaconda/
- enter the chroot
mock -v -r fedora-13-i386 --shell
- Install the development tools group
yum groupinstall "development tools"
- grab a copy of the current anaconda*src.rpm from someplace and install the dependencies with:
yum-builddep anaconda*src.rpm
- now build anaconda
./autogen.sh
./configure
make updates
exit
- copy the updates.img over to the updates directory and optionally rename it
cp /var/lib/mock/fedora-13-i386/root/root/anaconda/updates.img /home/tftpboot/images/updates/
You can skip installing development tools and anaconda deps for subsequent iterations.
Now add updates=http://proxy.home/updates/updates.img
to the kernel parameters when booting the install media.
Build with a test anaconda.rpm
Normally when a punji build is done it pulls anaconda from the repo/proxy cache. Instead you want it to use your new build (ie. when doing stage1 development which cannot be updated by updates= being passed to the kernel)
mount -o bind /home/bcl/Red_Hat/projs/anaconda/ /var/lib/mock/fedora-13-i386/root/root/anaconda/
mock -v -r fedora-13-i386-proxy --shell
cd /root/anaconda
- Removed the cached files. Otherwise it pull pull from there and not update to the latest
rm -rf /13
rm -rf /extra/released/pungi/cache
./autogen.sh
./configure
make scratch
rpmbuild -ts --nodeps anaconda...tar.gz
yum-builddep /builddir/build/SRPMS/anaconda...src.rpm
rpmbuild --rebuild /builddir/build/SRPMS/anaconda...src.rpm
mkdir /repo
cp /builddir/build/RPMS/anaconda...rpm /repo
createrepo /repo
- edit
/root/pungi.ks
and addrepo --name=local --baseurl=file:///repo/
exit
mock -v -r fedora-13-i386 --chroot "/root/compose"
rsync -avc /var/lib/mock/fedora-13-i386/root/13/i386/os/images/ /home/tftpboot/images/fedora/13/i386/
Boot with the pxe image and see what happens
Update boot.iso with new anaconda rpm
After you have a working boot.iso you can easily update it with the files from the new anaconda rpm you built above. Use the [| upd_bootiso] script to do this:
upd_bootiso boot.iso anaconda-13.35-1.fc13.i686.rpm
This will extract the files from initrd.img and install.img on the boot.iso, update the files and then re-build the boot.iso
This is considerably faster than using mock + pungi to compose a whole new iso from scratch.