Skip to content

Commit

Permalink
Finished updating get-orig-source within kdragonflybsd-3/debian/rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
varialus committed Oct 7, 2012
1 parent e6cb68e commit 6400862
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 62 deletions.
4 changes: 1 addition & 3 deletions README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ToDo:
- Make the kernel source package download and extract automatically.
- Make the kernel source package extract and apply debian patches automatically.
- Make the kernel compile.
- Make related packages compile, including the Hammer and Hammer2 file systems.
- Try to use the kernel with the Hammer or Hammer2 filesystem.
Expand Down Expand Up @@ -39,8 +39,6 @@ In the other console terminal:
- git clone git://github.com/varialus/DragonFlyDebian.git
- cd DragonFlyBSD/kdragonflybsd-3/
- ./debian/rules
- Fix errors.
- Commit to git and push to github.
- dpkg-buildpackage
- Fix errors.
- Commit to git and push to github.
Expand Down
2 changes: 1 addition & 1 deletion kdragonflybsd-3/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dragonflybsd-kernel-3.0 (3.0.1) unstable; urgency=low
dragonflybsd-3 (3.0.3-1) unstable; urgency=low

* Initial release.

Expand Down
107 changes: 49 additions & 58 deletions kdragonflybsd-3/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

SHELL = bash

# Comment this to turn off verbose mode.
export DH_VERBOSE=1
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)

full_version := $(shell /usr/bin/dpkg-parsechangelog | grep ^Version: | sed -e 's/^.*: //g')
tag_version := $(shell echo $(full_version) | sed -e 's/-.*//g')
full_version := $(shell dpkg-parsechangelog | grep ^Version: | sed -e 's/^.*: //g')
tar_version := $(shell echo $(full_version) | sed -e 's/-.*//g')
vcs_revision := $(shell echo $(full_version) | sed -e 's/.*~git\([0-9]*\)-[0-9]*/\1/g')
version := $(shell echo $(full_version) | sed -e 's/[~+-].*//g')
major := $(shell echo $(version) | sed -e 's/\..*//g')
revision := $(shell echo $(full_version) | sed -e 's/^[^+-]*//g')
Expand All @@ -29,52 +30,42 @@ else
kbsd_cpu := $(cpu)
endif

# Debianized
SOURCE_PACKAGE := $(CURDIR)/debian/kdragonflybsd-source-$(full_version)
IMAGE_PACKAGE := $(CURDIR)/debian/kdragonflybsd-image-$(full_version)-$(abiname)
HEADERS_PACKAGE := $(CURDIR)/debian/kdragonflybsd-headers-$(full_version)-$(abiname)

# Non-Debianized
SRC_TAR := kdragonflybsd-source-$(full_version).tar.xz
SRC_DIR := kdragonflybsd-source-$(full_version)
HEADERS_DIR := kdragonflybsd-headers-$(full_version)-$(abiname)
FLAVOR_DIR := flavor-$(full_version)-$(abiname)
ORIG_DIR := kdragonflybsd-$(full_version)
ORIG_TAR := kdragonflybsd-$(full_version).orig.tar.gz

MAKE := make MACHINE_ARCH=$(kdragonflybsd_cpu) CC=gcc-$(gcc_version) WERROR=
# DragonFly Download Sites
# This is a list of all official mirrors of the DragonFly BSD project.
# http://www.dragonflybsd.org/mirrors/
VCS := git://avalon.dragonflybsd.org/dragonfly.git
SOURCE_PACKAGE := $(CURDIR)/debian/kdragonflybsd-source-$(version)
IMAGE_PACKAGE := $(CURDIR)/debian/kdragonflybsd-image-$(version)-$(abiname)
HEADERS_PACKAGE := $(CURDIR)/debian/kdragonflybsd-headers-$(version)-$(abiname)
SRC_TAR := kdragonflybsd-source-$(version).tar.xz
SRC_DIR := kdragonflybsd-source-$(version)
HEADERS_DIR := kdragonflybsd-headers-$(version)-$(abiname)
FLAVOR_DIR := flavor-$(version)-$(abiname)
ORIG_DIR := kdragonflybsd-$(major)-$(tar_version)
ORIG_TAR := kdragonflybsd-$(major)_$(tar_version).orig.tar.gz
MAKE := make MACHINE_ARCH=$(kbsd_cpu) CC=gcc-$(gcc_version) WERROR=
PATH := $(CURDIR)/config:/usr/lib/dragonflybsd:$(PATH)

