summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge McCollister <george.mccollister@gmail.com>2016-07-15 15:40:54 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-10 10:46:33 +0100
commit749d7771ce54703916fe62ab8753b177969e603a (patch)
tree55343e3b9c57657102874191bee9c329f22861b9
parentec755d2524fcbd9dfded23a576f25c990d405a6c (diff)
downloadpoky-749d7771ce54703916fe62ab8753b177969e603a.tar.gz
kernel-fitimage: Add x86 support
For x86, bzImage must be built instead of zImage. Include setup.bin (which is required to boot the kernel) in the fitimage and always use a load/boot address of 0x00090000. For details see: http://git.denx.de/?p=u-boot.git;a=blob;f=doc/uImage.FIT/x86-fit-boot.txt (From OE-Core rev: 1a65d11d4b8f056fdf22c31a92d1e58dec6d89f6) Signed-off-by: George McCollister <george.mccollister@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/kernel-fitimage.bbclass112
1 files changed, 82 insertions, 30 deletions
diff --git a/meta/classes/kernel-fitimage.bbclass b/meta/classes/kernel-fitimage.bbclass
index f05d8a54b5..8580247f82 100644
--- a/meta/classes/kernel-fitimage.bbclass
+++ b/meta/classes/kernel-fitimage.bbclass
@@ -7,12 +7,17 @@ python __anonymous () {
7 depends = "%s u-boot-mkimage-native dtc-native" % depends 7 depends = "%s u-boot-mkimage-native dtc-native" % depends
8 d.setVar("DEPENDS", depends) 8 d.setVar("DEPENDS", depends)
9 9
10 if d.getVar("UBOOT_ARCH", True) == "x86":
11 replacementtype = "bzImage"
12 else:
13 replacementtype = "zImage"
14
10 # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal 15 # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
11 # to kernel.bbclass . We have to override it, since we pack zImage 16 # to kernel.bbclass . We have to override it, since we pack zImage
12 # (at least for now) into the fitImage . 17 # (at least for now) into the fitImage .
13 typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True) or "" 18 typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True) or ""
14 if 'fitImage' in typeformake.split(): 19 if 'fitImage' in typeformake.split():
15 d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('fitImage', 'zImage')) 20 d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('fitImage', replacementtype))
16 21
17 image = d.getVar('INITRAMFS_IMAGE', True) 22 image = d.getVar('INITRAMFS_IMAGE', True)
18 if image: 23 if image:
@@ -138,6 +143,33 @@ EOF
138} 143}
139 144
140# 145#
146# Emit the fitImage ITS setup section
147#
148# $1 ... .its filename
149# $2 ... Image counter
150# $3 ... Path to setup image
151fitimage_emit_section_setup() {
152
153 setup_csum="sha1"
154
155 cat << EOF >> ${1}
156 setup@${2} {
157 description = "Linux setup.bin";
158 data = /incbin/("${3}");
159 type = "x86_setup";
160 arch = "${UBOOT_ARCH}";
161 os = "linux";
162 compression = "none";
163 load = <0x00090000>;
164 entry = <0x00090000>;
165 hash@1 {
166 algo = "${setup_csum}";
167 };
168 };
169EOF
170}
171
172#
141# Emit the fitImage ITS ramdisk section 173# Emit the fitImage ITS ramdisk section
142# 174#
143# $1 ... .its filename 175# $1 ... .its filename
@@ -171,6 +203,7 @@ EOF
171# $2 ... Linux kernel ID 203# $2 ... Linux kernel ID
172# $3 ... DTB image ID 204# $3 ... DTB image ID
173# $4 ... ramdisk ID 205# $4 ... ramdisk ID
206# $5 ... config ID
174fitimage_emit_section_config() { 207fitimage_emit_section_config() {
175 208
176 conf_csum="sha1" 209 conf_csum="sha1"
@@ -179,24 +212,25 @@ fitimage_emit_section_config() {
179 fi 212 fi
180 213
181 # Test if we have any DTBs at all 214 # Test if we have any DTBs at all
182 if [ -z "${3}" -a -z "${4}" ] ; then 215 conf_desc="Linux kernel"
183 conf_desc="Boot Linux kernel" 216 kernel_line="kernel = \"kernel@${2}\";"
184 fdt_line="" 217 fdt_line=""
185 ramdisk_line="" 218 ramdisk_line=""
186 elif [ -z "${4}" ]; then 219
187 conf_desc="Boot Linux kernel with FDT blob" 220 if [ -n "${3}" ]; then
188 fdt_line="fdt = \"fdt@${3}\";" 221 conf_desc="${conf_desc}, FDT blob"
189 ramdisk_line=""
190 elif [ -z "${3}" ]; then
191 conf_desc="Boot Linux kernel with ramdisk"
192 fdt_line=""
193 ramdisk_line="ramdisk = \"ramdisk@${4}\";"
194 else
195 conf_desc="Boot Linux kernel with FDT blob, ramdisk"
196 fdt_line="fdt = \"fdt@${3}\";" 222 fdt_line="fdt = \"fdt@${3}\";"
223 fi
224
225 if [ -n "${4}" ]; then
226 conf_desc="${conf_desc}, ramdisk"
197 ramdisk_line="ramdisk = \"ramdisk@${4}\";" 227 ramdisk_line="ramdisk = \"ramdisk@${4}\";"
198 fi 228 fi
199 kernel_line="kernel = \"kernel@${2}\";" 229
230 if [ -n "${5}" ]; then
231 conf_desc="${conf_desc}, setup"
232 setup_line="setup = \"setup@${5}\";"
233 fi
200 234
201 cat << EOF >> ${1} 235 cat << EOF >> ${1}
202 default = "conf@1"; 236 default = "conf@1";
@@ -205,6 +239,7 @@ fitimage_emit_section_config() {
205 ${kernel_line} 239 ${kernel_line}
206 ${fdt_line} 240 ${fdt_line}
207 ${ramdisk_line} 241 ${ramdisk_line}
242 ${setup_line}
208 hash@1 { 243 hash@1 {
209 algo = "${conf_csum}"; 244 algo = "${conf_csum}";
210 }; 245 };
@@ -212,16 +247,22 @@ EOF
212 247
213 if [ ! -z "${conf_sign_keyname}" ] ; then 248 if [ ! -z "${conf_sign_keyname}" ] ; then
214 249
215 if [ -z "${3}" -a -z "${4}" ] ; then 250 sign_line="sign-images = \"kernel\""
216 sign_line="sign-images = \"kernel\";" 251
217 elif [ -z "${4}" ]; then 252 if [ -n "${3}" ]; then
218 sign_line="sign-images = \"fdt\", \"kernel\";" 253 sign_line="${sign_line}, \"fdt\""
219 elif [ -z "${3}" ]; then 254 fi
220 sign_line="sign-images = \"ramdisk\", \"kernel\";" 255
221 else 256 if [ -n "${4}" ]; then
222 sign_line="sign-images = \"ramdisk\", \"fdt\", \"kernel\";" 257 sign_line="${sign_line}, \"ramdisk\""
223 fi 258 fi
224 259
260 if [ -n "${5}" ]; then
261 sign_line="${sign_line}, \"setup\""
262 fi
263
264 sign_line="${sign_line};"
265
225 cat << EOF >> ${1} 266 cat << EOF >> ${1}
226 signature@1 { 267 signature@1 {
227 algo = "${conf_csum},rsa2048"; 268 algo = "${conf_csum},rsa2048";
@@ -246,6 +287,7 @@ fitimage_assemble() {
246 kernelcount=1 287 kernelcount=1
247 dtbcount="" 288 dtbcount=""
248 ramdiskcount=${3} 289 ramdiskcount=${3}
290 setupcount=""
249 rm -f ${1} arch/${ARCH}/boot/${2} 291 rm -f ${1} arch/${ARCH}/boot/${2}
250 292
251 fitimage_emit_fit_header ${1} 293 fitimage_emit_fit_header ${1}
@@ -279,7 +321,15 @@ fitimage_assemble() {
279 fi 321 fi
280 322
281 # 323 #
282 # Step 3: Prepare a ramdisk section. 324 # Step 3: Prepare a setup section. (For x86)
325 #
326 if test -e arch/${ARCH}/boot/setup.bin ; then
327 setupcount=1
328 fitimage_emit_section_setup ${1} "${setupcount}" arch/${ARCH}/boot/setup.bin
329 fi
330
331 #
332 # Step 4: Prepare a ramdisk section.
283 # 333 #
284 if [ "x${ramdiskcount}" = "x1" ] ; then 334 if [ "x${ramdiskcount}" = "x1" ] ; then
285 copy_initramfs 335 copy_initramfs
@@ -290,21 +340,23 @@ fitimage_assemble() {
290 340
291 # Force the first Kernel and DTB in the default config 341 # Force the first Kernel and DTB in the default config
292 kernelcount=1 342 kernelcount=1
293 dtbcount=1 343 if test -n "${dtbcount}"; then
344 dtbcount=1
345 fi
294 346
295 # 347 #
296 # Step 4: Prepare a configurations section 348 # Step 5: Prepare a configurations section
297 # 349 #
298 fitimage_emit_section_maint ${1} confstart 350 fitimage_emit_section_maint ${1} confstart
299 351
300 fitimage_emit_section_config ${1} ${kernelcount} ${dtbcount} ${ramdiskcount} 352 fitimage_emit_section_config ${1} "${kernelcount}" "${dtbcount}" "${ramdiskcount}" "${setupcount}"
301 353
302 fitimage_emit_section_maint ${1} sectend 354 fitimage_emit_section_maint ${1} sectend
303 355
304 fitimage_emit_section_maint ${1} fitend 356 fitimage_emit_section_maint ${1} fitend
305 357
306 # 358 #
307 # Step 5: Assemble the image 359 # Step 6: Assemble the image
308 # 360 #
309 uboot-mkimage \ 361 uboot-mkimage \
310 ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \ 362 ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
@@ -312,7 +364,7 @@ fitimage_assemble() {
312 arch/${ARCH}/boot/${2} 364 arch/${ARCH}/boot/${2}
313 365
314 # 366 #
315 # Step 6: Sign the image and add public key to U-Boot dtb 367 # Step 7: Sign the image and add public key to U-Boot dtb
316 # 368 #
317 if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then 369 if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
318 uboot-mkimage \ 370 uboot-mkimage \