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

Side by Side Diff: make_developer_script_runner.sh

Issue 4418001: make_developer_script_runner.sh: fix using full-sized kernels (Closed) Base URL: http://git.chromium.org/git/crosutils.git@0.9.110.B
Patch Set: Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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
1 #!/bin/bash 1 #!/bin/bash
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 # This script modifies a base image to act as a recovery installer. 7 # This script modifies a base image to act as a recovery installer.
8 # If a developer payload is supplied, it will be used. 8 # If a developer payload is supplied, it will be used.
9 # It is very straight forward, top to bottom to show clearly what is 9 # It is very straight forward, top to bottom to show clearly what is
10 # little is needed to create a developer shim to run a signed script. 10 # little is needed to create a developer shim to run a signed script.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 header_offset=34 59 header_offset=34
60 stateful_sectors=$(((FLAGS_statefulfs_size * 1024 * 1024) / 512)) 60 stateful_sectors=$(((FLAGS_statefulfs_size * 1024 * 1024) / 512))
61 stateful_sectors=$(roundup $stateful_sectors) 61 stateful_sectors=$(roundup $stateful_sectors)
62 62
63 if [ -b "$FLAGS_image" ]; then 63 if [ -b "$FLAGS_image" ]; then
64 sudo=sudo 64 sudo=sudo
65 else 65 else
66 max_kern_size=32768 66 max_kern_size=32768
67 dd if=/dev/zero of="${FLAGS_image}" bs=512 count=0 \ 67 dd if=/dev/zero of="${FLAGS_image}" bs=512 count=0 \
68 seek=$((1 + max_kern_size + header_offset + stateful_sectors)) 68 seek=$((1 + max_kern_size + (2 * header_offset) + stateful_sectors))
69 sudo="" 69 sudo=""
70 fi 70 fi
71 71
72 ## STATEFUL 72 ## STATEFUL
73 73
74 stateful_image=$(mktemp) 74 stateful_image=$(mktemp)
75 trap "rm $stateful_image" EXIT 75 trap "rm $stateful_image" EXIT
76 76
77 dd if=/dev/zero of="$stateful_image" bs=512 \ 77 dd if=/dev/zero of="$stateful_image" bs=512 \
78 seek=$stateful_sectors count=0 78 seek=$stateful_sectors count=0
(...skipping 13 matching lines...) Expand all
92 sudo umount -d "$stateful_mnt" 92 sudo umount -d "$stateful_mnt"
93 rmdir "$stateful_mnt" 93 rmdir "$stateful_mnt"
94 94
95 ## GPT 95 ## GPT
96 96
97 kernel_bytes=$(stat -c '%s' $FLAGS_kernel_image) 97 kernel_bytes=$(stat -c '%s' $FLAGS_kernel_image)
98 kernel_sectors=$((kernel_bytes / 512)) 98 kernel_sectors=$((kernel_bytes / 512))
99 kernel_sectors=$(roundup $kernel_sectors) 99 kernel_sectors=$(roundup $kernel_sectors)
100 100
101 $sudo $GPT create $FLAGS_image 101 $sudo $GPT create $FLAGS_image
102 trap "rm $FLAGS_image" ERR 102 trap "rm $FLAGS_image; echo 'An error occurred! Rerun with -v for details.'" ERR
103 103
104 offset=$header_offset 104 offset=$header_offset
105 $sudo $GPT add -b $offset -s $stateful_sectors \ 105 $sudo $GPT add -b $offset -s $stateful_sectors \
106 -t data -l "STATE" $FLAGS_image 106 -t data -l "STATE" $FLAGS_image
107 $sudo dd if=$stateful_image of=$FLAGS_image bs=512 conv=notrunc \ 107 $sudo dd if=$stateful_image of=$FLAGS_image bs=512 conv=notrunc \
108 seek=$offset count=$stateful_sectors 108 seek=$offset count=$stateful_sectors
109 109
110 offset=$((offset + stateful_sectors)) 110 offset=$((offset + stateful_sectors))
111 $sudo $GPT add -b $offset -s $kernel_sectors \ 111 $sudo $GPT add -b $offset -s $kernel_sectors \
112 -t kernel -l "KERN-A" -S 0 -T 15 -P 15 $FLAGS_image 112 -t kernel -l "KERN-A" -S 0 -T 15 -P 15 $FLAGS_image
113 $sudo dd if=$FLAGS_kernel_image of=$FLAGS_image bs=512 conv=notrunc \ 113 $sudo dd if=$FLAGS_kernel_image of=$FLAGS_image bs=512 conv=notrunc \
114 seek=$offset count=$kernel_sectors 114 seek=$offset count=$kernel_sectors
115 # The kernel will ignore GPT without a legacymbr. 115 # The kernel will ignore GPT without a legacymbr.
116 PMBRCODE=$(readlink -f /usr/share/syslinux/gptmbr.bin) 116 PMBRCODE=$(readlink -f /usr/share/syslinux/gptmbr.bin)
117 # Have it legacy boot off of stateful, not that it should matter. 117 # Have it legacy boot off of stateful, not that it should matter.
118 $sudo $GPT boot -p -b "$PMBRCODE" -i 1 $FLAGS_image 1>&2 118 $sudo $GPT boot -p -b "$PMBRCODE" -i 1 $FLAGS_image 1>&2
119 119
120 $sudo $GPT show $FLAGS_image 120 $sudo $GPT show $FLAGS_image
121 121
122 echo "Done." 122 echo "Emitted $FLAGS_image successfully!"
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698