# Disable install of *.ko.symbols files (their presence would trigger an
# "unstripped-binary-or-object" lintian error).
MAKE += -DWITHOUT_KERNEL_SYMBOLS

# United States, California
dfly_git := git://avalon.dragonflybsd.org/dragonfly.git
# (NOTE: slow)
# dfly_git := git://crater.dragonflybsd.org/dragonfly.git
# United States, Maryland
# dfly_git := git://batman.acm.jhu.edu/dragonfly.git
# Europe, Estonia
# dfly_git := git://anoncvs.estpak.ee/dragonfly.git
# Europe, France
# dfly_git := git://island.quantumachine.net/dragonfly.git
# Europe, Norway
# dfly_git := git://koan.bondconsult.net/dragonfly.git

get-orig-source:
rm -rf $(ORIG_DIR)
mkdir $(ORIG_DIR)
cd $(ORIG_DIR)
git init
git remote add dragonfly $(dfly_git)
git config core.sparsecheckout true
echo sys >> .git/info/sparse-checkout
git checkout $(version)
git pull $(dfly_git)
git archive $(version) | gzip > $(CURDIR)/$(ORIG_TAR)
$(CURDIR)/debian/prune.sh
chown 0:0 $(CURDIR)/$(ORIG_TAR)
cd $(ORIG_DIR) ; git init
cd $(ORIG_DIR) ; git remote add -t refs/tags/v$(version) --no-tags origin $(VCS)
cd $(ORIG_DIR) ; git config core.sparsecheckout true
cd $(ORIG_DIR) ; echo sys >> .git/info/sparse-checkout
cd $(ORIG_DIR) ; echo usr.sbin >> .git/info/sparse-checkout
cd $(ORIG_DIR) ; git fetch --depth=1 origin tag v$(version)
cd $(ORIG_DIR) ; mv .git/HEAD .git/HEAD.orig
cd $(ORIG_DIR) ; cp .git/FETCH_HEAD .git/HEAD
cd $(ORIG_DIR) ; git reset --hard
cd $(ORIG_DIR) ; rm -rf .git
cd $(ORIG_DIR) && $(CURDIR)/debian/prune.sh
tar --numeric-owner --owner 0 --group 0 -czf ../$(ORIG_TAR) $(ORIG_DIR)
rm -rf $(ORIG_DIR)

control: clean
for arch in `ls $(CURDIR)/debian/arch/` ; do \
Expand Down Expand Up @@ -191,17 +182,17 @@ build-flavor-%-stamp: src-flavor-%-stamp
-e 's/elf64-x86-64-dragonflybsd/$(ld_target)/g' \
-e 's/elf32-tradlittlemips-dragonflybsd/$(ld_target)/g' \
-e 's/elf32-tradbigmips-dragonflybsd/$(ld_target)/g' \
$(FLAVOR_DIR)-$*/sys/conf/ldscript.$(kdragonflybsd_cpu)
$(FLAVOR_DIR)-$*/sys/conf/ldscript.$(kbsd_cpu)

# Configure the kernel
cp debian/arch/$(cpu)/$*.config $(FLAVOR_DIR)-$*/sys/$(kdragonflybsd_cpu)/conf/
ln -sf $*.config $(FLAVOR_DIR)-$*/sys/$(kdragonflybsd_cpu)/conf/$(configfile)
cd $(FLAVOR_DIR)-$*/sys/$(kdragonflybsd_cpu)/conf \
cp debian/arch/$(cpu)/$*.config $(FLAVOR_DIR)-$*/sys/$(kbsd_cpu)/conf/
ln -sf $*.config $(FLAVOR_DIR)-$*/sys/$(kbsd_cpu)/conf/$(configfile)
cd $(FLAVOR_DIR)-$*/sys/$(kbsd_cpu)/conf \
&& config $(configfile)

# Build it
$(MAKE) -C $(FLAVOR_DIR)-$*/sys/$(kdragonflybsd_cpu)/compile/$(configfile)/ depend
$(MAKE) -C $(FLAVOR_DIR)-$*/sys/$(kdragonflybsd_cpu)/compile/$(configfile)/
$(MAKE) -C $(FLAVOR_DIR)-$*/sys/$(kbsd_cpu)/compile/$(configfile)/ depend
$(MAKE) -C $(FLAVOR_DIR)-$*/sys/$(kbsd_cpu)/compile/$(configfile)/

touch build-flavor-$*-stamp

