Gentoo Archives: gentoo-dev

From: Peter Johanson <latexer@g.o>
To: gentoo-dev@l.g.o, gentoo-dev@l.g.o, brix@××××.org, x86-kernel@g.o
Subject: Re: [gentoo-dev] [LAST CHANCE]: kernel + kernel module ebuild changes
Date: Wed, 17 Mar 2004 23:55:23
Message-Id: 20040317235505.GA7882@gonzo.wireless.peterjohanson.com
In Reply to: Re: [gentoo-dev] [LAST CHANCE]: kernel + kernel module ebuild changes by Georgi Georgiev
1 On Thu, Mar 18, 2004 at 08:47:30AM +0900, Georgi Georgiev wrote:
2 > maillog: 16/03/2004-10:00:45(-0500): Peter Johanson types
3 > > 3) config-kernel - A new tool for manipulating a few things relating to
4 > > your kernel environment. It is purely meant to affect the way your
5 > > kernels live on your system, and NOT for generating kernels, etc.
6 > > Features include:
7 > > - setting a prefix for kernel output (e.g. a new kernel
8 > > 2.6.4-mm1 will have it's output set to
9 > > /var/tmp/kernel-output/2.6.4-mm1). Users can choose a new prefix, or
10 > > disable using koutput using config-kernel.
11 >
12 > How exactly is this going to be implemented? Is the tool going to write to a
13 > config file or create a symlink /usr/src/linux-output for example? Don't forget
14
15 All variables that affect things are going into /etc/env.d/05kernel
16
17
18 > that the user would have to still be able to easily compile a kernel on their
19 > own using the methods they are used to, i.e. make config, make menuconfig, make
20
21 They *will*. Things will be mostly transparent to the user. When a new
22 kernel is installed, or if a user does "config-kernel --make-koutput
23 /usr/src/linux-2.6.4" the toplevel makefile is edited to add the line
24 KBUILD_OUTPUT=/var/tmp/kernel-output/$KV
25
26 By adding this variable, when someone does:
27 # make menuconfig
28 in that source tree, all the output files end up wherever KBUILD_OUTPUT
29 points to. that's all it takes. You can run all the normal make commands
30 as normal, but things end up elsewhere. No nasty hacking. The below
31 stuff is unnessecary.
32
33 When users want to override the output, *then* they can specify things
34 on the command line. A normal user wanting to build a kernel for some
35 Alpha box they have can do the following:
36 $ mkdir ~/kernel-output/2.6.4-alpha
37 $ cd /usr/src/linux-2.6.4
38 $ make ARCH=alpha O=~/kernel-output/2.6.4-alpha menuconfig
39 $ make ARCH=alpha O=~/kernel-output/2.6.4-alpha
40
41 And they've then built a kernel for an alpha (assuming they have the
42 toolchain in their PATH, etc, etc) against the sources they had no write
43 access to.
44
45 This make sense?
46
47 -pete
48
49
50
51 > all, etc. I've been using a similar system on some of my machines (some where I
52 > don't have nvidia cards), and I implemented it the following way:
53 >
54 > $ ls -F /usr/src/linux-build
55 > 2.6.3-x1/
56 > 2.6.4-x1/
57 > CVS/
58 > _makefile
59 >
60 > $ readlink /usr/src/linux-build/2.6.4-x1/makefile
61 > ../_makefile
62 >
63 > $ cat /usr/src/linux-build/_makefile # I am dropping some irrelevant lines
64 > ifeq (,$(VERSION))
65 > -include Makefile
66 > ifeq (,$(VERSION))
67 > version_item = $(shell perl -e '@a=("$(1)"=~m,(\d+)\.(\d+)\.(\d+)([-_].+)?(-[^-/]+?)$$,);print $$a[$(2)]')
68 > dummy := $(shell echo VERSION = $(call version_item,$(shell basename $(CURDIR)),0) > Makefile)
69 > dummy := $(shell echo PATCHLEVEL = $(call version_item,$(shell basename $(CURDIR)),1) >>Makefile)
70 > dummy := $(shell echo SUBLEVEL = $(call version_item,$(shell basename $(CURDIR)),2) >>Makefile)
71 > dummy := $(shell echo EXTRAVERSION= $(call version_item,$(shell basename $(CURDIR)),3)$(call version_item,$(shell basename $(CURDIR)),4) >>Makefile)
72 > include Makefile
73 > endif
74 >
75 > SRCVER = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(X_RCVERSION)
76 > SRCTREE = $(SRC_PREFIX)/usr/src/linux-$(SRCVER)
77 > FLAGS += -C $(SRCTREE) O=$(O) VERSION=$(VERSION) PATCHLEVEL=$(PATCHLEVEL) SUBLEVEL=$(SUBLEVEL) EXTRAVERSION=$(EXTRAVERSION)
78 >
79 > # this I need for some module-building
80 > ifdef SUBDIRS
81 > FLAGS += SUBDIRS=$(SUBDIRS)
82 > endif
83 >
84 > kernel_targets=menuconfig config oldconfig gconfig xconfig all modules bzImage modules_install
85 >
86 > $(kernel_targets):
87 > $(MAKE) $(FLAGS) $@
88 >
89 > flags:
90 > @echo $(FLAGS)
91 >
92 > source-location:
93 > @echo $(SRCTREE)
94 >
95 > build-location:
96 > @echo $(O)
97 >
98 > # the ugliest target follows
99 > install:
100 > sh $(SRCTREE)/arch/$(myARCH)/boot/install.sh $(FULLVER) $(FULLVER)/arch/$(myARCH)/boot/bzImage $(FULLVER)/System.map ""
101 >
102 > endif
103 >
104 > # vim:ft=make:
105 >
106 > $ make -C /usr/src/linux-build/2.6.4-x1/ flags
107 > make: Entering directory `/usr/src/linux-build/2.6.4-x1'
108 > -C /usr/src/linux-2.6.4 O=/usr/src/linux-build/2.6.4-x1 VERSION=2 PATCHLEVEL=6 SUBLEVEL=4 EXTRAVERSION=-x1
109 > make: Leaving directory `/usr/src/linux-build/2.6.4-x1'
110 >
111 > Comments?
112 >
113 > --
114 > /\ Georgi Georgiev /\ BOFH Excuse #328: Fiber optics caused gas /\
115 > \/ chutz@×××.net \/ main leak \/
116 > /\ +81(90)6266-1163 /\ /\
117
118
119
120 --
121 Peter Johanson
122 <latexer@g.o>
123
124 Key ID = 0x6EFA3917
125 Key fingerprint = A90A 2518 57B1 9D20 9B71 A2FF 8649 439B 6EFA 3917

Replies

Subject Author
Re: [gentoo-dev] [LAST CHANCE]: kernel + kernel module ebuild changes Georgi Georgiev <chutz@×××.net>