This page describes how packages build using buildroot can be converted into packages to be used by hfp(pkg). There are some packages that need to be handled in a special way, but most of the programs / libraries can be easily converted.

Before we can create packages from buildroot, we’ll have to make some small changes to the configuration first.

hv@scratchbox:~
$ cd ~/buildroot

hv@scratchbox:~/buildroot
$ make menuconfig
Package Selection for the target:
  [*] BusyBox 
  [ ]   Run BusyBox's own full installation  
  [*]   Show packages that are also provided by busybox
Target filesystem options:
  [ ] tar the root filesystem
hv@scratchbox:~/buildroot
$ make

busybox

We start by creating a package for busybox, a very special package. It provides simple versions of many Unix commands. Which commands (and their options) are supported by busybox can be configured using a graphical interface.

When installing or upgrading this package at your CH3HNAS, already installed packages that implement commands also provided by busybox should NOT be overwritten. This will be handled in the special postinstall and preremove scripts. The postinstall scripts needs a file with all the commands implemented by busybox, we will store this in /etc/busybox.links.

hv@scratchbox:~/buildroot
$ cd ~/buildroot/output/build/busybox-1.17.4

hv@scratchbox:~/buildroot/output/build/busybox-1.17.4
$ make menuconfig

Change the following configuration settings:

Archival utilities:
    [*] Make tar, rpm, modprobe etc understand  .xz data
    [*] Make tar, rpm, modprobe etc understand  .gz data
    [*] Make tar, rpm, modprobe etc understand  .bz2 data
Coreutils
    [*] comm
    [*] stat
Miscellaneous Utilities
    [*] man

Now, force buildroot to rebuild the busybox package by removing the timestamp. Rebuild busybox and create busybox.links.

hv@scratchbox:~/buildroot/output/build/busybox-1.17.4
$ rm .stamp_built

hv@scratchbox:~/buildroot/output/build/busybox-1.17.4
$ (cd ../../..; make)

hv@scratchbox:~/buildroot/output/build/busybox-1.17.4
$ HOSTCC=gcc applets/busybox.mkll > busybox.links

When done, use the hfp utility to create the package

hv@scratchbox:~/buildroot/output/build/busybox-1.17.4
$ hfp create-package
Creating package from buildroot output

Package:      busybox
Version:      1.17.4
Description:  the swiss army knife of embedded linux
Scripts:      postinstall.sh preremove.sh

mkdir /home/hv/hfp/packages/busybox-1.17.4/root/bin
cp busybox /home/hv/hfp/packages/busybox-1.17.4/root/bin
cp busybox.links /home/hv/hfp/packages/busybox-1.17.4/scripts
/home/hv/hfp/repository/busybox-1.17.4_01.00.tar.bz2 created

The preremove script will remove all files which are sybolic links to busybox.
The postinstall script will chmod the busybox executable to 4755 and create all the links.

bash

The bash executable is needed by scratchbox 2. It's a bit special because the executable has to be moved from /usr/bin to /bin during packaging.

hv@scratchbox:~
$ cd ~/buildroot

hv@scratchbox:~/buildroot
$ make menuconfig
  Package Selection for the target
    Shell and utilities
      [*] bash
hv@scratchbox:~/buildroot
$ make

hv@scratchbox:~/buildroot
$ cd output/build/bash-4.1

hv@scratchbox:~/buildroot/output/build/bash-4.1
$ hfp create-package
Creating package from buildroot output

Package:      bash
Version:      4.1
Description:  bourne-again shell
Depends upon: ncurses

make instal ... done
mkdir /home/hv/hfp/packages/bash-4.1/root/bin
mv /home/hv/hfp/packages/bash-4.1/root/{usr/,}bin/bash
mv /home/hv/hfp/packages/bash-4.1/root/{usr/,}bin/bashbug
/home/hv/hfp/repository/bash-4.1_01.00.tar.bz2 created

ncurses

The output for this package will have already been created by building bash. So, we can just go to the output folder of ncurses and create the package.

hv@scratchbox:~/buildroot/output/build/bash-4.1
$ cd ../ncurses-5.7

hv@scratchbox:~/buildroot/output/build/ncurses-5.7
$ hfp create-package
Creating package from buildroot output

Package:      ncurses
Version:      5.7
Description:  library allowing text user interfaces

make instal ... done
/home/hv/hfp/repository/ncurses-5.7_01.00.tar.bz2 created

pkg-config

This package is needed when building packages under scratchbox.

hv@scratchbox:~
$ cd ~/buildroot

hv@scratchbox:~/buildroot
$ make menuconfig
  Package Selection for the target
    Development tools
      [*] pkg-config
hv@scratchbox:~/buildroot
$ make

hv@scratchbox:~/buildroot
$ cd output/build/pkg-config-0.23

hv@scratchbox:~/buildroot/output/build/pkg-config-0.23
$ hfp create-package
Creating package from buildroot output

Package:      pkg-config
Version:      0.23
Description:  display software package and or set information

make instal ... done
/home/hv/hfp/repository/pkg-config-0.23_01.00.tar.bz2 created