Setting up the build environment 1.7: Difference between revisions

From Alpine Linux
No edit summary
m (nowiki'd or commented out dead links.)
 
(28 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Historical|Alpine 1.7 is an ancient release.<br>URLs on this page may not function.}}
Quick note on how to set up a build environment.
Quick note on how to set up a build environment.
'''NOTE''': This document is obsolete since Alpine no longer is based on Gentoo. Please use the 1.9 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.
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.
You will need a few Gigabytes to have enough space for kernel cmpiling and storing all the binary packages and iso image.
If you already done this part and only want to 'update your build env.' then see bottom of this page.


== Requirements ==
== Requirements ==
Line 11: Line 17:
  zcat /proc/config.gz | grep CONFIG_UID16
  zcat /proc/config.gz | grep CONFIG_UID16


or if you dont have /proc/config.gz:
grep CONFIG_UID16 /boot/config-`uname -r`
You should se something like:
CONFIG_UID16=y


== Step-by-step ==
== Step-by-step ==
All packages are downloaded from http://dl.alpinelinux.org/alpine/v1.7
'''Before you go on please read this!'''
1) There is the hard way - do it yourself - if you want that go on with step-by-step
2) The quick/easy way: download a script that will do it for you: <nowiki>http://dev.alpinelinux.org/~abrodman/create-alpine-sdk.sh</nowiki>
    1) download the script
    2) chmod +x create-alpine-sdk.sh
    3) sudo ./create-alpine-sdk.sh
    -> it will download, unpack and compile everything for you
    -> location: /opt/alpine/alpine-sdk


* 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.
   
All packages are downloaded from <nowiki>http://dev.alpinelinux.org/alpine/v1.7</nowiki>


sudo mkdir -p /opt/alpine
* Download latest buildroot package from <nowiki>http://dev.alpinelinux.org/alpine/v1.7/sdk/</nowiki> and unpack it in /opt/alpine, using the --preserve-permissions option and create a symblink named 1.7 for the development branch.
cd /opt/alpine
wget -q -O - http://dl.alpinelinux.org/alpine/v1.7/buildroot/alpine-buildroot-1.7.2.tar.bz2 |  sudo tar -vjxp
sudo ln -s alpine-buildroot-1.7.2 1.7


sudo mkdir -p /opt/alpine/alpine-sdk
cd /opt/alpine/alpine-sdk
wget -q -O - <nowiki>http://dev.alpinelinux.org/alpine/v1.7/sdk/alpine-sdk-latest.tar.bz2</nowiki>\
    | sudo tar -vjxp
cd ..
sudo ln -s alpine-sdk 1.7


* Copy your DNS configuration to the build environment and mount proc.
* Copy your DNS configuration to the build environment and mount proc.
Line 27: Line 51:
  sudo cp /etc/resolv.conf /opt/alpine/1.7/etc/
  sudo cp /etc/resolv.conf /opt/alpine/1.7/etc/
  sudo mount -t proc proc /opt/alpine/1.7/proc
  sudo mount -t proc proc /opt/alpine/1.7/proc
sudo mount -o bind /dev /opt/alpine/1.7/dev


* Enter the chroot
* Enter the chroot and change the prompt to reflect your chroot environment


  sudo chroot /opt/alpine/1.7 /bin/bash --login
  sudo chroot /opt/alpine/1.7 /bin/bash --login
echo 'PS1="(chroot)$PS1"' >> /etc/profile


Now we are in the build environment chroot.
Now we are in the build environment chroot.


