From 58b5607004dcbbb64bb9632870ed18a7c3c11ad4 Mon Sep 17 00:00:00 2001 From: Om Kumar Date: Thu, 19 Jun 2014 16:25:44 +0530 Subject: [PATCH] Support for UBoot. UBoot needs the kernel and ramdisk to be post processed using mkimage utility. This element helps user do it as part of the DIB process. This element needs u-boot-tools to be installed. The load address and entry point for UBoot kernel can be specified as shown in the example below. Example: export UBOOT_KERNEL_ADDR=0x80000 export UBOOT_KERNEL_EP=0x80000 Change-Id: I0e1039bf57d1ef11a3f9831d82e24b1ec2136c13 --- elements/uboot/README.md | 15 ++++++++++++++ elements/uboot/cleanup.d/98-uboot | 34 +++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 elements/uboot/README.md create mode 100755 elements/uboot/cleanup.d/98-uboot diff --git a/elements/uboot/README.md b/elements/uboot/README.md new file mode 100644 index 000000000..9ae3004d1 --- /dev/null +++ b/elements/uboot/README.md @@ -0,0 +1,15 @@ +Perform kernel/initrd post-processing for UBoot. + +This element helps post-process the kernel/initrd +for use with uboot. It works with ramdisk images +as well as user images. + +This element needs u-boot-tools to be installed +on the host. + +The load address and entry point for UBoot kernel +can be specified as shown in the example below. + +Example: + export UBOOT\_KERNEL\_ADDR=0x80000 + export UBOOT\_KERNEL\_EP=0x80000 diff --git a/elements/uboot/cleanup.d/98-uboot b/elements/uboot/cleanup.d/98-uboot new file mode 100755 index 000000000..698805709 --- /dev/null +++ b/elements/uboot/cleanup.d/98-uboot @@ -0,0 +1,34 @@ +#!/bin/bash + +set -eux +set -o pipefail + +function post_process() +{ + mkimage -A $1 -O linux -T kernel -C none -a $UBOOT_KERNEL_ADDR -e $UBOOT_KERNEL_EP -n "Kernel" -d $KERNEL uImage + mv uImage $KERNEL + mkimage -A $1 -O linux -T ramdisk -a 0 -n "RAMdisk" -C gzip -d $RAMDISK uInitrd + mv uInitrd $RAMDISK +} + +UBOOT_KERNEL_ADDR=${UBOOT_KERNEL_ADDR:-0x80000} +UBOOT_KERNEL_EP=${UBOOT_KERNEL_EP:-0x80000} +[ -n "$TARGET_ROOT" ] + +# Check if RAMDISK is being built. +if [ -f "$TARGET_ROOT/tmp/ramdisk" ] ; then + KERNEL="$TARGET_ROOT/tmp/kernel" + RAMDISK="$TARGET_ROOT/tmp/ramdisk" +else + source "$_LIB/img-functions" + # Dig up the initrd and kernel to use. + select_boot_kernel_initrd "$TARGET_ROOT" + KERNEL="$TARGET_ROOT/boot/$KERNEL" + RAMDISK="$TARGET_ROOT/boot/$RAMDISK" +fi + +case "$ARCH" in + arm*) + post_process arm + ;; +esac