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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 sudo mkdir -p "$ROOT_FS_DIR"/boot | 346 sudo mkdir -p "$ROOT_FS_DIR"/boot |
347 # TODO(adlr): use initramfs for booting. | 347 # TODO(adlr): use initramfs for booting. |
348 cat <<EOF | sudo dd of="$ROOT_FS_DIR"/boot/extlinux.conf | 348 cat <<EOF | sudo dd of="$ROOT_FS_DIR"/boot/extlinux.conf |
349 DEFAULT chromeos-usb | 349 DEFAULT chromeos-usb |
350 PROMPT 0 | 350 PROMPT 0 |
351 TIMEOUT 0 | 351 TIMEOUT 0 |
352 | 352 |
353 label chromeos-usb | 353 label chromeos-usb |
354 menu label chromeos-usb | 354 menu label chromeos-usb |
355 kernel vmlinuz | 355 kernel vmlinuz |
356 append quiet console=tty2 init=/sbin/init boot=local rootwait root=/dev/sdb3 r
o noresume noswap i915.modeset=1 loglevel=1 | 356 append quiet console=tty2 init=/sbin/init boot=local rootwait root=/dev/sdb3 r
o noresume noswap i915.modeset=1 loglevel=1 cros_legacy |
357 | 357 |
358 label chromeos-hd | 358 label chromeos-hd |
359 menu label chromeos-hd | 359 menu label chromeos-hd |
360 kernel vmlinuz | 360 kernel vmlinuz |
361 append quiet console=tty2 init=/sbin/init boot=local rootwait root=HDROOT ro n
oresume noswap i915.modeset=1 loglevel=1 | 361 append quiet console=tty2 init=/sbin/init boot=local rootwait root=HDROOT ro n
oresume noswap i915.modeset=1 loglevel=1 cros_legacy |
362 EOF | 362 EOF |
363 | 363 |
364 # Make partition bootable and label it. | 364 # Make partition bootable and label it. |
365 sudo extlinux -z --install "${ROOT_FS_DIR}/boot" | 365 sudo extlinux -z --install "${ROOT_FS_DIR}/boot" |
366 fi | 366 fi |
367 | 367 |
368 # -- Install packages into the root file system -- | 368 # -- Install packages into the root file system -- |
369 | 369 |
370 # We need to install libc manually from the cross toolchain. | 370 # We need to install libc manually from the cross toolchain. |
371 # TODO: Improve this? We only want libc and not the whole toolchain. | 371 # TODO: Improve this? We only want libc and not the whole toolchain. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 sudo mkdir -p "${ESP_DIR}/efi/boot" | 441 sudo mkdir -p "${ESP_DIR}/efi/boot" |
442 sudo grub-mkimage -p /efi/boot -o "${ESP_DIR}/efi/boot/bootx64.efi" \ | 442 sudo grub-mkimage -p /efi/boot -o "${ESP_DIR}/efi/boot/bootx64.efi" \ |
443 part_gpt fat ext2 normal boot sh chain configfile linux | 443 part_gpt fat ext2 normal boot sh chain configfile linux |
444 cat <<'EOF' | sudo dd of="${ESP_DIR}/efi/boot/grub.cfg" | 444 cat <<'EOF' | sudo dd of="${ESP_DIR}/efi/boot/grub.cfg" |
445 set default=0 | 445 set default=0 |
446 set timeout=2 | 446 set timeout=2 |
447 | 447 |
448 # NOTE: These magic grub variables are a Chrome OS hack. They are not portable. | 448 # NOTE: These magic grub variables are a Chrome OS hack. They are not portable. |
449 | 449 |
450 menuentry "local image A" { | 450 menuentry "local image A" { |
451 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 | 451 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 cros_e
fi |
452 } | 452 } |
453 | 453 |
454 menuentry "local image B" { | 454 menuentry "local image B" { |
455 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 | 455 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 cros_e
fi |
456 } | 456 } |
457 | 457 |
458 menuentry "Alternate USB Boot" { | 458 menuentry "Alternate USB Boot" { |
459 linux (hd0,3)/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local rootw
ait root=/dev/sdb3 ro noresume noswap i915.modeset=1 loglevel=1 | 459 linux (hd0,3)/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local rootw
ait root=/dev/sdb3 ro noresume noswap i915.modeset=1 loglevel=1 cros_efi |
460 } | 460 } |
461 | 461 |
462 EOF | 462 EOF |
463 | 463 |
464 # FIXME: At the moment, we're working on signed images for x86 only. ARM will | 464 # FIXME: At the moment, we're working on signed images for x86 only. ARM will |
465 # support this before shipping, but at the moment they don't. | 465 # support this before shipping, but at the moment they don't. |
466 if [[ "$ARCH" = "x86" ]]; then | 466 if [[ "$ARCH" = "x86" ]]; then |
467 | 467 |
468 # Legacy BIOS will use the kernel in the rootfs (via syslinux), as will | 468 # Legacy BIOS will use the kernel in the rootfs (via syslinux), as will |
469 # standard EFI BIOS (via grub, from the EFI System Partition). Chrome OS BIOS | 469 # standard EFI BIOS (via grub, from the EFI System Partition). Chrome OS BIOS |
470 # will use a separate signed kernel partition, which we'll create now. | 470 # will use a separate signed kernel partition, which we'll create now. |
471 # FIXME: remove serial output, debugging messages | 471 # FIXME: remove serial output, debugging messages |
472 cat <<'EOF' > "${OUTPUT_DIR}/config.txt" | 472 cat <<'EOF' > "${OUTPUT_DIR}/config.txt" |
473 earlyprintk=serial,ttyS0,115200 | 473 earlyprintk=serial,ttyS0,115200 |
474 console=ttyS0,115200 | 474 console=ttyS0,115200 |
475 init=/sbin/init | 475 init=/sbin/init |
476 add_efi_memmap | 476 add_efi_memmap |
477 boot=local | 477 boot=local |
478 rootwait | 478 rootwait |
479 root=/dev/sd%D%P | 479 root=/dev/sd%D%P |
480 ro | 480 ro |
481 noresume | 481 noresume |
482 noswap | 482 noswap |
483 i915.modeset=1 | 483 i915.modeset=1 |
484 loglevel=7 | 484 loglevel=7 |
485 Hi_Mom | 485 cros_secure |
486 EOF | 486 EOF |
487 | 487 |
488 # FIXME: We need to specify the real keys and certs here! | 488 # FIXME: We need to specify the real keys and certs here! |
489 SIG_DIR="${SRC_ROOT}/platform/vboot_reference/tests/testkeys" | 489 SIG_DIR="${SRC_ROOT}/platform/vboot_reference/tests/testkeys" |
490 | 490 |
491 # Wrap the public keys with VbPublicKey headers | 491 # Wrap the public keys with VbPublicKey headers |
492 vbutil_key --pack \ | 492 vbutil_key --pack \ |
493 --in "${SIG_DIR}/key_rsa2048.keyb" \ | 493 --in "${SIG_DIR}/key_rsa2048.keyb" \ |
494 --version 1 --algorithm 4 \ | 494 --version 1 --algorithm 4 \ |
495 --out "${OUTPUT_DIR}/key_alg4.vbpubk" | 495 --out "${OUTPUT_DIR}/key_alg4.vbpubk" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 echo "Developer image created as $DEVELOPER_IMAGE_NAME" | 597 echo "Developer image created as $DEVELOPER_IMAGE_NAME" |
598 fi | 598 fi |
599 | 599 |
600 print_time_elapsed | 600 print_time_elapsed |
601 | 601 |
602 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 602 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
603 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 603 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
604 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 604 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
605 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 605 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
606 echo "from the scripts directory where you entered the chroot." | 606 echo "from the scripts directory where you entered the chroot." |
OLD | NEW |