HOWTO: cre­at­ing your own up­dated linux RPM for the FreeBSD linuxu­lator

Back­ground info

The FreeBSD linux com­pat­ib­il­ity en­vir­on­ment cur­rently uses RPMs from Fe­dora 10. Un­for­tu­nately Fe­dora 10 is end of life since a while. For one of the RPMs (the pango one) we where aware of a se­cur­ity vul­ner­ab­il­ity. As we do not know if it is feas­ible to up­date the linuxu­lator ports to some­thing more re­cent, I de­cided to setup a VM with Fe­dora 10 and gen­er­ate a new RPM for the linux–f10-​pango port. Thanks to Luchesar V. ILIEV for ex­plain­ing me how to do this.

Setup of the VM

I used Vir­tu­al­Box 4.0.4 on a Sol­aris 10 x86 ma­chine. I con­figured a fixed size disk of 16 GB and kept the de­fault net­work setup (after in­stalling the guest tools /​ ker­nel mod­ules I switched to vir­tio, as I was not able to do any­thing use­ful be­sides a ping) and RAM size. The CD/​DVD drive was con­figured to use the im­age of the full Fe­dora 10 DVD for i386 sys­tems.

Setup of Fe­dora 10

Boot­ing the VM from the DVD leads to the graph­ical Fe­dora 10 in­stall soft­ware (after chos­ing to in­stall a new sys­tem on the con­sole). There I ac­cep­ted all the de­faults, ex­cept for the soft­ware to in­stall. I deselec­ted the Of­fice and Pro­ductiv­ity group and se­lec­ted the Soft­ware De­vel­op­ment group. When I was asked if I want to in­stall some ad­di­tional RPMs I had a look at the com­plete list and in­stalled some I thought are ne­ces­sary. I do not re­mem­ber any­more which ones I chose, but everything which looks re­lated to RPM build­ing is a good can­did­ate.

After a while the in­stall will be fin­ished and you can boot into the new sys­tem (eject the DVD from the drive be­fore re­boot). After re­boot chose to in­stall the Guest Ad­di­tions in the menu of the VM. This should mount the ISO im­age in the VM. As root ex­ecute the file for Linux. This will build some ker­nel mod­ules for bet­ter in­teg­ra­tion (e.g. seam­less in­teg­ra­tion of the mouse between your desktop and the VM). At this point I re­booted and con­figured 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 cor­rectly.

Up­date and in­stall of re­quired RPMs

After the VM was up and the net­work con­figured, I up­dated the en­tire sys­tem (chose Sys­tem Up­date in the menu). To up­date the pango port, I had to in­stall 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 in­stall /​path/​to/​rpm”. At this point I was ready to cre­ate the RPM build en­vir­on­ment.

The RPM build en­vir­on­ment

As a nor­mal user I ex­ecuted the com­mand rpmdev-​setuptree which cre­ates the dir­ect­ory rpm­build and pop­u­lates it with some dir­ect­or­ies. 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 re­cent pango ver­sion, ba­sic­ally just chan­ging the ver­sion num­bers). If you want to have a cus­tom pack­ager and vendor at­trib­ute in the RPM, you can add a line for each to ~/.rpmmacros, e.g. %pack­ager your­name­here and %vendor whatever­is­ap­pro­pri­ate. I used my EMail ad­dress 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 everything is OK, the res­ult­ing RPMs (a source RPM, a de­vel RPM, a de­bu­ginfo RPM and the RPM for the bin­ar­ies) 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 bin­ar­ies.

Ad­di­tional info

The i386-​redhat-​linux-​gnu string which is used for the –tar­get op­tion of the rpm­build com­mand is what seems to be used to build the Fe­dora 10 RPMs. After build­ing pango, the RPM has i686-​pc-​linux-​gnu in some fi­le­names in­stead (the de­fault value for this setup). The bin­ar­ies seem to be com­piled for i386, so there should be no prob­lem even for old sys­tems.

StumbleUponXINGBalatarinBox.netDiggGoogle GmailNetvouzPlurkSiteJotTypePad PostYahoo BookmarksVKSlashdotPocketHacker NewsDiigoBuddyMarksRedditLinkedInBibSonomyBufferEmailHatenaLiveJournalNewsVinePrintViadeoYahoo MailAIMBitty BrowserCare2 NewsEvernoteMail.RuPrintFriendlyWaneloYahoo MessengerYoolinkWebnewsStumpediaProtopage BookmarksOdnoklassnikiMendeleyInstapaperFarkCiteULikeBlinklistAOL MailTwitterGoogle+PinterestTumblrAmazon Wish ListBlogMarksDZoneDeliciousFlipboardFolkdJamespotMeneameMixiOknotiziePushaSvejoSymbaloo FeedsWhatsAppYouMobdiHITTWordPressRediff MyPageOutlook.comMySpaceDesign FloatBlogger PostApp.netDiary.RuKindle ItNUjijSegnaloTuentiWykopTwiddlaSina WeiboPinboardNetlogLineGoogle BookmarksDiasporaBookmarks.frBaiduFacebookGoogle ClassroomKakaoQzoneSMSTelegramRenrenKnownYummlyShare/​Save

4 thoughts on “HOWTO: cre­at­ing your own up­dated linux RPM for the FreeBSD linuxu­lator”

    1. The reason to pick Fe­dora in­stead of RHEL was that RHEL was seen (when we made the de­cis­sion) as the com­mer­cial side of Fe­dora and we picked the one we tought will be avail­able for free without the need to maybe re­gister some­where. I do not re­mem­ber some­thing spe­cial about Cen­tOS.

      The old linux base was Red­Hat based (be­fore Red­Hat cre­ated Fe­dora), and we just con­tin­ued with what seemed to be the lo­gical step for­ward. As there is an ex­ist­ing in­fra­struc­ture for RPM based stuff, I am only will­ing to have a look at go­ing for­ward to some­thing more re­cent in the RPM world.

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

Leave a Reply

Your email address will not be published. Required fields are marked *