Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: src/scripts/kernel_fetcher.sh

Issue 600074: Create a fourth partition to put the raw kernel image in. (Closed)
Patch Set: Simplify kernel_fetcher.sh and make it more robust. Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/scripts/image_to_usb.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2
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
5 # found in the LICENSE file.
6
7 # Load common constants. This should be the first executable line.
8 # The path to common.sh should be relative to your script's location.
9 . "$(dirname "$0")/common.sh"
10
11 IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images"
12
13 # Flags
14 DEFINE_string from "" "Directory containing rootfs.image and mbr.image"
15 DEFINE_string to "" "Destination file for USB image."
16 DEFINE_integer offset 0 "Offset to write the kernel to in the destination."
17
18 # Parse command line
19 FLAGS "$@" || exit 1
20 eval set -- "${FLAGS_ARGV}"
21
22 # Die on any errors.
23 set -e
24
25 if [ -z "${FLAGS_from}" -o -z "${FLAGS_to}" -o -z "${FLAGS_offset}" ]
26 then
27 echo "You must define all of from, to and offset."
28 exit 1
29 fi
30
31 # Convert args to paths. Need eval to un-quote the string so that shell
32 # chars like ~ are processed; just doing FOO=`readlink -f $FOO` won't work.
33 FLAGS_from=`eval readlink -f ${FLAGS_from}`
34 FLAGS_to=`eval readlink -f ${FLAGS_to}`
35
36 function do_cleanup {
37 sync
38 sudo umount -l /tmp/kernel_fetch.$$
39 rmdir /tmp/kernel_fetch.$$
40 }
41
42 trap do_cleanup EXIT
43
44 #
45 # Set up loop device. This time it is used to fetch the built kernel from the
46 # root image. This kernel is then written to the fourth partition.
47 #
48 echo "Fetching kernel from root image..."
49 mkdir /tmp/kernel_fetch.$$
50 sudo mount -o loop "${FLAGS_from}/rootfs.image" /tmp/kernel_fetch.$$
51
52 echo "Writing kernel to ${FLAGS_to} at ${FLAGS_offset}..."
53 sudo "${SCRIPTS_DIR}"/file_copy.py \
54 if=/tmp/kernel_fetch.$$/boot/vmlinux.uimg \
55 of="${FLAGS_to}" \
56 seek_bytes="${FLAGS_offset}"
57 echo "Done."
58
59 do_cleanup
60
61 trap - EXIT
OLDNEW
« no previous file with comments | « src/scripts/image_to_usb.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698