37
Introduction Gentoo Benefits How I port . . Porting Gentoo to DragonFly Naohiro Aota 03/20 2011 Naohiro Aota Porting Gentoo to DragonFly

Porting Gentoo to DragonFly

Embed Size (px)

Citation preview

Page 1: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.

......Porting Gentoo to DragonFly

Naohiro Aota

03/20 2011

Naohiro Aota Porting Gentoo to DragonFly

Page 2: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Presentation Aims

To show Gentoo benefits

To get more Gentoo/BSD usersTo improve Gentoo/BSD

Naohiro Aota Porting Gentoo to DragonFly

Page 3: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Presentation Aims

To show Gentoo benefitsTo get more Gentoo/BSD users

To improve Gentoo/BSD

Naohiro Aota Porting Gentoo to DragonFly

Page 4: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Presentation Aims

To show Gentoo benefitsTo get more Gentoo/BSD usersTo improve Gentoo/BSD

Naohiro Aota Porting Gentoo to DragonFly

Page 5: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Agenda

Gentoo and Gentoo/*BSDGentoo Benefits: Ports vs Portage(How I port Gentoo)

Naohiro Aota Porting Gentoo to DragonFly

Page 6: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. About DragonFly?

Visit http://www.dragonflybsd.org/

Naohiro Aota Porting Gentoo to DragonFly

Page 7: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. About Gentoo

Linux distribution

without rpmwithout debbuild everything from sourcelike ports and pkgsrc

Naohiro Aota Porting Gentoo to DragonFly

Page 8: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Portage

Package management and build systemebuild: package file

bash scriptexecuted within special environment

Naohiro Aota Porting Gentoo to DragonFly

Page 9: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Getnoo/*BSD

one of Gentoo projectsBSD based Gentoo

like Debian/kFreeBSD

Naohiro Aota Porting Gentoo to DragonFly

Page 10: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Gentoo/*BSD (2)

kernel C library/userlandDebian/kFreeBSD FreeBSD GNUGentoo/*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

Page 11: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Portage Repository

like Ports, Portage has local repository tree

FreeBSD Ports /usr/portseditors/emacsMakefile

Gentoo Portage /usr/portageapp-editors/emacsemacs-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

Page 12: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. USE flag

FreeBSD ports

WITH_PNG=true

Gentoo Portage

USE=”png”

Naohiro Aota Porting Gentoo to DragonFly

Page 13: Porting Gentoo to DragonFly

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

Page 14: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Why Gentoo?

Gentoo = build everything from sourceWhy not Ports?Why not pkgsrc?Why Gentoo?

Talk about Gentoo benefits

Naohiro Aota Porting Gentoo to DragonFly

Page 15: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Why Gentoo?

Gentoo = build everything from sourceWhy not Ports?Why not pkgsrc?Why Gentoo?Talk about Gentoo benefits

Naohiro Aota Porting Gentoo to DragonFly

Page 16: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Able to select version

Old version providedeselect

Naohiro Aota Porting Gentoo to DragonFly

Page 17: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. eselect

FreeBSD ports

lang/python25, python26, python27, python31

Gentoo Portage

dev-lang/pythoneselect

Naohiro Aota Porting Gentoo to DragonFly

Page 18: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Parallel build

Ports: build B -> C -> APortage: parallel package installation

build B and C in paralleland then build A

Naohiro Aota Porting Gentoo to DragonFly

Page 19: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. news item

notify important changes

Ports: DONT forget to read /usr/ports/UPDATINGPortage: notification displayed

package specific news

Ports: grep AFFECTS linePortage: hide not affecting news

Naohiro Aota Porting Gentoo to DragonFly

Page 20: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. multi repositories

handle multi repositoriesrepository management tool: layman

support many sync methodjust one command sync all repositories

Naohiro Aota Porting Gentoo to DragonFly

Page 21: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. sandbox

To avoid evil packages

Separate install process from systemAvoid read from/write to system

Naohiro Aota Porting Gentoo to DragonFly

Page 22: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. sandbox problem with DragonFly

sandbox read /proc to determine process nameDragonFly return different errnoUse LD_PRELOAD hack

static linked /bin/*dynamic lined libgcc

Naohiro Aota Porting Gentoo to DragonFly

Page 23: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. OpenRC

service management systemDependency based startupParallel startup/shutdown

Naohiro Aota Porting Gentoo to DragonFly

Page 24: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Catalyst

release metatool used for creating releases based on GentooLinux

LiveCDinstall minimal file

Naohiro Aota Porting Gentoo to DragonFly

Page 25: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Catalyst problem

Linuxism / GNUism / bashism

sed

Naohiro Aota Porting Gentoo to DragonFly

Page 26: Porting Gentoo to DragonFly

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 bashismsending patch to upstream

Naohiro Aota Porting Gentoo to DragonFly

Page 27: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Detail in porting

(maybe) boring technical details(maybe) sleep time ;)

Naohiro Aota Porting Gentoo to DragonFly

Page 28: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. roadmap

Install official DragonFlyInstall PortageCreate repository for DragonFlyWrite system packagesBuild, fix, and build . . .

Naohiro Aota Porting Gentoo to DragonFly

Page 29: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Install Portage

Install Pythonand just unpack Portage sourcerun self test script

patch to fix mkdir(“/”) needed

Naohiro Aota Porting Gentoo to DragonFly

Page 30: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. Setup tree for DragonFly

Create own repository for x86-dfbsdRepository layout

repository namearchitecture supportDragonFly system package category

Naohiro Aota Porting Gentoo to DragonFly

Page 31: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. profiles

Specify system core packagesWhat package should not be usedWhat USE flag should/should not be used

Naohiro Aota Porting Gentoo to DragonFly

Page 32: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. baselayout

Gentoo primitive packageBasic configuration files/etc/hosts, shells . . .need to work on DragonFly

Naohiro Aota Porting Gentoo to DragonFly

Page 33: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. sandbox

Feature

a Gentoo utilSeparate install process from systemAvoid read from/write to system

Problem

/proc entryERANGE vs ENAMETOOLONG

Naohiro Aota Porting Gentoo to DragonFly

Page 34: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. OpenRC

Feature

Gentoo service management systemDependency based service startup and shutdown

Problem

When shutdown

Wait for all process to stopKernel thread (pid = -1) exists and cannot be killed

Naohiro Aota Porting Gentoo to DragonFly

Page 35: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. ld-elf.so.2 problem

Problem

Cannot load any librarycause segmentation fault

Solution

need to change binary formatfrom “em=freebsd”, “targ_emul=elf_i386_fbsd”to “em=386bsd”, “targ_emul=elf_i386”

Naohiro Aota Porting Gentoo to DragonFly

Page 36: Porting Gentoo to DragonFly

Introduction Gentoo Benefits How I port

.. linking problems

Problem

“sandbox” access check problemLD_PRELOAD hack not worked

/bin/* static linked

Solution

Changed to link dynamically to libc.so

Naohiro Aota Porting Gentoo to DragonFly

Page 37: Porting Gentoo to DragonFly

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