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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 sudo mount --bind "${STATEFUL_DIR}/var" "${ROOT_FS_DIR}/var" | 373 sudo mount --bind "${STATEFUL_DIR}/var" "${ROOT_FS_DIR}/var" |
374 | 374 |
375 # We "emerge --root=$ROOT_FS_DIR --root-deps=rdeps --usepkgonly" all of the | 375 # We "emerge --root=$ROOT_FS_DIR --root-deps=rdeps --usepkgonly" all of the |
376 # runtime packages for chrome os. This builds up a chrome os image from binary | 376 # runtime packages for chrome os. This builds up a chrome os image from binary |
377 # packages with runtime dependencies only. We use INSTALL_MASK to trim the | 377 # packages with runtime dependencies only. We use INSTALL_MASK to trim the |
378 # image size as much as possible. | 378 # image size as much as possible. |
379 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ | 379 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ |
380 --root="$ROOT_FS_DIR" --root-deps=rdeps \ | 380 --root="$ROOT_FS_DIR" --root-deps=rdeps \ |
381 --getbinpkg --usepkg chromeos $EMERGE_JOBS | 381 --getbinpkg --usepkg chromeos $EMERGE_JOBS |
382 | 382 |
383 # Extract the kernel from the root filesystem for use by the GPT image. Legacy | |
384 # BIOS will use the kernel in the rootfs (via syslinux), Chrome OS BIOS will | |
385 # use the kernel partition. | |
386 sudo cp -f "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image" | |
387 | |
388 # Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI | 383 # Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI |
389 # BIOS). We only need this for x86, but it's simpler and safer to keep the disk | 384 # BIOS). We only need this for x86, but it's simpler and safer to keep the disk |
390 # images the same for both x86 and ARM. | 385 # images the same for both x86 and ARM. |
391 ESP_IMG=${OUTPUT_DIR}/esp.image | 386 ESP_IMG=${OUTPUT_DIR}/esp.image |
392 # NOTE: The size argument for mkfs.vfat is in 1024-byte blocks. We'll hard-code | 387 # NOTE: The size argument for mkfs.vfat is in 1024-byte blocks. We'll hard-code |
393 # it to 16M for now. | 388 # it to 16M for now. |
394 ESP_BLOCKS=16384 | 389 ESP_BLOCKS=16384 |
395 /usr/sbin/mkfs.vfat -C ${OUTPUT_DIR}/esp.image ${ESP_BLOCKS} | 390 /usr/sbin/mkfs.vfat -C ${OUTPUT_DIR}/esp.image ${ESP_BLOCKS} |
396 ESP_DIR=${OUTPUT_DIR}/esp | 391 ESP_DIR=${OUTPUT_DIR}/esp |
397 ESP_LOOP_DEV=$(sudo losetup -f) | 392 ESP_LOOP_DEV=$(sudo losetup -f) |
(...skipping 16 matching lines...) Expand all Loading... |
414 menuentry "local image A" { | 409 menuentry "local image A" { |
415 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 | 410 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 |
416 } | 411 } |
417 | 412 |
418 menuentry "local image B" { | 413 menuentry "local image B" { |
419 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 | 414 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 |
420 } | 415 } |
421 | 416 |
422 EOF | 417 EOF |
423 | 418 |
| 419 # Legacy BIOS will use the kernel in the rootfs (via syslinux), as will |
| 420 # standard EFI BIOS (via grub, from the EFI System Partition). Chrome OS BIOS |
| 421 # will use a separate signed kernel partition, which we'll create now. |
| 422 # FIXME: remove serial output, debugging messages |
| 423 cat <<'EOF' > "${OUTPUT_DIR}/config.txt" |
| 424 earlyprintk=serial,ttyS0,115200 |
| 425 console=ttyS0,115200 |
| 426 init=/sbin/init |
| 427 add_efi_memmap |
| 428 boot=local |
| 429 rootwait |
| 430 root=/dev/sd%D%P |
| 431 ro |
| 432 noresume |
| 433 noswap |
| 434 i915.modeset=1 |
| 435 loglevel=7 |
| 436 Hi_Mom |
| 437 EOF |
| 438 |
| 439 # FIXME: This just creates the image. It doesn't sign it. |
| 440 sudo create_blob -o "${OUTPUT_DIR}/vmlinuz.image" \ |
| 441 "${ROOT_FS_DIR}/boot/vmlinuz" \ |
| 442 "${OUTPUT_DIR}/config.txt" \ |
| 443 /lib64/bootstub/bootstub.efi |
| 444 |
424 # Perform any customizations on the root file system that are needed. | 445 # Perform any customizations on the root file system that are needed. |
425 "${SCRIPTS_DIR}/customize_rootfs" \ | 446 "${SCRIPTS_DIR}/customize_rootfs" \ |
426 --root="$ROOT_FS_DIR" \ | 447 --root="$ROOT_FS_DIR" \ |
427 --target="$ARCH" \ | 448 --target="$ARCH" \ |
428 --board="$BOARD" | 449 --board="$BOARD" |
429 | 450 |
430 # Don't test the factory install shim. | 451 # Don't test the factory install shim. |
431 if [[ $FLAGS_factory_install -eq ${FLAGS_FALSE} ]] ; then | 452 if [[ $FLAGS_factory_install -eq ${FLAGS_FALSE} ]] ; then |
432 # Check that the image has been correctly created. | 453 # Check that the image has been correctly created. |
433 "${SCRIPTS_DIR}/test_image" \ | 454 "${SCRIPTS_DIR}/test_image" \ |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 echo "Done. Image created in ${OUTPUT_DIR}" | 494 echo "Done. Image created in ${OUTPUT_DIR}" |
474 echo "Chromium OS image created as $PRISTINE_IMAGE_NAME" | 495 echo "Chromium OS image created as $PRISTINE_IMAGE_NAME" |
475 if [ "$FLAGS_withdev" -eq "$FLAGS_TRUE" ]; then | 496 if [ "$FLAGS_withdev" -eq "$FLAGS_TRUE" ]; then |
476 echo "Developer image created as $DEVELOPER_IMAGE_NAME" | 497 echo "Developer image created as $DEVELOPER_IMAGE_NAME" |
477 fi | 498 fi |
478 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" | 499 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" |
479 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 500 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
480 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" | 501 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" |
481 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" | 502 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" |
482 echo "from the scripts directory where you entered the chroot." | 503 echo "from the scripts directory where you entered the chroot." |
OLD | NEW |