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 from within | 7 # Script to build a bootable keyfob-based chromeos system image from within |
8 # a chromiumos setup. This assumes that all needed packages have been built into | 8 # a chromiumos setup. This assumes that all needed packages have been built into |
9 # the given target's root with binary packages turned on. This script will | 9 # the given target's root with binary packages turned on. This script will |
10 # build the Chrome OS image using only pre-built binary packages. | 10 # build the Chrome OS image using only pre-built binary packages. |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 if [ -z "$ESP_LOOP_DEV" ] ; then | 360 if [ -z "$ESP_LOOP_DEV" ] ; then |
361 echo "No free loop device. Free up a loop device or reboot. exiting. " | 361 echo "No free loop device. Free up a loop device or reboot. exiting. " |
362 exit 1 | 362 exit 1 |
363 fi | 363 fi |
364 mkdir -p "${ESP_DIR}" | 364 mkdir -p "${ESP_DIR}" |
365 sudo losetup "${ESP_LOOP_DEV}" "${ESP_IMG}" | 365 sudo losetup "${ESP_LOOP_DEV}" "${ESP_IMG}" |
366 sudo mount "${ESP_LOOP_DEV}" "${ESP_DIR}" | 366 sudo mount "${ESP_LOOP_DEV}" "${ESP_DIR}" |
367 sudo mkdir -p "${ESP_DIR}/efi/boot" | 367 sudo mkdir -p "${ESP_DIR}/efi/boot" |
368 sudo grub-mkimage -p /efi/boot -o "${ESP_DIR}/efi/boot/bootx64.efi" \ | 368 sudo grub-mkimage -p /efi/boot -o "${ESP_DIR}/efi/boot/bootx64.efi" \ |
369 part_gpt fat ext2 normal boot sh chain configfile linux | 369 part_gpt fat ext2 normal boot sh chain configfile linux |
370 sudo cp "${ROOT_FS_DIR}/boot/vmlinuz" "${ESP_DIR}/efi/boot/vmlinuz" | 370 cat <<'EOF' | sudo dd of="${ESP_DIR}/efi/boot/grub.cfg" |
371 cat <<EOF | sudo dd of="${ESP_DIR}/efi/boot/grub.cfg" | 371 set default=0 |
372 set timeout=2 | 372 set timeout=2 |
373 set default=0 | |
374 | 373 |
375 menuentry "boot from disk" { | 374 # NOTE: These magic grub variables are a Chrome OS hack. They are not portable. |
376 linux /efi/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local rootwait
root=/dev/sda3 ro noresume noswap i915.modeset=1 loglevel=1 | 375 |
| 376 menuentry "local image A" { |
| 377 linux $grubpartA/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local ro
otwait root=/dev/$linuxpartA ro noresume noswap i915.modeset=1 loglevel=1 |
377 } | 378 } |
378 | 379 |
379 menuentry "boot from disk with serial debug" { | 380 menuentry "local image B" { |
380 linux /efi/boot/vmlinuz earlyprintk=serial,ttyS0,115200 console=ttyS0,115200 i
nit=/sbin/init boot=local rootwait root=/dev/sda3 ro noresume noswap i915.modese
t=1 loglevel=7 | 381 linux $grubpartB/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local ro
otwait root=/dev/$linuxpartB ro noresume noswap i915.modeset=1 loglevel=1 |
381 } | |
382 | |
383 menuentry "boot from usb" { | |
384 linux /efi/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local rootwait
root=/dev/sdb3 ro noresume noswap i915.modeset=1 loglevel=1 | |
385 } | |
386 | |
387 menuentry "boot from usb with serial debug" { | |
388 linux /efi/boot/vmlinuz earlyprintk=serial,ttyS0,115200 console=ttyS0,115200 i
nit=/sbin/init boot=local rootwait root=/dev/sdb3 ro noresume noswap i915.modese
t=1 loglevel=7 | |
389 } | 382 } |
390 | 383 |
391 EOF | 384 EOF |
392 | 385 |
393 # By default, dev mode should be activated for either development builds or | 386 # By default, dev mode should be activated for either development builds or |
394 # test builds. | 387 # test builds. |
395 if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ||\ | 388 if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ||\ |
396 [[ $FLAGS_withtest -eq $FLAGS_TRUE ]]; then | 389 [[ $FLAGS_withtest -eq $FLAGS_TRUE ]]; then |
397 sudo touch "$ROOT_FS_DIR/root/.dev_mode" | 390 sudo touch "$ROOT_FS_DIR/root/.dev_mode" |
398 | 391 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 429 |
437 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" | 430 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" |
438 echo "Done. Image created in ${OUTPUT_DIR}" | 431 echo "Done. Image created in ${OUTPUT_DIR}" |
439 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 432 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
440 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 433 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
441 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 434 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
442 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 435 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
443 echo "from the scripts directory where you entered the chroot." | 436 echo "from the scripts directory where you entered the chroot." |
444 | 437 |
445 trap - EXIT | 438 trap - EXIT |
OLD | NEW |