OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # | 2 # |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 # | 6 # |
7 # Load common constants. This should be the first executable line. | 7 # Load common constants. This should be the first executable line. |
8 # The path to common.sh should be relative to your script's location. | 8 # The path to common.sh should be relative to your script's location. |
9 . "$(dirname "$0")/common.sh" | 9 . "$(dirname "$0")/common.sh" |
10 | 10 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 # We need to know the location and size of the kernel so we can create the | 105 # We need to know the location and size of the kernel so we can create the |
106 # U-Boot script to point to it. Let's create one fake GPT first which will | 106 # U-Boot script to point to it. Let's create one fake GPT first which will |
107 # set the appropriate environment variables. Then we can create the correct | 107 # set the appropriate environment variables. Then we can create the correct |
108 # script and install it for real. A bit awkward, but this is only temporary. | 108 # script and install it for real. A bit awkward, but this is only temporary. |
109 echo "Installing fake GPT first, to calculate locations..." | 109 echo "Installing fake GPT first, to calculate locations..." |
110 install_gpt $OUTDEV $ROOTFS_IMG $KERNEL_IMG $STATEFUL_IMG /dev/zero | 110 install_gpt $OUTDEV $ROOTFS_IMG $KERNEL_IMG $STATEFUL_IMG /dev/zero |
111 | 111 |
112 # Create the U-Boot script to copy the kernel into memory and boot it. | 112 # Create the U-Boot script to copy the kernel into memory and boot it. |
113 KERNEL_OFFSET=$(printf "0x%08x" ${START_KERN_A}) | 113 KERNEL_OFFSET=$(printf "0x%08x" ${START_KERN_A}) |
114 KERNEL_SECS_HEX=$(printf "0x%08x" ${NUM_KERN_SECTORS}) | 114 KERNEL_SECS_HEX=$(printf "0x%08x" ${NUM_KERN_SECTORS}) |
| 115 |
| 116 BOOTARGS="root=/dev/mmcblk1p3" |
| 117 BOOTARGS="${BOOTARGS} init=/sbin/init" |
| 118 BOOTARGS="${BOOTARGS} console=ttySAC2,115200" |
| 119 BOOTARGS="${BOOTARGS} mem=1024M" |
| 120 BOOTARGS="${BOOTARGS} rootwait" |
| 121 |
115 MBR_SCRIPT="${IMAGEDIR}/mbr_script" | 122 MBR_SCRIPT="${IMAGEDIR}/mbr_script" |
116 echo -e "echo\necho ---- ChromeOS Boot ----\necho\n" \ | 123 echo -e "echo\necho ---- ChromeOS Boot ----\necho\n" \ |
| 124 "setenv bootargs ${BOOTARGS}\n" \ |
117 "mmc read 1 C0008000 $KERNEL_OFFSET $KERNEL_SECS_HEX\n" \ | 125 "mmc read 1 C0008000 $KERNEL_OFFSET $KERNEL_SECS_HEX\n" \ |
118 "bootm C0008000" > ${MBR_SCRIPT} | 126 "bootm C0008000" > ${MBR_SCRIPT} |
119 MKIMAGE="${FLAGS_board_root}/u-boot/mkimage" | 127 MKIMAGE="${FLAGS_board_root}/u-boot/mkimage" |
120 if [[ -f "$MKIMAGE".gz ]]; then | 128 if [[ -f "$MKIMAGE".gz ]]; then |
121 sudo gunzip "$MKIMAGE".gz | 129 sudo gunzip "$MKIMAGE".gz |
122 fi | 130 fi |
123 if [[ -x "$MKIMAGE" ]]; then | 131 if [[ -x "$MKIMAGE" ]]; then |
124 MBR_SCRIPT_UIMG="${MBR_SCRIPT}.uimg" | 132 MBR_SCRIPT_UIMG="${MBR_SCRIPT}.uimg" |
125 "$MKIMAGE" -A "${ARCH}" -O linux -T script -a 0 -e 0 -n "COS boot" \ | 133 "$MKIMAGE" -A "${ARCH}" -O linux -T script -a 0 -e 0 -n "COS boot" \ |
126 -d ${MBR_SCRIPT} ${MBR_SCRIPT_UIMG} | 134 -d ${MBR_SCRIPT} ${MBR_SCRIPT_UIMG} |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 echo "Copying kernel..." | 166 echo "Copying kernel..." |
159 $sudo dd if=${KERNEL_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_KERN_A} | 167 $sudo dd if=${KERNEL_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_KERN_A} |
160 | 168 |
161 echo "Copying rootfs..." | 169 echo "Copying rootfs..." |
162 $sudo dd if=${ROOTFS_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ROOTFS_A
} | 170 $sudo dd if=${ROOTFS_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ROOTFS_A
} |
163 | 171 |
164 # Clean up temporary files. | 172 # Clean up temporary files. |
165 if [[ -n "${MBR_IMG:-}" ]]; then | 173 if [[ -n "${MBR_IMG:-}" ]]; then |
166 rm "${MBR_IMG}" | 174 rm "${MBR_IMG}" |
167 fi | 175 fi |
OLD | NEW |