Alexander Leidinger

Just another weblog


HOWTO: cre­at­ing your own updated linux RPM for the FreeBSD linuxulator

Back­ground info

The FreeBSD linux com­pat­i­bil­ity envi­ron­ment cur­rently uses RPMs from Fedora 10. Unfor­tu­nately Fedora 10 is end of life since a while. For one of the RPMs (the pango one) we where aware of a secu­rity vul­ner­a­bil­ity. As we do not know if it is fea­si­ble to update the lin­ux­u­la­tor ports to some­thing more recent, I decided to setup a VM with Fedora 10 and gen­er­ate a new RPM for the linux–f10-pango port. Thanks to Luchesar V. ILIEV for explain­ing me how to do this.

Setup of the VM

I used Vir­tu­al­Box 4.0.4 on a Solaris 10 x86 machine. I con­fig­ured a fixed size disk of 16 GB and kept the default net­work setup (after installing the guest tools / ker­nel mod­ules I switched to vir­tio, as I was not able to do any­thing use­ful besides a ping) and RAM size. The CD/DVD drive was con­fig­ured to use the image of the full Fedora 10 DVD for i386 systems.

Setup of Fedora 10

Boot­ing the VM from the DVD leads to the graph­i­cal Fedora 10 install soft­ware (after chos­ing to install a new sys­tem on the con­sole). There I accepted all the defaults, except for the soft­ware to install. I des­e­lected the Office and Pro­duc­tiv­ity group and selected the Soft­ware Devel­op­ment group. When I was asked if I want to install some addi­tional RPMs I had a look at the com­plete list and installed some I thought are nec­es­sary. I do not remem­ber any­more which ones I chose, but every­thing which looks related to RPM build­ing is a good candidate.

After a while the install will be fin­ished and you can boot into the new sys­tem (eject the DVD from the drive before reboot). After reboot chose to install the Guest Addi­tions in the menu of the VM. This should mount the ISO image in the VM. As root exe­cute the file for Linux. This will build some ker­nel mod­ules for bet­ter inte­gra­tion (e.g. seam­less inte­gra­tion of the mouse between your desk­top and the VM). At this point I rebooted and con­fig­ured vir­tio as the NIC. I also had to con­fig­ure the net­work set­tings by hand, as the GUI tool did not safe all the set­tings correctly.

Update and install of required RPMs

After the VM was up and the net­work con­fig­ured, I updated the entire sys­tem (chose Sys­tem Update in the menu). To update the pango port, I had to install the libthai-devel RPM. I had the RPM for it (and all the files I need to build a new pango RPM) already down­loaded, so I did a “yum install /path/to/rpm”. At this point I was ready to cre­ate the RPM build environment.

The RPM build environment

As a nor­mal user I exe­cuted the com­mand rpmdev-setuptree which cre­ates the direc­tory rpm­build and pop­u­lates it with some direc­to­ries. Now you just need to find a suit­able .spec file and put it into rpmbuild/SPECS, put the sources (and maybe patches ref­er­enced in the .spec file) into rpmbuild/SOURCES, and you are ready to go (I patched pango.spec for a more recent pango ver­sion, basi­cally just chang­ing the ver­sion num­bers). If you want to have a cus­tom pack­ager and ven­dor attribute in the RPM, you can add a line for each to ~/.rpmmacros, e.g. %pack­ager your­name­here and %ven­dor what­ev­eris­ap­pro­pri­ate. I used my EMail address as the pack­ager, and FreeBSD as the vendor.

Build­ing a RPM

I used rpm­build –ba –tar­get i386-redhat-linux-gnu –clean rpmbuild/SPECS/pango.spec to build the new pango RPM. If every­thing is OK, the result­ing RPMs (a source RPM, a devel RPM, a debug­info RPM and the RPM for the bina­ries) are in rpmbuild/RPMS and rpmbuild/SRPMS. For a FreeBSD port we just need the source RPM (to com­ply to the (L)GPL) and the RPM for the binaries.

Addi­tional info

The i386-redhat-linux-gnu string which is used for the –tar­get option of the rpm­build com­mand is what seems to be used to build the Fedora 10 RPMs. After build­ing pango, the RPM has i686-pc-linux-gnu in some file­names instead (the default value for this setup). The bina­ries seem to be com­piled for i386, so there should be no prob­lem even for old systems.


Tags: , , , , , , , , ,

4 Responses to “HOWTO: cre­at­ing your own updated linux RPM for the FreeBSD linuxulator”

  1. edogawaconan Says:

    what’s the rea­son for fol­low­ing fedora and not centos/rhel?

  2. netchild Says:

    The rea­son to pick Fedora instead of RHEL was that RHEL was seen (when we made the decis­sion) as the com­mer­cial side of Fedora and we picked the one we tought will be avail­able for free with­out the need to maybe reg­is­ter some­where. I do not remem­ber some­thing spe­cial about CentOS.

    The old linux base was Red­Hat based (before Red­Hat cre­ated Fedora), and we just con­tin­ued with what seemed to be the log­i­cal step for­ward. As there is an exist­ing infra­struc­ture for RPM based stuff, I am only will­ing to have a look at going for­ward to some­thing more recent in the RPM world.

  3. Отчет о состоянии развития FreeBSD за первый квартал 2011 года | – Всероссийский портал о UNIX-системах Says:

    […] (linux_base) с набором компонентов для работы Linux-эмуляции признан устаревшим, так как многие программы в нем устарели и […]

  4. Отчет о состоянии развития FreeBSD за первый квартал 2011 года Says:

    […] (linux_base) с набором компонентов для работы Linux-эмуляции признан устаревшим, так как многие программы в нем устарели и […]

Leave a Reply