1. Introduction Gentoo Benefits How I port
.
Porting Gentoo to DragonFly
.
Naohiro Aota
03/20 2011
Naohiro Aota Porting Gentoo to DragonFly
2. Introduction Gentoo Benefits How I port
. Presentation Aims
To show Gentoo benefits
Naohiro Aota Porting Gentoo to DragonFly
3. Introduction Gentoo Benefits How I port
. Presentation Aims
To show Gentoo benefits
To get more Gentoo/BSD users
Naohiro Aota Porting Gentoo to DragonFly
4. Introduction Gentoo Benefits How I port
. Presentation Aims
To show Gentoo benefits
To get more Gentoo/BSD users
To improve Gentoo/BSD
Naohiro Aota Porting Gentoo to DragonFly
5. Introduction Gentoo Benefits How I port
. Agenda
Gentoo and Gentoo/*BSD
Gentoo Benefits: Ports vs Portage
(How I port Gentoo)
Naohiro Aota Porting Gentoo to DragonFly
6. Introduction Gentoo Benefits How I port
. About DragonFly?
Visit http://www.dragonflybsd.org/
Naohiro Aota Porting Gentoo to DragonFly
7. Introduction Gentoo Benefits How I port
. About Gentoo
Linux distribution
without rpm
without deb
build everything from source
like ports and pkgsrc
Naohiro Aota Porting Gentoo to DragonFly
8. Introduction Gentoo Benefits How I port
. Portage
Package management and build system
ebuild: package file
bash script
executed within special environment
Naohiro Aota Porting Gentoo to DragonFly
9. Introduction Gentoo Benefits How I port
. Getnoo/*BSD
one of Gentoo projects
BSD based Gentoo
like Debian/kFreeBSD
Naohiro Aota Porting Gentoo to DragonFly
10. Introduction Gentoo Benefits How I port
. Gentoo/*BSD (2)
kernel C library/userland
Debian/kFreeBSD FreeBSD GNU
Gentoo/*BSD *BSD *BSD
Gentoo/*BSD support
FreeBSD (7.2 and 8.0 on x86)
unofficial amd64 is also available
NetBSD (5.0 on x86) (experiment)
DragonFly (2.6.3) (unofficial)
Naohiro Aota Porting Gentoo to DragonFly
11. Introduction Gentoo Benefits How I port
. Portage Repository
like Ports, Portage has local repository tree
FreeBSD Ports /usr/ports
editors/emacs
Makefile
Gentoo Portage /usr/portage
app-editors/emacs
emacs-18.59-r6.ebuild
<snip>
emacs-23.3.ebuild
Use command line tool to install package
No “cd”, just “emerge foobar”
Naohiro Aota Porting Gentoo to DragonFly
12. Introduction Gentoo Benefits How I port
. USE flag
FreeBSD ports
WITH_PNG=true
Gentoo Portage
USE=”png”
Naohiro Aota Porting Gentoo to DragonFly
13. Introduction Gentoo Benefits How I port
. Why Gentoo?
Gentoo = build everything from source
Naohiro Aota Porting Gentoo to DragonFly
14. Introduction Gentoo Benefits How I port
. Why Gentoo?
Gentoo = build everything from source
Why not Ports?
Why not pkgsrc?
Why Gentoo?
Naohiro Aota Porting Gentoo to DragonFly
15. Introduction Gentoo Benefits How I port
. Why Gentoo?
Gentoo = build everything from source
Why not Ports?
Why not pkgsrc?
Why Gentoo?
Talk about Gentoo benefits
Naohiro Aota Porting Gentoo to DragonFly
16. Introduction Gentoo Benefits How I port
. Able to select version
Old version provided
eselect
Naohiro Aota Porting Gentoo to DragonFly
17. Introduction Gentoo Benefits How I port
. eselect
FreeBSD ports
lang/python25, python26, python27, python31
Gentoo Portage
dev-lang/python
eselect
Naohiro Aota Porting Gentoo to DragonFly
18. Introduction Gentoo Benefits How I port
. Parallel build
Ports: build B -> C -> A
Portage: parallel package installation
build B and C in parallel
and then build A
Naohiro Aota Porting Gentoo to DragonFly
19. Introduction Gentoo Benefits How I port
. news item
notify important changes
Ports: DONT forget to read /usr/ports/UPDATING
Portage: notification displayed
package specific news
Ports: grep AFFECTS line
Portage: hide not affecting news
Naohiro Aota Porting Gentoo to DragonFly
20. Introduction Gentoo Benefits How I port
. multi repositories
handle multi repositories
repository management tool: layman
support many sync method
just one command sync all repositories
Naohiro Aota Porting Gentoo to DragonFly
21. Introduction Gentoo Benefits How I port
. sandbox
To avoid evil packages
Separate install process from system
Avoid read from/write to system
Naohiro Aota Porting Gentoo to DragonFly
22. Introduction Gentoo Benefits How I port
. sandbox problem with DragonFly
sandbox read /proc to determine process name
DragonFly return different errno
Use LD_PRELOAD hack
static linked /bin/*
dynamic lined libgcc
Naohiro Aota Porting Gentoo to DragonFly
23. Introduction Gentoo Benefits How I port
. OpenRC
service management system
Dependency based startup
Parallel startup/shutdown
Naohiro Aota Porting Gentoo to DragonFly
24. Introduction Gentoo Benefits How I port
. Catalyst
release metatool used for creating releases based on Gentoo
Linux
LiveCD
install minimal file
Naohiro Aota Porting Gentoo to DragonFly
25. Introduction Gentoo Benefits How I port
. Catalyst problem
Linuxism / GNUism / bashism
sed
Naohiro Aota Porting Gentoo to DragonFly
26. Introduction Gentoo Benefits How I port
. Conclusion
Portage is much like Ports
but has superior features
Maintaining Portage package may help *BSD
Detect Linuxism, GNUism and bashism
sending patch to upstream
Naohiro Aota Porting Gentoo to DragonFly
27. Introduction Gentoo Benefits How I port
. Detail in porting
(maybe) boring technical details
(maybe) sleep time ;)
Naohiro Aota Porting Gentoo to DragonFly
28. Introduction Gentoo Benefits How I port
. roadmap
Install official DragonFly
Install Portage
Create repository for DragonFly
Write system packages
Build, fix, and build . . .
Naohiro Aota Porting Gentoo to DragonFly
29. Introduction Gentoo Benefits How I port
. Install Portage
Install Python
and just unpack Portage source
run self test script
patch to fix mkdir(“/”) needed
Naohiro Aota Porting Gentoo to DragonFly
30. Introduction Gentoo Benefits How I port
. Setup tree for DragonFly
Create own repository for x86-dfbsd
Repository layout
repository name
architecture support
DragonFly system package category
Naohiro Aota Porting Gentoo to DragonFly
31. Introduction Gentoo Benefits How I port
. profiles
Specify system core packages
What package should not be used
What USE flag should/should not be used
Naohiro Aota Porting Gentoo to DragonFly
32. Introduction Gentoo Benefits How I port
. baselayout
Gentoo primitive package
Basic configuration files
/etc/hosts, shells . . .
need to work on DragonFly
Naohiro Aota Porting Gentoo to DragonFly
33. Introduction Gentoo Benefits How I port
. sandbox
Feature
a Gentoo util
Separate install process from system
Avoid read from/write to system
Problem
/proc entry
ERANGE vs ENAMETOOLONG
Naohiro Aota Porting Gentoo to DragonFly
34. Introduction Gentoo Benefits How I port
. OpenRC
Feature
Gentoo service management system
Dependency based service startup and shutdown
Problem
When shutdown
Wait for all process to stop
Kernel thread (pid = -1) exists and cannot be killed
Naohiro Aota Porting Gentoo to DragonFly
35. Introduction Gentoo Benefits How I port
. ld-elf.so.2 problem
Problem
Cannot load any library
cause segmentation fault
Solution
need to change binary format
from “em=freebsd”, “targ_emul=elf_i386_fbsd”
to “em=386bsd”, “targ_emul=elf_i386”
Naohiro Aota Porting Gentoo to DragonFly
36. Introduction Gentoo Benefits How I port
. linking problems
Problem
“sandbox” access check problem
LD_PRELOAD hack not worked
/bin/* static linked
Solution
Changed to link dynamically to libc.so
Naohiro Aota Porting Gentoo to DragonFly
37. Introduction Gentoo Benefits How I port
. libgcc linking problem
Problem
/bin/* dynamically linked to libgcc_s.so under /usr
Solution
Modify dragonfly-spec.h to link libgcc statically
Naohiro Aota Porting Gentoo to DragonFly