Setting up the build environment on HDD: Difference between revisions

From Alpine Linux
(link to Setup system for building packages)
(changed introduction paragraph)
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== Introduction  ==
Install Alpine Linux in [[Setting up disks manually|System Disk]] mode i.e traditional or classic harddisk installation to use as build environment. [[Tutorials_and_Howtos#Desktop|Configure the desktop]] so that the development system can also be used to daily drive, if required.  
In earlier days, Alpine used a separate Gentoo build environment. Nowadays we build in Alpine itself, and things are much simpler.


We will host this build environment on a HDD installed Alpine, using the "edge" repository.
If the existing Alpine Linux installation is on a stable version, [[#Upgrade to edge|upgrade to edge]] to use as build environment.


Another method is to setup a clean Alpine build environment inside another system, using a [[Installing Alpine Linux in a chroot|chroot]] or some form of [[:Category:Virtualization|virtualization]]. The host system may also be Alpine, or may be something else.
Alternates are to setup a clean Alpine Linux build environment inside another system, using a [[Installing Alpine Linux in a chroot|chroot]] or some form of [[:Category:Virtualization|virtualization]]. The host system may also be Alpine Linux, or may be something else.


== Boot your build environment  ==
== Upgrade to edge ==
Boot the latest [http://alpinelinux.org/downloads Alpine Linux image] on a box with a HDD.


== Basic setup ==
{{:Include:Upgrading to Edge}}
Set basic environment settings (when prompted for disk, select the disk(s) that you wish to use, and use them in sys mode.  Note that if you specify two disks, soft raid will be setup on them automatically).
{{Cmd|setup-alpine}}


For more details, see [[Installation]] or [[setup-alpine]].
== Setup your system and account ==
{{:Setup your system and account for building packages}}


== Change your repository to use "edge" ==
== Contribute ==


{{Cat|/etc/apk/repositories|
Proceed to [[Creating_an_Alpine_package|create new package]] or [[Development using git:Creating patches|create and submit patches]] for Alpine Linux.
http://dl-4.alpinelinux.org/alpine/edge/main/
http://dl-4.alpinelinux.org/alpine/edge/testing/
}}
 
'''''Note:''' You can replace 'dl-4' with some other available [[Project:Mirrors|mirror]].''
 
== Update/upgrade your system ==
{{Cmd|apk update
apk upgrade}}
 
[[Setup your system and account for building packages]].
 
Then reboot your system.
 
== Start building packages ==
Now you can move on to [[Creating_an_Alpine_package|creating packages for Alpine.]]


[[Category:Development]]
[[Category:Development]]
[[Category:Installation]]

Latest revision as of 04:15, 18 February 2025

Install Alpine Linux in System Disk mode i.e traditional or classic harddisk installation to use as build environment. Configure the desktop so that the development system can also be used to daily drive, if required.

If the existing Alpine Linux installation is on a stable version, upgrade to edge to use as build environment.

Alternates are to setup a clean Alpine Linux build environment inside another system, using a chroot or some form of virtualization. The host system may also be Alpine Linux, or may be something else.

Upgrade to edge

An upgrade of Alpine Linux from a stable version to the rolling development version edge basically requires the same steps as Upgrading to latest release.

The crucial difference is, that when editing the /etc/apk/repositories file, all referenced repository versions (such as v3.21 or latest-stable) therein need to be pointing to edge.

When using edge branch, testing repository can be added if the packages that one needs are available only in testing repository.

Note: Remember that, packages in testing repository have no support.


Contents of /etc/apk/repositories

#/media/cdrom/apks http://dl-cdn.alpinelinux.org/alpine/edge/main http://dl-cdn.alpinelinux.org/alpine/edge/community http://dl-cdn.alpinelinux.org/alpine/edge/testing

After upgrading to edge, the currently installed edge version may be checked with

$ cat /etc/alpine-release

and referring to the build date that is attached to the release.

Warning: Do not enable stable and edge repos at the same time. This can break your system. Either use edge or stable. If you mix stable and edge repositories, you're on your own.


Setup your system and account

The alpine-sdk is a metapackage that pulls in the most essential packages used to build new packages. Also install and configure a way to elevate privileges, such as sudo or doas, and an editor, such as vi, nano, micro.

# apk add alpine-sdk

This would be a good time to create a normal user account for you to work in. To make life easier later, it's a good idea to add this user to the wheel group; operations that require superuser privileges can now be done with sudo or doas.

The aports tree is in git so before we clone it, let's configure git.

Configure your global git config

Configure your name and email address in git. This name and email address will show up in all your commits:

$ git config --global user.name "Your Full Name" $ git config --global user.email "your@email.address"

Using git config without --global let you configure other details for a specific git repository.

Refer Development using git to grasp basics of Git operations.

Configure abuild

Abuild needs to be configured for both the system and user.

Edit the file /etc/abuild.conf as per requirements. Most of the defaults can be left alone, unless you are developing for a custom platform, in which case the comments in the file should guide you. The one field to edit is PACKAGER, so that you can get credit (or blame) for packages you create.

In order to use abuild command The user executing abuild must be a member of the abuild group:

# addgroup <yourusername> abuild

Note: Remember to logout and login again for the group change to have effect.

For abuild a public/private rsa key pair is needed. The abuild-keygen command from abuild package generates and configures the security keys.

$ doas abuild-keygen -a -i

abuild-keygen options

  • -a Set PACKAGER_PRIVKEY=<generated key> in abuild.conf
  • -i Install public key into /etc/apk/keys using sudo
  • -h Show this help
  • -n Non-interactive. Use defaults
  • -q Quiet mode


Contribute

Proceed to create new package or create and submit patches for Alpine Linux.