Gentoo Archives: gentoo-catalyst

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