Skip to content

Commit

Permalink
onie-mk-itb: allow to specify kernel load address and entry point
Browse files Browse the repository at this point in the history
armv7a's default load address and entry point are 0x6000_8000 now.
The patch has been tested in Accton powerpc and arm platforms.

Signed-off-by: Curt Brune <[email protected]>
  • Loading branch information
david56 authored and Curt Brune committed Aug 30, 2016
1 parent eada96f commit a4610ed
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 28 deletions.
3 changes: 3 additions & 0 deletions build-config/arch/armv7a.make
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#-------------------------------------------------------------------------------
#
# Copyright (C) 2014,2015 Curt Brune <[email protected]>
# Copyright (C) 2016 david_yang <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0
#
Expand All @@ -13,6 +14,8 @@ CROSSPREFIX ?= $(TARGET)-
CROSSBIN ?= $(XTOOLS_INSTALL_DIR)/$(TARGET)/bin

KERNEL_ARCH = arm
KERNEL_LOAD_ADDRESS ?= 0x60008000
KERNEL_ENTRY_POINT ?= 0x60008000
KERNEL_DTB ?= $(MACHINE).dtb
KERNEL_DTB_PATH ?= $(KERNEL_DTB)
KERNEL_IMAGE_FILE = $(LINUX_BOOTDIR)/compressed/piggy.gzip
Expand Down
4 changes: 3 additions & 1 deletion build-config/arch/powerpc-softfloat.make
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#-------------------------------------------------------------------------------
#
# Copyright (C) 2013,2014,2015 Curt Brune <[email protected]>
# Copyright (C) 2014 david_yang <[email protected]>
# Copyright (C) 2014,2016 david_yang <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0
#
Expand All @@ -14,6 +14,8 @@ CROSSPREFIX ?= $(TARGET)-
CROSSBIN ?= $(XTOOLS_INSTALL_DIR)/$(TARGET)/bin

KERNEL_ARCH = powerpc
KERNEL_LOAD_ADDRESS ?= 0x00000000
KERNEL_ENTRY_POINT ?= 0x00000000
KERNEL_DTB ?= $(MACHINE).dtb
KERNEL_DTB_PATH ?= $(KERNEL_DTB)
KERNEL_IMAGE_FILE = $(LINUXDIR)/vmlinux.bin.gz
Expand Down
3 changes: 2 additions & 1 deletion build-config/make/demo.make
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#-------------------------------------------------------------------------------
#
# Copyright (C) 2013,2014,2015 Curt Brune <[email protected]>
# Copyright (C) 2015 david_yang <[email protected]>
# Copyright (C) 2015,2016 david_yang <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0
#
Expand Down Expand Up @@ -86,6 +86,7 @@ $(DEMO_UIMAGE_COMPLETE_STAMP): $(KERNEL_INSTALL_STAMP) $(DEMO_SYSROOT_CPIO_XZ)
$(Q) echo "==== Create demo $(MACHINE_PREFIX) u-boot multi-file initramfs itb ===="
$(Q) cd $(IMAGEDIR) && \
V=$(V) $(SCRIPTDIR)/onie-mk-itb.sh $(MACHINE) $(MACHINE_PREFIX) $(UBOOT_ITB_ARCH) \
$(KERNEL_LOAD_ADDRESS) $(KERNEL_ENTRY_POINT) \
$(KERNEL_VMLINUZ) $(IMAGEDIR)/$(MACHINE_PREFIX).dtb $(DEMO_SYSROOT_CPIO_XZ) $(DEMO_UIMAGE)
$(Q) touch $@

Expand Down
3 changes: 2 additions & 1 deletion build-config/make/images.make
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#-------------------------------------------------------------------------------
#
# Copyright (C) 2013,2014,2015,2016 Curt Brune <[email protected]>
# Copyright (C) 2014-2015 david_yang <[email protected]>
# Copyright (C) 2014,2015,2016 david_yang <[email protected]>
# Copyright (C) 2014 Stephen Su <[email protected]>
# Copyright (C) 2014 Puneet <[email protected]>
# Copyright (C) 2015 Carlos Cardenas <[email protected]>
Expand Down Expand Up @@ -294,6 +294,7 @@ $(IMAGEDIR)/%.itb : $(KERNEL_INSTALL_STAMP) $(SYSROOT_CPIO_XZ) $(SCRIPTDIR)/onie
$(Q) echo "==== Create $* u-boot multi-file .itb image ===="
$(Q) cd $(IMAGEDIR) && \
V=$(V) $(SCRIPTDIR)/onie-mk-itb.sh $(MACHINE) $(MACHINE_PREFIX) $(UBOOT_ITB_ARCH) \
$(KERNEL_LOAD_ADDRESS) $(KERNEL_ENTRY_POINT) \
$(KERNEL_VMLINUZ) $(IMAGEDIR)/$(MACHINE_PREFIX).dtb $(SYSROOT_CPIO_XZ) $@

$(UPDATER_ITB) : $(ITB_IMAGE)
Expand Down
53 changes: 28 additions & 25 deletions build-config/scripts/onie-mk-itb.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh

# Copyright (C) 2013,2014,2015 Curt Brune <[email protected]>
# Copyright (C) 2016 david_yang <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0

Expand All @@ -21,45 +22,47 @@ MACHINE_PREFIX="$2"
}

ARCH="$3"
case $ARCH in
ppc)
KERNEL_COMPRESSION="gzip"
KERNEL_LOAD="0x00000000"
KERNEL_ENTRY="0x00000000"
INITRD_LOAD="0x00000000"
FTD="fdt = \"dtb\";"
;;
arm)
KERNEL_COMPRESSION="gzip"
KERNEL_LOAD="0x61008000"
KERNEL_ENTRY="0x61008000"
INITRD_LOAD="0x00000000"
FTD="fdt = \"dtb\";"
;;
*)
echo "Error: Unsupported architecture: $ARCH"
exit 1
esac

KERNEL="$4"
if [ "$ARCH" != "ppc" ] &&
[ "$ARCH" != "arm" ] ; then
echo "Error: Unsupported architecture: $ARCH"
exit 1
fi

KERNEL_LOAD="$4"
[ -n "$KERNEL_LOAD" ] || {
echo "Error: KERNEL_LOAD was not specified"
exit 1
}

KERNEL_ENTRY="$5"
[ -n "$KERNEL_ENTRY" ] || {
echo "Error: KERNEL_ENTRY was not specified"
exit 1
}

KERNEL_COMPRESSION="gzip"
INITRD_LOAD="0x00000000"
FDT="fdt = \"dtb\";"

KERNEL="$6"
[ -r "$KERNEL" ] || {
echo "Error: KERNEL file is not readable: $KERNEL"
exit 1
}

DTB="$5"
DTB="$7"
[ -r "$DTB" ] || {
echo "Error: DTB file is not readable: $DTB"
exit 1
}

SYSROOT="$6"
SYSROOT="$8"
[ -r "$SYSROOT" ] || {
echo "Error: SYSROOT file is not readable: $SYSROOT"
exit 1
}

OUTFILE="$7"
OUTFILE="$9"
[ -n "$OUTFILE" ] || {
echo "Error: output .itb file not specified"
exit 1
Expand Down Expand Up @@ -149,7 +152,7 @@ DTB="$(realpath $DTB)"
description = "${MACHINE_PREFIX}";
kernel = "kernel";
ramdisk = "initramfs";
$FTD
$FDT
};
};
};
Expand Down

0 comments on commit a4610ed

Please sign in to comment.