Fix Pixel C installation

This commit is contained in:
topjohnwu
2017-10-07 22:08:10 +08:00
parent 89330b89d8
commit c215447405
10 changed files with 103 additions and 77 deletions

View File

@@ -66,17 +66,6 @@ cpio_mkdir() {
# Initialization
##########################################################################################
BOOTIMAGE="$1"
[ -e "$BOOTIMAGE" ] || (echo "$BOOTIMAGE does not exist!" && exit 1)
# Presets
[ -z $KEEPVERITY ] && KEEPVERITY=false
[ -z $KEEPFORCEENCRYPT ] && KEEPFORCEENCRYPT=false
# Detect whether running as root
id | grep "uid=0" >/dev/null 2>&1 && ROOT=true || ROOT=false
if [ -z $SOURCEDMODE ]; then
# Switch to the location of the script file
cd "`dirname_wrap "${BASH_SOURCE:-$0}"`"
@@ -86,6 +75,14 @@ if [ -z $SOURCEDMODE ]; then
mount_partitions
fi
BOOTIMAGE="$1"
[ -e "$BOOTIMAGE" ] || abort "$BOOTIMAGE does not exist!"
# Presets
[ -z $KEEPVERITY ] && KEEPVERITY=false
[ -z $KEEPFORCEENCRYPT ] && KEEPFORCEENCRYPT=false
chmod -R 755 .
##########################################################################################
@@ -104,6 +101,7 @@ case $? in
abort "! Unable to unpack boot image"
;;
2 )
ui_print "- ChromeOS boot image detected"
CHROMEOS=true
;;
3 )
@@ -145,7 +143,7 @@ case $? in
# Restore failed
ui_print "! Cannot restore from internal backup"
# If we are root and SHA1 known, we try to find the stock backup
if $ROOT && [ ! -z $SHA1 ]; then
if [ ! -z $SHA1 ]; then
STOCKDUMP=/data/stock_boot_${SHA1}.img
if [ -f ${STOCKDUMP}.gz ]; then
ui_print "- Stock boot image backup found"

View File

@@ -32,12 +32,7 @@ get_outfd() {
}
ui_print() {
if $BOOTMODE; then
echo "$1"
else
echo -n -e "ui_print $1\n" >> /proc/self/fd/$OUTFD
echo -n -e "ui_print\n" >> /proc/self/fd/$OUTFD
fi
$BOOTMODE && echo "$1" || echo -e "ui_print $1\nui_print" >> /proc/self/fd/$OUTFD
}
mount_partitions() {
@@ -155,8 +150,9 @@ flash_boot_image() {
}
sign_chromeos() {
echo > empty
ui_print "- Signing ChromeOS boot image"
echo > empty
./chromeos/futility vbutil_kernel --pack new-boot.img.signed \
--keyblock ./chromeos/kernel.keyblock --signprivate ./chromeos/kernel_data_key.vbprivk \
--version 1 --vmlinuz new-boot.img --config empty --arch arm --bootloader empty --flags 0x1