Setting up the build environment 1.7: Difference between revisions

From Alpine Linux
(→‎Step-by-step: updated link)
(→‎Step-by-step: update buildroot version to 1.7.6)
Line 13: Line 13:


== Step-by-step ==
== Step-by-step ==
All packages are downloaded from http://dl.alpinelinux.org/alpine/v1.7
All packages are downloaded from http://dev.alpinelinux.org/alpine/v1.7


* Download latest buildroot package from [http://dl.alpinelinux.org/alpine/v1.7/buildroot/] and unpack it in /opt/alpine, using the --preserve-permissions option and create a symblink named 1.7 for the development branch.
* Download latest buildroot package from [http://dev.alpinelinux.org/alpine/v1.7/buildroot/] and unpack it in /opt/alpine, using the --preserve-permissions option and create a symblink named 1.7 for the development branch.


  sudo mkdir -p /opt/alpine
  sudo mkdir -p /opt/alpine
  cd /opt/alpine
  cd /opt/alpine
  wget -q -O - http://dl.alpinelinux.org/alpine/v1.7/buildroot/alpine-buildroot-latest.tar.bz2 | sudo tar -vjxp
  wget -q -O - http://dev.alpinelinux.org/alpine/v1.7/buildroot/alpine-buildroot-latest.tar.bz2\
  sudo ln -s alpine-buildroot-1.7.2 1.7
    | sudo tar -vjxp
  sudo ln -s alpine-buildroot-1.7.6 1.7





Revision as of 06:42, 27 September 2007

Quick note on how to set up a build environment.

In this document the build environment will be created in /opt/alpine/1.7. You can ofcourse place it anywhere you have space. You will need a few Gigabytes to have enough space for kernel cmpiling and storing all the binary packages and iso image.

Requirements

You need a 2.6 kernel to use the chroot build environment.

  • Note: Make sure your running kernel supports 16bit UIDs for backward compatibility. uCLibc needs them. Check it with:
zcat /proc/config.gz | grep CONFIG_UID16


Step-by-step

All packages are downloaded from http://dev.alpinelinux.org/alpine/v1.7

  • Download latest buildroot package from [1] and unpack it in /opt/alpine, using the --preserve-permissions option and create a symblink named 1.7 for the development branch.
sudo mkdir -p /opt/alpine
cd /opt/alpine
wget -q -O - http://dev.alpinelinux.org/alpine/v1.7/buildroot/alpine-buildroot-latest.tar.bz2\
    | sudo tar -vjxp
sudo ln -s alpine-buildroot-1.7.6 1.7


  • Copy your DNS configuration to the build environment and mount proc.
sudo cp /etc/resolv.conf /opt/alpine/1.7/etc/
sudo mount -t proc proc /opt/alpine/1.7/proc
sudo mount -o bind /dev /opt/alpine/1.7/dev
  • Enter the chroot
sudo chroot /opt/alpine/1.7 /bin/bash --login

Now we are in the build environment chroot.

cd /usr
wget -q -O - http://mirror.gentoo.se/snapshots/portage-latest.tar.bz2 portage-latest.tar.bz2 | tar -vjx
  • Check out the alpine-portage overlay from svn.
svn co svn://svn.alpinelinux.org/alpine-portage/trunk /usr/alpine-portage
  • Download all the tbz2 packages into the var/cache/packages directory. This is probably easiest with rsync.
rsync -rauv rsync://rsync.alpinelinux.org/alpine/v1.7/tbz2/* /var/cache/packages/
  • Check out the alpine-builder scripts in usr/src/
svn co svn://svn.alpinelinux.org/alpine-builder/trunk /usr/src/alpine
  • Configure portage to use the config from alpine-builder.
rm -r /etc/make.conf /etc/portage
ln -s /usr/src/alpine/buildroot/etc/make.conf /etc
ln -s /usr/src/alpine/buildroot/etc/portage /etc
  • Update the portage tree (this takes some time first time you do it)
emerge --sync
  • Install the kernel sources, using the downloaded tbz2.
This step is no longer neccessary as this is done automatically within the build script.
  • Make sure that /usr/src/linux points to your kernel version:
cd /usr/src
rm -f linux
ln -s linux-2.6.20-hardened-r6 linux
  • Build the iso image
cd /usr/src/alpine
make

If you get failures while building kernel drivers then you can workaround that by commenting out the specific in /usr/src/alpine/kernel/generic/drivers.