Skip to content

Instantly share code, notes, and snippets.

@waitman
Last active June 29, 2016 13:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waitman/07d16e15ee3d7eee5cbe to your computer and use it in GitHub Desktop.
Save waitman/07d16e15ee3d7eee5cbe to your computer and use it in GitHub Desktop.
## Using NetBSD's pkgsrc on your LFS machine.
Waitman Gobble <ns@waitman.net> 2014-05-24
Screenshot
https://drive.google.com/file/d/0B36Q8PTNQbjxV0ZoY1F0X3BWNVk/edit?usp=sharing
*These are notes about building xfce4 and xorg on Linux 3.14/glibc-2.19/gcc 4.8.2 using NetBSD pkgsrc.
Takes about 8-12 hours to build on an AMD A8 (4 processor cores)*
References:
http://wiki.netbsd.org/pkgsrc/how_to_install_modular_xorg/
https://wiki.netbsd.org/pkgsrc/how_to_use_pkgsrc_on_linux/
http://www.linuxfromscratch.org/blfs/view/svn/general/which.html
https://wiki.netbsd.org/pkgsrc/
http://www.netbsd.org/docs/software/packages.html
http://www.netbsd.org/docs/pkgsrc/
Why use pkgsrc? NetBSD's pkgsrc can be used on many different architectures including GNU/Linux. Pkgsrc is a
robust array of applications, servers, services and libraries. Dependencies are already worked out, and source
archives are automatically downloaded and managed. If you build binary packages from source then you can
easily transfer these to your other machines of the same architecture. Pkgsrc does not include the actual
source code of the programs it installs, but it contains a Makefile which is the instructions to download
and build the software and it's dependencies. pkgsrc also has tools to check for vulnerabilities in programs,
and makes upgrading a much simpler process compared to manual source installs.
When you reach LFS chapter 8 and build Linux, do a 'make firmware_install' after the 'make modules_install'
step. This will compile and install the necessary firmware (especially for your video card, and maybe your
wireless card). Note that you may need to further configure your kernel to get the necessary video support.
For example, you may need to add support for 'radeon'. It is recommended to set the video support to 'm'
(module) instead of 'Y' (compiled into the kernel) .. (I believe a 'Y' setting will cause the machine to
crash on boot). Generally it is faster to use vim to edit the Linux config file instead of using the ncurses
helper ui. When you make changes by editing the config file, the build script may ask you to confirm the
installation of 'related' things to the modules you select. The prompts may vary depending on the modules
selected for your machine. You may have to research documentation found on various websites in order to select
the best answer to the prompts. If you aren't sure about which modules to build, one way is to run a Live Linux
instance, open a terminal and type 'lsmod' to see which modules are loaded. Also you can check the dmesg output.
Using the config file from the live linux is a possibility however should probably be avoided.
It is recommended to get pkgsrc from the host machine (or a live Linux) because LFS does not install wget. You
can install wget, etc in BLFS but this may duplicate programs installed through pkgsrc. However you will need
one BLFS package, Which-2.20 available at http://www.linuxfromscratch.org/blfs/view/svn/general/which.html .
This program is used in the Xfce4 startup script to determine application locations. 'Which' is not available
in pkgsrc.
Download pkgsrc to your machine at the following URL:
http://ftp.netbsd.org/pub/pkgsrc/stable/pkgsrc.tar.gz
Then run bootstrap.
```
# cd pkgsrc/bootstrap
# ./bootstrap
```
General build instructions for pkgsrc.
Note: software is installed into /usr/pkg by default. This location can be changed in mk.conf, however it is
recommended to keep your LFS install pristine and install software in an alternate location, so the default is
a good choice.
mk.conf is located in /usr/pkg/etc/mk.conf. For the modular Xorg install, you should add the following line
to mk.conf:
X11_TYPE= modular
After you locate the package you wish to install, change to the directory and build the software. The first
thing you might wish to add is 'wget'. All packages in pkgsrc require bmake (BSD Make) to build. GNU Make
(make) will not work, as the Makefiles are specifically made for the bmake program. bmake is installed in
the bootstrap process. If you receive an error such as 'no file or directory' when trying to run bmake, check
that your path includes /usr/pkg/bin and /usr/pkg/sbin.
```
# cd pkgsrc/net/wget
# bmake package
```
We use 'bmake package' to build a binary package, which is installed. This makes it easier to install on other
machines with identical architecture, or to restore a botched system. The binary packages will reside, by default,
in pkgsrc/packages. For wget, the binary package will be located at pkgsrc/packages/net/wget-1.15nb1.tgz
To install the wget binary package you built, you can issue the following command:
```
# pkg_add pkgsrc/packages/net/wget-1.15b1.tgz
```
The other package you want to build is expat, located in textproc/expat. This package is required to build
x11/xlogo, however it is not installed until fontconfig is installed (after the apps).
To install xfce4, switch to the pkgsrc/meta-pkgs/xfce4 and run 'bmake package'. It may take several hours to
complete but will create a working Xfce4 install on your computer. However, it will not run without first
installing X.org.
Before you install [X.org](http://x.org/) you will need to comment out a few programs from the Makefile. These
programs appear to have some code written in the 1990's which reference obsolete and deprecated functions.
There are possibily workarounds to getting these programs to install, for example using CFLAGS+= -D_XOPEN_SOURCE
with various versions, however it seems that there may still be build issues and the work involved may not
warrant the effort put into it, as the functionality of these applications is probably not super-important.
Edit pkgsrc/meta-pkgs/modular-xorg-apps/Makefile and comment out the following applications listed as
dependencies: (place a # before the line)
```
x11/xfwp
x11/xhost
x11/xkbevd
x11/xkbutils
x11/xkbprint
```
Then you can do a 'bmake package' in each meta-pkgs path, per the directions for
'modular [X.org](http://x.org/) install'
```
# cd pkgsrc/x11/modular-xorg-server
# bmake package
# cd pkgsrc/meta-pkgs/modular-xorg-apps
# bmake package
# cd pkgsrc/meta-pkgs/modular-xorg-fonts
# bmake package
# cd pkgsrc/x11/xf86-input-keyboard
# bmake package
# cd pkgsrc/x11/xf86-input-mouse
# bmake package
(install your driver, for example radeon:)
# cd pkgsrc/x11/xf86-video-ati
# bmake package
Now you can configure X automatically by issuing the following as root:
# X -configure
To start Xfce4, you can run:
# startxfce4
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment