summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel-yocto.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/kernel-yocto.bbclass')
-rw-r--r--meta/classes/kernel-yocto.bbclass72
1 files changed, 49 insertions, 23 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index 3130bf4512..50ff555efe 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -139,33 +139,59 @@ do_patch() {
139} 139}
140 140
141do_kernel_checkout() { 141do_kernel_checkout() {
142 if [ -d ${WORKDIR}/git/.git/refs/remotes/origin ]; then 142 # we build out of {S}, so ensure that ${S} is clean and present
143 echo "Fixing up git directory for ${LINUX_KERNEL_TYPE}/${KMACHINE}" 143 rm -rf ${S}
144 rm -rf ${S} 144 mkdir -p ${S}/.git
145 mkdir ${S} 145
146 set +e
147
148 # A linux yocto SRC_URI should use the bareclone option. That
149 # ensures that all the branches are available in the WORKDIR version
150 # of the repository. If it wasn't passed, we should detect it, and put
151 # out a useful error message
152 if [ -d "${WORKDIR}/git/.git" ]; then
153 echo "WARNING. ${WORKDIR}/git is not a bare clone."
154 echo "Ensure that the SRC_URI includes the 'bareclone=1' option."
155
156 # we can fix up the kernel repository, but at the least the meta
157 # branch must be present. The machine branch may be created later.
146 mv ${WORKDIR}/git/.git ${S} 158 mv ${WORKDIR}/git/.git ${S}
147 159 rm -rf ${WORKDIR}/git/
148 if [ -e ${S}/.git/packed-refs ]; then 160 cd ${S}
149 cd ${S} 161 git branch -a | grep -q ${KMETA}
150 rm -f .git/refs/remotes/origin/HEAD 162 if [ $? -ne 0 ]; then
151IFS=' 163 echo "ERROR. The branch '${KMETA}' is required and was not"
152'; 164 echo "found. Ensure that the SRC_URI points to a valid linux-yocto"
153 for r in `git show-ref | grep remotes`; do 165 echo "kernel repository"
154 ref=`echo $r | cut -d' ' -f1`; 166 exit 1
155 b=`echo $r | cut -d' ' -f2 | sed 's%refs/remotes/origin/%%'`;
156 dir=`dirname $b`
157 mkdir -p .git/refs/heads/$dir
158 echo $ref > .git/refs/heads/$b
159 done
160 cd ..
161 else
162 cp -r ${S}/.git/refs/remotes/origin/* ${S}/.git/refs/heads
163 rmdir ${S}/.git/refs/remotes/origin
164 fi 167 fi
168 if [ -z "${YOCTO_KERNEL_EXTERNAL_BRANCH}" ]; then
169 git branch -a | grep -q ${KBRANCH}
170 if [ $? -ne 0 ]; then
171 echo "ERROR. The branch '${KBRANCH}' is required and was not"
172 echo "found. Ensure that the SRC_URI points to a valid linux-yocto"
173 echo "kernel repository"
174 exit 1
175 fi
176 fi
177 else
178 mv ${WORKDIR}/git/* ${S}/.git
179 rm -rf ${WORKDIR}/git/
180 cd ${S}
181 git config core.bare false
165 fi 182 fi
166 cd ${S} 183 # end debare
167 184
168 set +e 185 # convert any remote branches to local tracking ones
186 for i in `git branch -a | grep remotes | grep -v HEAD`; do
187 b=`echo $i | cut -d' ' -f2 | sed 's%remotes/origin/%%'`;
188 git show-ref --quiet --verify -- "refs/heads/$b"
189 if [ $? -ne 0 ]; then
190 git branch $b $i > /dev/null
191 fi
192 done
193
194 # Create a working tree copy of the kernel by checkout out a branch
169 git show-ref --quiet --verify -- "refs/heads/${KBRANCH}" 195 git show-ref --quiet --verify -- "refs/heads/${KBRANCH}"
170 if [ $? -eq 0 ]; then 196 if [ $? -eq 0 ]; then
171 # checkout and clobber and unimportant files 197 # checkout and clobber and unimportant files