| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 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 HAS_INITRAMFS=0 | 7 HAS_INITRAMFS=0 |
| 8 if [ -d /dev/.initramfs ] | 8 if [ -d /dev/.initramfs ] |
| 9 then | 9 then |
| 10 # The initrd will have mounted /sys, /proc, and /dev for us. | 10 # The initrd will have mounted /sys, /proc, and /dev for us. |
| 11 HAS_INITRAMFS=1 | 11 HAS_INITRAMFS=1 |
| 12 else | 12 else |
| 13 mount -n -t sysfs -onodev,noexec,nosuid sysfs /sys | 13 mount -n -t sysfs -onodev,noexec,nosuid sysfs /sys |
| 14 mount -n -t proc -onodev,noexec,nosuid proc /proc | 14 mount -n -t proc -onodev,noexec,nosuid proc /proc |
| 15 mount -n -t tmpfs -omode=0755 udev /dev | 15 mount -n -t tmpfs -omode=0755 udev /dev |
| 16 fi | 16 fi |
| 17 | 17 |
| 18 PRE_UPTIME_STAT=$(cat /proc/uptime) | 18 PRE_UPTIME_STAT=$(cat /proc/uptime) |
| 19 PRE_DISK_STAT=$(cat /sys/block/sda/stat) | 19 PRE_DISK_STAT=$(cat /sys/block/sda/stat) |
| 20 | 20 |
| 21 # Since we defer udev until later in the boot process, we pre-populate /dev | 21 # Since we defer udev until later in the boot process, we pre-populate /dev |
| 22 # with the set of devices needed for X and other early services to run. | 22 # with the set of devices needed for X and other early services to run. |
| 23 cp -a -f /lib/chromiumos/devices/* /dev | 23 cp -a -f /lib/chromiumos/devices/* /dev |
| 24 | 24 |
| 25 # Splash screen! Unless we are in noninteractive mode. | 25 # Splash screen! Unless we are in noninteractive mode. |
| 26 # TODO(sosa@chromium.org) - Use kernel flag | 26 # TODO(sosa@chromium.org) - Use kernel flag |
| 27 if [ -x /usr/bin/ply-image ]; then | 27 if [ -x /usr/bin/ply-image ]; then |
| 28 if [ ! -f /root/.factory_test ] && [ ! -f /root/.factory_installer ]; then | 28 if [ ! -f /root/.factory_test ] && [ ! -f /root/.factory_installer ] && \ |
| 29 [ ! -f /root/.recovery_installer ]; then |
| 29 # Moblin trick: Disable blinking cursor. Without this a splash screen | 30 # Moblin trick: Disable blinking cursor. Without this a splash screen |
| 30 # will show a distinct cursor shape even when the cursor is set to none. | 31 # will show a distinct cursor shape even when the cursor is set to none. |
| 31 echo 0 > /sys/devices/virtual/graphics/fbcon/cursor_blink | 32 echo 0 > /sys/devices/virtual/graphics/fbcon/cursor_blink |
| 32 | 33 |
| 33 /usr/bin/ply-image /usr/share/chromeos-assets/images/login_splash.png & | 34 /usr/bin/ply-image /usr/share/chromeos-assets/images/login_splash.png & |
| 34 fi | 35 fi |
| 35 fi | 36 fi |
| 36 | 37 |
| 37 mount -n -t tmpfs tmp /tmp | 38 mount -n -t tmpfs tmp /tmp |
| 38 mount -n -t tmpfs -onosuid,nodev shmfs /dev/shm | 39 mount -n -t tmpfs -onosuid,nodev shmfs /dev/shm |
| 39 mount -n -t devpts -onoexec,nosuid,gid=5,mode=0620 devpts /dev/pts | 40 mount -n -t devpts -onoexec,nosuid,gid=5,mode=0620 devpts /dev/pts |
| 40 | 41 |
| 41 # Mount our stateful partition. It's always partition 1. | 42 # Mount our stateful partition. It's always partition 1. |
| 42 ROOT_DEV=$(rootdev) | 43 ROOT_DEV=$(rootdev) |
| 43 # On verified boot, we get the real root from the dm slaves. | 44 # On verified boot, we get the real root from the dm slaves. |
| 44 if [ "$ROOT_DEV" = "/dev/dm-0" ]; then | 45 if [ "$ROOT_DEV" = "/dev/dm-0" ]; then |
| 45 ROOT_DEV="/dev/$(basename /sys/block/dm-0/slaves/*)" | 46 ROOT_DEV="/dev/$(basename /sys/block/dm-0/slaves/*)" |
| 46 fi | 47 fi |
| 47 STATE_DEV=${ROOT_DEV%[0-9]*}1 | 48 STATE_DEV=${ROOT_DEV%[0-9]*}1 |
| 48 | 49 |
| 49 # For factory install shim, we never want to write to the SDCard. | 50 # For factory install shim and recovery image, we never want to write to |
| 50 if [ -f /root/.factory_installer ]; then | 51 # the SDCard. |
| 52 if [ -f /root/.factory_installer ] || [ -f /root/.recovery_installer ]; then |
| 51 mount -n -t tmpfs tmp /mnt/stateful_partition | 53 mount -n -t tmpfs tmp /mnt/stateful_partition |
| 52 else | 54 else |
| 53 mount -n -t ext3 "$STATE_DEV" /mnt/stateful_partition | 55 mount -n -t ext3 "$STATE_DEV" /mnt/stateful_partition |
| 54 fi | 56 fi |
| 55 | 57 |
| 56 # Check if the stateful partition has requested self-destruction | 58 # Check if the stateful partition has requested self-destruction |
| 57 # This is used for the factory install process | 59 # This is used for the factory install process |
| 58 RESET_FILE="/mnt/stateful_partition/factory_install_reset" | 60 RESET_FILE="/mnt/stateful_partition/factory_install_reset" |
| 59 if [ -f "$RESET_FILE" ]; then | 61 if [ -f "$RESET_FILE" ]; then |
| 60 if [ $(stat -c%u "$RESET_FILE") -eq 0 ]; then | 62 if [ $(stat -c%u "$RESET_FILE") -eq 0 ]; then |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 (test -f "$SALT" || head -c 16 /dev/urandom > "$SALT") & | 123 (test -f "$SALT" || head -c 16 /dev/urandom > "$SALT") & |
| 122 | 124 |
| 123 # Write out uptime and disk stats pre/post startup | 125 # Write out uptime and disk stats pre/post startup |
| 124 cat /proc/uptime > /tmp/uptime-post-startup | 126 cat /proc/uptime > /tmp/uptime-post-startup |
| 125 ! cat /sys/block/sda/stat > /tmp/disk-post-startup | 127 ! cat /sys/block/sda/stat > /tmp/disk-post-startup |
| 126 echo "$PRE_UPTIME_STAT" > /tmp/uptime-pre-startup | 128 echo "$PRE_UPTIME_STAT" > /tmp/uptime-pre-startup |
| 127 echo "$PRE_DISK_STAT" > /tmp/disk-pre-startup | 129 echo "$PRE_DISK_STAT" > /tmp/disk-pre-startup |
| 128 | 130 |
| 129 # Always return success to avoid killing init | 131 # Always return success to avoid killing init |
| 130 exit 0 | 132 exit 0 |
| OLD | NEW |