< Kernel (Português)

Kernel (Português)/Arch Build System (Português)

Veja Kernel (Português) para ir ao artigo principal.

Status de tradução: Esse artigo é uma tradução de Arch Linux. Data da última tradução: 2019-12-20. Você pode ajudar a sincronizar a tradução, se houver alterações na versão em inglês.

O Arch Build System pode ser usado para compilar um kernel personalizado baseado no pacote oficial linux. Este método de compilação pode automatizar todo o processo, além de ser baseado em um pacote bem testado. Você pode editar o PKGBUILD para usar uma configuração personalizada além de poder adicionar patches.

Obtendo os ingredientes

Como você estará usando o makepkg, Siga as práticas recomendadas primeiro. Por exemplo, você nao pode executar o makepkg como root ou usando sudo. Portanto, crie um diretório build na home de seu usuário.

 $ cd ~/
 $ mkdir build
 $ cd build/

Install O pacote asp e o grupo de pacotes base-devel.

You need a clean kernel to start your customization from. ABS#Retrieve PKGBUILD source using Git and few other files into your build directory by running:

$ asp update linux
$ asp export linux

At this point, the directory tree looks like:

~/build/linux/-+
               +--config
               \__PKGBUILD

Then, get any other file you need (e.g. custom configuration files, patches, etc.) from the respective sources.

Modifying the PKGBUILD

Edit PKGBUILD and look for the pkgbase parameter. Change this to your custom package name, e.g.:

 pkgbase=linux-custom

Changing prepare()

In prepare() function, you can apply needed kernel patches or change kernel build configuration.

If you need to change a few config options you can edit config file in the source.

Or you can use GUI tool to tweak the options. Comment make olddefconfig in the prepare() function of the PKGBUILD, and add your favorite tool:

PKGBUILD
...
  msg2 "Setting config..."
  cp ../config .config
  #make olddefconfig

  make nconfig # new CLI menu for configuration
  #make menuconfig # CLI menu for configuration
  #make xconfig # X-based configuration
  #make oldconfig # using old config from previous kernel version
  # ... or manually edit .config
...

Generate new checksums

#Changing prepare() suggests a possible modification to . Since this path is not where downloading the package files ended, its checksum was not checked by makepkg (which actually checked ).

If you replaced the downloaded with another config file before running makepkg, Install the pacman-contrib package. Which will generate new checksums by running:

$ updpkgsums

Compiling

You can now proceed to compile your kernel by the usual command makepkg

If you have chosen an interactive program for configuring the kernel parameters (like menuconfig), you need to be there during the compilation.

 $ makepkg -s

The parameter will download any additional dependencies used by recent kernels such as xml and docs.

Installing

Best practice is to install both packages together as they might be both needed (e.g. DKMS.)

# pacman -U kernel-headers_package kernel_package

Boot loader

If you have modified pkgbase in order to have your new kernel installed alongside the default kernel you will need to update your bootloader configuration file and add new entries ('default' and 'fallback') for your custom kernel and the associated initramfs images.

Updating

Assuming one has an arch kernel source that he wants to update, one method to do that is with https://github.com/archlinux/linux. Follows a concrete example. In what follows, the top kernel source directory is assumed at ~/build/linux/.

In general, arch sets an arch kernel source with two local git repositories. The one at archlinux-linux/ is a local bare git repository pointing to https://github.com/archlinux/linux.git. The other one is at src/archlinux-linux/, pulling from the first repository. Possible local patches, and building, is expected at src/archlinux-linux/.

For this example, the HEAD of the locally installed bare git repository source at archlinux-linux/ was initially pointing to , which is somewhere between v5.2.5-arch1 and v5.2.6-arch1. One can see it fetched v5.2.7-arch1, which was the newest archlinux tag, because it prints what new tags were obtained. If no new tags were obtained then there is no newer archlinux source available.

Now the source can be updated where the actual build will take place.

You can verify you are on track with something like This shows few specific archlinux patches between Linux 5.2.7 and Arch Linux kernel v5.2.7-arch1. The important lines here are Linux 5.2.7 and Arch Linux kernel v5.2.7-arch1. Obviously, there might be other patches at other versions, and the commit identifiers, such as f676926c7f60, as well as the kernel version, will be different for other versions.

The up to date PKGBUILD, as well archlinux kernel configuration file, can be pulled in by the command:

Now you should Vim#Merging files located in ~/build/linux/linux/* into ~/build/linux/. Merging can also done manually, or with list of applications#Comparison, diff, merge. Then run manually most, if not all, the shell commands of PKGBUILD::prepare().

At this point, should succeed. And should be able to build the packages as if the source was extracted by .

gollark: ++exec```haskellwithIndices :: [a] -> [(Int, a)]withIndices = zip [1..]doStuff :: String -> [(Int, Int, Char)]doStuff s = (\(lineIx, l) -> fmap (\(charIx, char) -> (lineIx, charIx, char)) $ withIndices l) `concatMap` withIndices (lines s)main = print . doStuff $ "abcd"```
gollark: >eval 1 + 9
gollark: >fortune
gollark: I should add more command prefixes.
gollark: ++fortune

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.