Expand All @@ -210,7 +201,7 @@ install-common-stamp: src
dh_testroot
mkdir -p $(HEADERS_PACKAGE)/usr/src/$(HEADERS_DIR)
cd src \
&& find . -type f -name "*.h" -not -regex ".*modules.*" -not -regex ".*sys/$(kdragonflybsd_cpu)/.*" -exec cp --parents {} $(HEADERS_PACKAGE)/usr/src/$(HEADERS_DIR) \;
&& find . -type f -name "*.h" -not -regex ".*modules.*" -not -regex ".*sys/$(kbsd_cpu)/.*" -exec cp --parents {} $(HEADERS_PACKAGE)/usr/src/$(HEADERS_DIR) \;

mkdir -p $(HEADERS_PACKAGE)/usr/src/$(HEADERS_DIR)/conf
cd src && cp --parents \
Expand Down Expand Up @@ -240,7 +231,7 @@ install-flavor-%-stamp: install-common-stamp build-flavor-%-stamp

# make the install target happy
install -o root -g root -m 644 \
$(FLAVOR_DIR)-$*/sys/$(kdragonflybsd_cpu)/conf/GENERIC.hints \
$(FLAVOR_DIR)-$*/sys/$(kbsd_cpu)/conf/GENERIC.hints \
$(IMAGE_PACKAGE)-$*/boot/device.hints || touch $(IMAGE_PACKAGE)-$*/boot/device.hints
install -o root -g root -m 644 \
$(FLAVOR_DIR)-$*/sys/boot/forth/loader.conf \
Expand All @@ -252,11 +243,11 @@ install-flavor-%-stamp: install-common-stamp build-flavor-%-stamp

# install the config file
install -o root -g root -m 644 \
$(FLAVOR_DIR)-$*/sys/$(kdragonflybsd_cpu)/conf/$*.config \
$(FLAVOR_DIR)-$*/sys/$(kbsd_cpu)/conf/$*.config \
$(IMAGE_PACKAGE)-$*/boot/config-$(version)-$(abiname)-$*

# now install the kernel
$(MAKE) -C $(FLAVOR_DIR)-$*/sys/$(kdragonflybsd_cpu)/compile/$(configfile) DESTDIR=$(IMAGE_PACKAGE)-$* install
$(MAKE) -C $(FLAVOR_DIR)-$*/sys/$(kbsd_cpu)/compile/$(configfile) DESTDIR=$(IMAGE_PACKAGE)-$* install
mv $(IMAGE_PACKAGE)-$*/lib/modules/$(version)-$(abiname)-$*/kernel $(IMAGE_PACKAGE)-$*/boot/kdragonflybsd-$(version)-$(abiname)-$*
chmod 644 $(IMAGE_PACKAGE)-$*/boot/kdragonflybsd-$(version)-$(abiname)-$*
gzip -9 $(IMAGE_PACKAGE)-$*/boot/kdragonflybsd-$(version)-$(abiname)-$*
Expand Down Expand Up @@ -292,16 +283,16 @@ install-flavor-%-stamp: install-common-stamp build-flavor-%-stamp
done

# headers package
mkdir -p $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$(kdragonflybsd_cpu)
cd $(FLAVOR_DIR)-$*/sys/$(kdragonflybsd_cpu) \
&& find . -type f -name "*.h" -not -regex ".*modules.*" -exec cp --parents {} $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$(kdragonflybsd_cpu) \; \
&& cp -d --parents compile/$(configfile)/machine $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$(kdragonflybsd_cpu) \
&& cp -d --parents conf/$(configfile) $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$(kdragonflybsd_cpu)
find $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$(kdragonflybsd_cpu) -type f -exec chmod 644 {} \;
mkdir -p $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$(kbsd_cpu)
cd $(FLAVOR_DIR)-$*/sys/$(kbsd_cpu) \
&& find . -type f -name "*.h" -not -regex ".*modules.*" -exec cp --parents {} $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$(kbsd_cpu) \; \
&& cp -d --parents compile/$(configfile)/machine $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$(kbsd_cpu) \
&& cp -d --parents conf/$(configfile) $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$(kbsd_cpu)
find $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$(kbsd_cpu) -type f -exec chmod 644 {} \;
for dir in `ls $(HEADERS_PACKAGE)/usr/src/$(HEADERS_DIR)/sys` ; do \
ln -s ../../$(HEADERS_DIR)/sys/$$dir $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$$dir ; \
done
ln -s $(kdragonflybsd_cpu)/include $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/machine
ln -s $(kbsd_cpu)/include $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/machine

touch install-flavor-$*-stamp

Expand Down

0 comments on commit 6400862

Please sign in to comment.