Gentoo Archives: gentoo-catalyst

From: Brian Dolbec <dolsen@g.o>
To: gentoo-catalyst@l.g.o
Subject: [gentoo-catalyst] [PATCH 05/17] Fix merging kernel without kerncache enabled.
Date: Sat, 22 Mar 2014 17:04:02
Message-Id: 1395507795-13754-6-git-send-email-dolsen@gentoo.org
In Reply to: [gentoo-catalyst] 2.X bugfixes by Brian Dolbec
1 From: Guy Martin <gmsoft@g.o>
2
3 This is the proper fix for building kernels without kerncache.
4 It prevents the creation of kerncache specific files and does not check for them.
5 Build with kerncache require the later patch to work.
6
7 Conflicts:
8 targets/support/kmerge.sh
9 ---
10 targets/support/kmerge.sh | 109 +++++++++++++++++++++++++---------------------
11 1 file changed, 59 insertions(+), 50 deletions(-)
12
13 diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
14 index 8e832e1..fac6e9c 100644
15 --- a/targets/support/kmerge.sh
16 +++ b/targets/support/kmerge.sh
17 @@ -109,7 +109,7 @@ genkernel_compile(){
18 else
19 genkernel ${GK_ARGS} || exit 1
20 fi
21 - if [ -e /var/tmp/${clst_kname}.config ]
22 + if [ -n "${clst_KERNCACHE}" -a -e /var/tmp/${clst_kname}.config ]
23 then
24 md5sum /var/tmp/${clst_kname}.config | awk '{print $1}' > \
25 /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG
26 @@ -144,63 +144,58 @@ fi
27 # USE variables (and thus different patches enabled/disabled.) Also, there's no
28 # real benefit in using the pkgcache for kernel source ebuilds.
29
30 -USE_MATCH=0
31 -if [ -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE ]
32 +
33 +# Check if we have a match in kerncach
34 +
35 +if [ -n "${clst_KERNCACHE}" ]
36 then
37 - STR1=$(for i in `cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE`; do echo $i; done|sort)
38 - STR2=$(for i in ${clst_kernel_use}; do echo $i; done|sort)
39 - if [ "${STR1}" = "${STR2}" ]
40 +
41 + USE_MATCH=0
42 + if [ -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE ]
43 then
44 - #echo "USE Flags match"
45 - USE_MATCH=1
46 - else
47 - if [ -n "${clst_KERNCACHE}" ]
48 + STR1=$(for i in `cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE`; do echo $i; done|sort)
49 + STR2=$(for i in ${clst_kernel_use}; do echo $i; done|sort)
50 + if [ "${STR1}" = "${STR2}" ]
51 then
52 - [ -d /tmp/kerncache/${clst_kname}/ebuilds ] && \
53 - rm -r /tmp/kerncache/${clst_kname}/ebuilds
54 - [ -e /tmp/kerncache/${clst_kname}/usr/src/linux/.config ] && \
55 - rm /tmp/kerncache/${clst_kname}/usr/src/linux/.config
56 + #echo "USE Flags match"
57 + USE_MATCH=1
58 + else
59 + [ -d /tmp/kerncache/${clst_kname}/ebuilds ] && \
60 + rm -r /tmp/kerncache/${clst_kname}/ebuilds
61 + [ -e /tmp/kerncache/${clst_kname}/usr/src/linux/.config ] && \
62 + rm /tmp/kerncache/${clst_kname}/usr/src/linux/.config
63 fi
64 fi
65 -fi
66
67 -EXTRAVERSION_MATCH=0
68 -if [ -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION ]
69 -then
70 - STR1=`cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION`
71 - STR2=${clst_kextraversion}
72 - if [ "${STR1}" = "${STR2}" ]
73 + EXTRAVERSION_MATCH=0
74 + if [ -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION ]
75 then
76 - if [ -n "${clst_KERNCACHE}" ]
77 + STR1=`cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION`
78 + STR2=${clst_kextraversion}
79 + if [ "${STR1}" = "${STR2}" ]
80 then
81 #echo "EXTRAVERSION match"
82 EXTRAVERSION_MATCH=1
83 fi
84 fi
85 -fi
86
87 -CONFIG_MATCH=0
88 -if [ -n "${clst_KERNCACHE}" -a \
89 - -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG ]
90 -then
91 - if [ ! -e /var/tmp/${clst_kname}.config ]
92 + CONFIG_MATCH=0
93 + if [ -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG ]
94 then
95 - CONFIG_MATCH=1
96 - else
97 - STR1=`cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG`
98 - STR2=`md5sum /var/tmp/${clst_kname}.config|awk '{print $1}'`
99 - if [ "${STR1}" = "${STR2}" ]
100 + if [ ! -e /var/tmp/${clst_kname}.config ]
101 then
102 CONFIG_MATCH=1
103 + else
104 + STR1=`cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG`
105 + STR2=`md5sum /var/tmp/${clst_kname}.config|awk '{print $1}'`
106 + if [ "${STR1}" = "${STR2}" ]
107 + then
108 + CONFIG_MATCH=1
109 + fi
110 fi
111 fi
112 -fi
113
114 -[ -e /etc/portage/make.conf ] && \
115 - echo "USE=\"\${USE} ${clst_kernel_use} \"" >> /etc/portage/make.conf
116 -
117 -if [ -n "${clst_KERNCACHE}" ]
118 -then
119 + # Create the kerncache directory if it doesn't exists
120 mkdir -p /tmp/kerncache/${clst_kname}
121 clst_root_path=/tmp/kerncache/${clst_kname} PKGDIR=${PKGDIR} clst_myemergeopts="--quiet --update --newuse" run_merge "${clst_ksource}" || exit 1
122 KERNELVERSION=`portageq best_visible / "${clst_ksource}"`
123 @@ -216,26 +211,39 @@ then
124 fi
125 [ -L /usr/src/linux ] && rm -f /usr/src/linux
126 ln -s /tmp/kerncache/${clst_kname}/usr/src/linux /usr/src/linux
127 +
128 + # If catalyst has set to a empty string, extraversion wasn't specified so we
129 + # skip this part
130 + if [ "${EXTRAVERSION_MATCH}" = "0" ]
131 + then
132 + if [ ! "${clst_kextraversion}" = "" ]
133 + then
134 + echo "Setting extraversion to ${clst_kextraversion}"
135 + sed -i -e "s:EXTRAVERSION \(=.*\):EXTRAVERSION \1-${clst_kextraversion}:" /usr/src/linux/Makefile
136 + echo ${clst_kextraversion} > /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION
137 + else
138 + touch /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION
139 + fi
140 + fi
141 +
142 else
143 [ -L /usr/src/linux ] && rm -f /usr/src/linux
144 run_merge "${clst_ksource}" || exit 1
145 -fi
146 -make_destpath
147 -
148 -# If catalyst has set to a empty string, extraversion wasn't specified so we
149 -# skip this part
150 -if [ "${EXTRAVERSION_MATCH}" = "0" ]
151 -then
152 if [ ! "${clst_kextraversion}" = "" ]
153 then
154 echo "Setting extraversion to ${clst_kextraversion}"
155 sed -i -e "s:EXTRAVERSION \(=.*\):EXTRAVERSION \1-${clst_kextraversion}:" /usr/src/linux/Makefile
156 - echo ${clst_kextraversion} > /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION
157 - else
158 - touch /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION
159 fi
160 fi
161
162 +
163 +# Update USE flag in make.conf
164 +[ -e ${clst_make_conf} ] && \
165 + echo "USE=\"\${USE} ${clst_kernel_use} build\"" >> ${clst_make_conf}
166 +
167 +make_destpath
168 +
169 +
170 build_kernel
171 sed -i "/USE=\"\${USE} ${clst_kernel_use} \"/d" /etc/portage/make.conf
172 # grep out the kernel version so that we can do our modules magic
173 @@ -246,11 +254,12 @@ EXV=`grep ^EXTRAVERSION\ \= /usr/src/linux/Makefile | sed -e "s/EXTRAVERSION =//
174 clst_fudgeuname=${VER}.${PAT}.${SUB}${EXV}
175
176 unset USE
177 -echo ${clst_kernel_use} > /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE
178
179
180 if [ -n "${clst_KERNCACHE}" ]
181 then
182 + echo ${clst_kernel_use} > /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE
183 +
184 if [ -e /etc/portage/profile/package.provided ]
185 then
186 sed -i "/^$(echo "${KERNELVERSION}" | sed -e 's|/|\\/|g')\$/d" /etc/portage/profile/package.provided
187 --
188 1.8.5.3