| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 # | 4 # |
| 5 # This contains common constants and functions for installer scripts. This must | 5 # This contains common constants and functions for installer scripts. This must |
| 6 # evaluate properly for both /bin/bash and /bin/sh, since it's used both to | 6 # evaluate properly for both /bin/bash and /bin/sh, since it's used both to |
| 7 # create the initial image at compile time and to install or upgrade a running | 7 # create the initial image at compile time and to install or upgrade a running |
| 8 # image. | 8 # image. |
| 9 | 9 |
| 10 # Here are the GUIDs we'll be using to identify various partitions. NOTE: The | 10 # Here are the GUIDs we'll be using to identify various partitions. NOTE: The |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 # $1 : Kernel Partition Offset. | 454 # $1 : Kernel Partition Offset. |
| 455 # $2 : Kernel Partition Size ( in Sectors ). | 455 # $2 : Kernel Partition Size ( in Sectors ). |
| 456 # $3 : DEVICE | 456 # $3 : DEVICE |
| 457 # Return file path of the generated PMBR. | 457 # Return file path of the generated PMBR. |
| 458 | 458 |
| 459 make_arm_mbr() { | 459 make_arm_mbr() { |
| 460 # Create the U-Boot script to copy the kernel into memory and boot it. | 460 # Create the U-Boot script to copy the kernel into memory and boot it. |
| 461 local KERNEL_OFFSET=$(printf "0x%08x" ${1}) | 461 local KERNEL_OFFSET=$(printf "0x%08x" ${1}) |
| 462 local KERNEL_SECS_HEX=$(printf "0x%08x" ${2}) | 462 local KERNEL_SECS_HEX=$(printf "0x%08x" ${2}) |
| 463 local DEVICE=${3} | 463 local DEVICE=${3} |
| 464 local EXTRA_BOOTARGS=${4} |
| 464 | 465 |
| 465 BOOTARGS="root=/dev/mmcblk${DEVICE}p3" | 466 BOOTARGS="root=/dev/mmcblk${DEVICE}p3" |
| 466 BOOTARGS="${BOOTARGS} init=/sbin/init" | 467 BOOTARGS="${BOOTARGS} init=/sbin/init" |
| 467 BOOTARGS="${BOOTARGS} console=ttySAC2,115200" | 468 BOOTARGS="${BOOTARGS} console=ttySAC2,115200" |
| 468 BOOTARGS="${BOOTARGS} mem=1024M" | 469 BOOTARGS="${BOOTARGS} mem=1024M" |
| 469 BOOTARGS="${BOOTARGS} rootwait" | 470 BOOTARGS="${BOOTARGS} rootwait" |
| 471 BOOTARGS="${BOOTARGS} ${EXTRA_BOOTARGS}" |
| 470 | 472 |
| 471 MBR_SCRIPT="/var/tmp/mbr_script" | 473 MBR_SCRIPT="/var/tmp/mbr_script" |
| 472 echo -e "echo\necho ---- ChromeOS Boot ----\necho\n" \ | 474 echo -e "echo\necho ---- ChromeOS Boot ----\necho\n" \ |
| 473 "setenv bootargs ${BOOTARGS}\n" \ | 475 "setenv bootargs ${BOOTARGS}\n" \ |
| 474 "mmc read ${DEVICE} C0008000 $KERNEL_OFFSET $KERNEL_SECS_HEX\n" \ | 476 "mmc read ${DEVICE} C0008000 $KERNEL_OFFSET $KERNEL_SECS_HEX\n" \ |
| 475 "bootm C0008000" > ${MBR_SCRIPT} | 477 "bootm C0008000" > ${MBR_SCRIPT} |
| 476 MKIMAGE="/usr/bin/mkimage" | 478 MKIMAGE="/usr/bin/mkimage" |
| 477 if [ -x "$MKIMAGE" ]; then | 479 if [ -x "$MKIMAGE" ]; then |
| 478 MBR_SCRIPT_UIMG="${MBR_SCRIPT}.uimg" | 480 MBR_SCRIPT_UIMG="${MBR_SCRIPT}.uimg" |
| 479 "$MKIMAGE" -A "arm" -O linux -T script -a 0 -e 0 -n "COS boot" \ | 481 "$MKIMAGE" -A "arm" -O linux -T script -a 0 -e 0 -n "COS boot" \ |
| 480 -d ${MBR_SCRIPT} ${MBR_SCRIPT_UIMG} >&2 | 482 -d ${MBR_SCRIPT} ${MBR_SCRIPT_UIMG} >&2 |
| 481 else | 483 else |
| 482 echo "Error: u-boot mkimage not found or not executable." >&2 | 484 echo "Error: u-boot mkimage not found or not executable." >&2 |
| 483 exit 1 | 485 exit 1 |
| 484 fi | 486 fi |
| 485 echo ${MBR_SCRIPT_UIMG} | 487 echo ${MBR_SCRIPT_UIMG} |
| 486 } | 488 } |
| OLD | NEW |