* Download latest portage snapshot [http://mirror.gentoo.se/snapshots/portage-latest.tar.bz2 portage-latest.tar.bz2] from Gentoo and unpack it to /usr
* Download latest portage snapshot <!--http://mirror.gentoo.se/snapshots/portage-latest.tar.bz2--> portage-latest.tar.bz2 from Gentoo and unpack it to /usr


  cd /usr
  cd /usr
Line 42: Line 66:
* Check out the alpine-portage overlay from svn.
* Check out the alpine-portage overlay from svn.


  svn co svn://svn.alpinelinux.org/alpine-portage/trunk /usr/alpine-portage
  svn co <nowiki>svn://svn.alpinelinux.org/alpine-portage/trunk</nowiki> /usr/alpine-portage


* Download all the [http://dl.alpinelinux.org/alpine/v1.7/tbz2 tbz2] packages into the var/cache/packages directory. This is probably easiest with rsync.
* Download all the <!--http://dl.alpinelinux.org/alpine/v1.7/tbz2--> 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/
  rsync -rauv rsync://rsync.alpinelinux.org/alpine/v1.7/tbz2/* /var/cache/packages/
Line 50: Line 74:
* Check out the alpine-builder scripts in usr/src/
* Check out the alpine-builder scripts in usr/src/


  svn co svn://svn.alpinelinux.org/alpine-builder/trunk /usr/src/alpine
  svn co <nowiki>svn://svn.alpinelinux.org/alpine-builder/trunk</nowiki> /usr/src/alpine
'''NOTE:''' The trunk is constantly changing. You might want to use a tagged release like ''<nowiki>svn://svn.alpinelinux.org/alpine-builder/tags/release-1.7.7</nowiki>''


* Configure portage to use the config from alpine-builder.
* Configure portage to use the config from alpine-builder.
   
   
  rm -r /etc/make.conf /etc/portage
  rm -r /etc/make.conf /etc/portage
  ln -s /usr/src/alpine/buildroot/etc/make.conf /etc
  ln -s /usr/src/alpine/sdk/etc/make.conf /etc
  ln -s /usr/src/alpine/buildroot/etc/portage /etc
  ln -s /usr/src/alpine/sdk/etc/portage /etc


* Update the portage tree (this takes some time first time you do it)
* Update the portage tree (this takes some time first time you do it)
Line 62: Line 87:
  emerge --sync
  emerge --sync


* Install the kernel sources, using the downloaded tbz2.  
* Build the alpine images (iso, usb, flash, etc.)
 
cd /usr/src/alpine
make
 
'''Failure compiling ipp2p:''' just manually 'emerge iptables' and issue 'make' again.
 
 
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''.
 
 
'''NOTE when leaving chroot:''' When leaving your chroot, you should unmount the /proc
exit
sudo umount /opt/alpine/1.7/proc
 
== Updating the build env. ==
If you already setup the build env earlier and only want to enter it, update it and maybe create a iso, then this part of the documentation is what you are looking for.
* Mount proc.
 
sudo mount -t proc proc /opt/alpine/1.7/proc
 
* Enter the chroot and change the prompt to reflect your chroot environment
 
sudo chroot /opt/alpine/1.7 /bin/bash --login
 
Now we are in the build environment chroot.
 
* Update the portage snapshot from Gentoo
emerge --sync
When emerge has done syncing, you could be advised to update the portage. In such case, you just follow instructions.
 
One instruction could be "* To update portage, run 'emerge portage'".
emerge portage
 
Another case could be that you see "* IMPORTANT: x config files in '/etc' need updating.". In that case run the dispatch-conf tool.
dispatch-conf
In most cases (when using the 'dispatch-conf') you should use the new config (by pressing 'u' in the console).


''This step is no longer neccessary as this is done automatically within the build script.''
* Check out the alpine-portage overlay from svn.


cd /usr/alpine-portage && svn up


* Make sure that /usr/src/linux points to your kernel version:
* Download all the <!--http://dl.alpinelinux.org/alpine/v1.7/tbz2--> tbz2 packages into the var/cache/packages directory. This is probably easiest with rsync.


  cd /usr/src
  rsync -rauv rsync://distrib-coffee.ipsl.jussieu.fr/pub/linux/alpine/alpine/v1.7/tbz2/* /var/cache/packages/
rm -f linux
ln -s linux-2.6.20-hardened-r6 linux


* Build the iso image
* Check out the alpine-builder scripts in usr/src/


  cd /usr/src/alpine
  cd /usr/src/alpine && svn up
  make
 
* Build the alpine images (iso, usb, flash, etc.)
 
cd /usr/src/alpine/iso
  make iso
 
 
'''NOTE when leaving chroot:''' When leaving your chroot, you should unmount the /proc
exit
sudo umount /opt/alpine/1.7/proc


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''.
[[Category:Development]]

Latest revision as of 00:12, 4 September 2023

This material is retained only for historical reasons ...

Alpine 1.7 is an ancient release.
URLs on this page may not function.

Quick note on how to set up a build environment.

NOTE: This document is obsolete since Alpine no longer is based on Gentoo. Please use the 1.9 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.

If you already done this part and only want to 'update your build env.' then see bottom of this page.

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

or if you dont have /proc/config.gz:

grep CONFIG_UID16 /boot/config-`uname -r`

You should se something like:

CONFIG_UID16=y

Step-by-step

Before you go on please read this!

1) There is the hard way - do it yourself - if you want that go on with step-by-step
2) The quick/easy way: download a script that will do it for you: http://dev.alpinelinux.org/~abrodman/create-alpine-sdk.sh
   1) download the script
   2) chmod +x create-alpine-sdk.sh
   3) sudo ./create-alpine-sdk.sh
   -> it will download, unpack and compile everything for you
   -> location: /opt/alpine/alpine-sdk


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

  • Download latest buildroot package from http://dev.alpinelinux.org/alpine/v1.7/sdk/ 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/alpine-sdk
cd /opt/alpine/alpine-sdk
wget -q -O - http://dev.alpinelinux.org/alpine/v1.7/sdk/alpine-sdk-latest.tar.bz2\
    | sudo tar -vjxp
cd ..
sudo ln -s alpine-sdk 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
  • Enter the chroot and change the prompt to reflect your chroot environment
sudo chroot /opt/alpine/1.7 /bin/bash --login
echo 'PS1="(chroot)$PS1"' >> /etc/profile

Now we are in the build environment chroot.

  • Download latest portage snapshot portage-latest.tar.bz2 from Gentoo and unpack it to /usr
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

NOTE: The trunk is constantly changing. You might want to use a tagged release like svn://svn.alpinelinux.org/alpine-builder/tags/release-1.7.7

  • Configure portage to use the config from alpine-builder.
rm -r /etc/make.conf /etc/portage
ln -s /usr/src/alpine/sdk/etc/make.conf /etc
ln -s /usr/src/alpine/sdk/etc/portage /etc
  • Update the portage tree (this takes some time first time you do it)
emerge --sync
  • Build the alpine images (iso, usb, flash, etc.)
cd /usr/src/alpine
make

Failure compiling ipp2p: just manually 'emerge iptables' and issue 'make' again.


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.


NOTE when leaving chroot: When leaving your chroot, you should unmount the /proc

exit
sudo umount /opt/alpine/1.7/proc

Updating the build env.

If you already setup the build env earlier and only want to enter it, update it and maybe create a iso, then this part of the documentation is what you are looking for.

  • Mount proc.
sudo mount -t proc proc /opt/alpine/1.7/proc
  • Enter the chroot and change the prompt to reflect your chroot environment
sudo chroot /opt/alpine/1.7 /bin/bash --login

Now we are in the build environment chroot.

  • Update the portage snapshot from Gentoo
emerge --sync

When emerge has done syncing, you could be advised to update the portage. In such case, you just follow instructions.

One instruction could be "* To update portage, run 'emerge portage'".

emerge portage

Another case could be that you see "* IMPORTANT: x config files in '/etc' need updating.". In that case run the dispatch-conf tool.

dispatch-conf

In most cases (when using the 'dispatch-conf') you should use the new config (by pressing 'u' in the console).

  • Check out the alpine-portage overlay from svn.
cd /usr/alpine-portage && svn up
  • Download all the tbz2 packages into the var/cache/packages directory. This is probably easiest with rsync.
rsync -rauv rsync://distrib-coffee.ipsl.jussieu.fr/pub/linux/alpine/alpine/v1.7/tbz2/* /var/cache/packages/
  • Check out the alpine-builder scripts in usr/src/
cd /usr/src/alpine && svn up
  • Build the alpine images (iso, usb, flash, etc.)
cd /usr/src/alpine/iso
make iso


NOTE when leaving chroot: When leaving your chroot, you should unmount the /proc

exit
sudo umount /opt/alpine/1.7/proc