OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 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 # Script to build a bootable keyfob-based chromeos system image. | 7 # Script to build a bootable keyfob-based chromeos system image. |
8 # It uses debootstrap (see https://wiki.ubuntu.com/DebootstrapChroot) to | 8 # It uses debootstrap (see https://wiki.ubuntu.com/DebootstrapChroot) to |
9 # create a base file system. It then cusotmizes the file system and adds | 9 # create a base file system. It then cusotmizes the file system and adds |
10 # Ubuntu and chromeos specific packages. Finally, it creates a bootable USB | 10 # Ubuntu and chromeos specific packages. Finally, it creates a bootable USB |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 --arch="$FLAGS_arch" \ | 135 --arch="$FLAGS_arch" \ |
136 --mirror="$FLAGS_mirror" \ | 136 --mirror="$FLAGS_mirror" \ |
137 --suite="$FLAGS_suite" \ | 137 --suite="$FLAGS_suite" \ |
138 --mirror2="$FLAGS_mirror2" \ | 138 --mirror2="$FLAGS_mirror2" \ |
139 --suite2="$FLAGS_suite2" | 139 --suite2="$FLAGS_suite2" |
140 | 140 |
141 "${SCRIPTS_DIR}/customize_rootfs.sh" --root="${ROOT_FS_DIR}" | 141 "${SCRIPTS_DIR}/customize_rootfs.sh" --root="${ROOT_FS_DIR}" |
142 | 142 |
143 # -- Turn root file system into bootable image -- | 143 # -- Turn root file system into bootable image -- |
144 | 144 |
145 # Setup extlinux configuration. | 145 if [ "$FLAGS_arch" = "x86" ]; then |
146 # TODO: For some reason the /dev/disk/by-uuid is not being generated by udev | 146 # Setup extlinux configuration. |
147 # in the initramfs. When we figure that out, switch to root=UUID=$UUID. | 147 # TODO: For some reason the /dev/disk/by-uuid is not being generated by udev |
148 cat <<EOF | sudo dd of="$ROOT_FS_DIR"/boot/extlinux.conf | 148 # in the initramfs. When we figure that out, switch to root=UUID=$UUID. |
| 149 cat <<EOF | sudo dd of="$ROOT_FS_DIR"/boot/extlinux.conf |
149 DEFAULT chromeos-usb | 150 DEFAULT chromeos-usb |
150 PROMPT 0 | 151 PROMPT 0 |
151 TIMEOUT 0 | 152 TIMEOUT 0 |
152 | 153 |
153 label chromeos-usb | 154 label chromeos-usb |
154 menu label chromeos-usb | 155 menu label chromeos-usb |
155 kernel vmlinuz | 156 kernel vmlinuz |
156 append quiet console=tty2 initrd=initrd.img init=/sbin/init boot=local rootwai
t root=LABEL=$DISK_LABEL ro noresume noswap i915.modeset=1 loglevel=1 | 157 append quiet console=tty2 initrd=initrd.img init=/sbin/init boot=local rootwai
t root=LABEL=$DISK_LABEL ro noresume noswap i915.modeset=1 loglevel=1 |
157 | 158 |
158 label chromeos-hd | 159 label chromeos-hd |
159 menu label chromeos-hd | 160 menu label chromeos-hd |
160 kernel vmlinuz | 161 kernel vmlinuz |
161 append quiet console=tty2 init=/sbin/init boot=local rootwait root=HDROOT ro n
oresume noswap i915.modeset=1 loglevel=1 | 162 append quiet console=tty2 init=/sbin/init boot=local rootwait root=HDROOT ro n
oresume noswap i915.modeset=1 loglevel=1 |
162 EOF | 163 EOF |
163 | 164 |
164 # Make partition bootable and label it. | 165 # Make partition bootable and label it. |
165 sudo "$SCRIPTS_DIR/extlinux.sh" -z --install "${ROOT_FS_DIR}/boot" | 166 sudo "$SCRIPTS_DIR/extlinux.sh" -z --install "${ROOT_FS_DIR}/boot" |
166 | 167 |
| 168 fi # --arch=x86 |
| 169 |
167 cleanup_rootfs_loop | 170 cleanup_rootfs_loop |
168 | 171 |
| 172 if [ "$FLAGS_arch" = "x86" ]; then |
| 173 |
169 # Create a master boot record. | 174 # Create a master boot record. |
170 # Start with the syslinux master boot record. We need to zero-pad to | 175 # Start with the syslinux master boot record. We need to zero-pad to |
171 # fill out a 512-byte sector size. | 176 # fill out a 512-byte sector size. |
172 SYSLINUX_MBR="/usr/lib/syslinux/mbr.bin" | 177 SYSLINUX_MBR="/usr/lib/syslinux/mbr.bin" |
173 dd if="$SYSLINUX_MBR" of="$MBR_IMG" bs=512 count=1 conv=sync | 178 dd if="$SYSLINUX_MBR" of="$MBR_IMG" bs=512 count=1 conv=sync |
174 # Create a partition table in the MBR. | 179 # Create a partition table in the MBR. |
175 NUM_SECTORS=$((`stat --format="%s" "$ROOT_FS_IMG"` / 512)) | 180 NUM_SECTORS=$((`stat --format="%s" "$ROOT_FS_IMG"` / 512)) |
176 sudo sfdisk -H64 -S32 -uS -f "$MBR_IMG" <<EOF | 181 sudo sfdisk -H64 -S32 -uS -f "$MBR_IMG" <<EOF |
177 ,$NUM_SECTORS,L,-, | 182 ,$NUM_SECTORS,L,-, |
178 ,$NUM_SECTORS,S,-, | 183 ,$NUM_SECTORS,S,-, |
179 ,$NUM_SECTORS,L,*, | 184 ,$NUM_SECTORS,L,*, |
180 ; | 185 ; |
181 EOF | 186 EOF |
182 | 187 |
| 188 fi # --arch=x86 |
| 189 |
183 OUTSIDE_OUTPUT_DIR="${EXTERNAL_TRUNK_PATH}/src/build/images/${IMAGE_SUBDIR}" | 190 OUTSIDE_OUTPUT_DIR="${EXTERNAL_TRUNK_PATH}/src/build/images/${IMAGE_SUBDIR}" |
184 echo "Done. Image created in ${OUTPUT_DIR}" | 191 echo "Done. Image created in ${OUTPUT_DIR}" |
185 echo "To copy to USB keyfob, outside the chroot, do something like:" | 192 echo "To copy to USB keyfob, outside the chroot, do something like:" |
186 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb" | 193 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb" |
187 echo "To convert to VMWare image, outside the chroot, do something like:" | 194 echo "To convert to VMWare image, outside the chroot, do something like:" |
188 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 195 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
189 | 196 |
190 trap - EXIT | 197 trap - EXIT |
OLD | NEW |