Permalink
Browse files

OTA updates 5.1 LMY47O.H5 and LMY47O.H6

This represents a major change from using the community-supplied "RUU"
images to the Google-supplied "OTA" images.  The difference is that the
OTA image is incremental and must be applied on top of the version before
it.  The benefit is that I no longer have to rely on the community to
put out RUU images.
  • Loading branch information...
iamjamestl committed Jul 15, 2015
1 parent 9e70d06 commit fbd5f9344947b9e616db3356ae27ea2368acf1aa
View
@@ -2,7 +2,7 @@ puppet:
puppet apply --modulepath=modules -e "class { 'm8_gpe': target => '$(PWD)' }"
clean:
- -rm -rf boot.img build cm csplitb dt dtbtool e2fsprogs m8_gpe.zip mkbootimg ruu supersu sqlite
+ -rm -rf build-* cm csplitb dt-* dtbtool e2fsprogs firmware-* m8_gpe-*.zip mkbootimg ruu supersu sqlite ota-*
distclean: clean
-rm -rf sources
@@ -0,0 +1,32 @@
+Generally, to make the Google-supplied OTA updater-script work in TWRP,
+do the following:
+
+1. Change all 'getprop' instances to probe the /system/build.prop file:
+
+ perl -pi -e 's@(?<!file_)getprop\(@file_getprop("/system/build.prop", @g' updater-script
+
+2. Remove references to mounting and unmounting /data. This isn't
+ strictly necessary, but TWRP already mounts this partition and it
+ prevents a harmless error message from being displayed.
+
+3. Reset build.prop to default before update:
+
+ ui_print("Disabling CDMA mode for update...");
+ run_program("/system/xbin/sed", "-i", "s/^ro.telephony.default_network=.*/ro.telephony.default_network=9/; s/^telephony.lteOnCdmaDevice/#telephony.lteOnCdmaDevice/", "/system/build.prop");
+
+ And reenable CDMA after update:
+
+ ui_print("Reenabling CDMA mode...");
+ run_program("/system/xbin/sed", "-i", "s/^ro.telephony.default_network=.*/ro.telephony.default_network=10/; s/^#telephony.lteOnCdmaDevice/telephony.lteOnCdmaDevice/", "/system/build.prop");
+
+4. Change firmware installation from:
+
+ write_firmware_image("PACKAGE:firmware.zip", "zip");
+ mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/userdata", "/data", "max_batch_time=0,commit=1,data=ordered,barrier=1,errors=panic,nodelalloc");
+
+ to:
+
+ ui_print("Writing boot.img...");
+ package_extract_file("boot.img", "/dev/block/platform/msm_sdcc.1/by-name/boot");
+
+5. Remove all 'set_metadata_recursive' lines.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1,14 +1,19 @@
-class m8_gpe::boot {
- $img = "${m8_gpe::target}/boot.img"
+define m8_gpe::boot (
+ $version = $name,
+ $source_dir,
+ $target_dir,
+) {
+ $img = "${target_dir}/boot.img"
+ $dt_img = "${source_dir}/dt.img"
- class { 'm8_gpe::dt': }
+ m8_gpe::dt { $version:
+ boot_img_dir => $source_dir,
+ img => $dt_img,
+ }
- exec { 'repack-boot.img':
- command => "${m8_gpe::mkbootimg::mkbootimg} --kernel ${m8_gpe::ruu::source_dir}/boot.img-zImage --ramdisk ${m8_gpe::ruu::source_dir}/boot.img-ramdisk.gz --cmdline 'console=ttyHSL0,115200,n8 androidboot.hardware=qcom user_debug=30 msm_rtb.filter=0x3b7 ehci-hcd.park=3' --base 0 --pagesize 2048 --kernel_offset 0x00008000 --ramdisk_offset 0x02000000 --tags_offset 0x01e00000 --dt ${m8_gpe::dt::img} -o ${img}",
- creates => $img,
- require => [
- Class['m8_gpe::dt'],
- Class['m8_gpe::ruu'],
- ],
+ exec { "repack-boot-${version}.img":
+ command => "${m8_gpe::mkbootimg::mkbootimg} --kernel ${source_dir}/boot.img-zImage --ramdisk ${source_dir}/boot.img-ramdisk.gz --cmdline 'console=ttyHSL0,115200,n8 androidboot.hardware=qcom user_debug=30 msm_rtb.filter=0x3b7 ehci-hcd.park=3' --base 0 --pagesize 2048 --kernel_offset 0x00008000 --ramdisk_offset 0x02000000 --tags_offset 0x01e00000 --dt ${dt_img} -o ${img}",
+ refreshonly => true,
+ subscribe => M8_gpe::Dt[$version],
}
}
@@ -1,6 +1,6 @@
-class m8_gpe::build {
- $dir = "${m8_gpe::target}/build"
-
+class m8_gpe::build (
+ $dir,
+) {
m8_gpe::source { 'cm':
source => 'https://thestaticvoid.com/dist/m8_gpe/sources/cm-11-20141008-SNAPSHOT-M11-m8.zip',
type => zip,
@@ -21,7 +21,6 @@
type => tar,
}
- class { 'm8_gpe::boot': }
class { 'm8_gpe::sqlite': }
file { [
@@ -46,14 +45,8 @@
source => 'puppet:///modules/m8_gpe/updater-script',
}
- file { "${dir}/boot.img":
- source => $m8_gpe::boot::img,
- require => Class['m8_gpe::boot'],
- }
-
file { "${dir}/system.img":
source => $m8_gpe::ruu::system_img,
- require => Class['m8_gpe::ruu'],
}
file { "${dir}/tools/resize2fs":
@@ -1,10 +1,20 @@
-class m8_gpe::dt {
- $dir = "${m8_gpe::target}/dt"
- $img = "${dir}/dt.img"
+define m8_gpe::dt (
+ $version = $name,
+ $boot_img_dir,
+ $img,
+) {
+ $dir = "${m8_gpe::target}/dt-${version}"
- class { 'm8_gpe::ruu': }
- class { 'm8_gpe::csplitb': }
- class { 'm8_gpe::dtbtool': }
+ include m8_gpe::csplitb
+ include m8_gpe::dtbtool
+ include m8_gpe::mkbootimg
+
+ exec { "unpack-boot-${version}.img":
+ command => "${m8_gpe::mkbootimg::unpackbootimg} -i boot.img",
+ cwd => "${boot_img_dir}",
+ creates => "${boot_img_dir}/boot.img-dtb",
+ require => Class['m8_gpe::mkbootimg'],
+ }
file { [
$dir,
@@ -15,22 +25,22 @@
ensure => directory,
}
- exec { 'split-boot-dtb':
- command => "${m8_gpe::csplitb::binary} --number 2 --suffix .dtb d00dfeed ${m8_gpe::ruu::source_dir}/boot.img-dtb",
+ exec { "split-boot-dtb-${version}":
+ command => "${m8_gpe::csplitb::binary} --number 2 --suffix .dtb d00dfeed ${boot_img_dir}/boot.img-dtb",
cwd => "${dir}/dtb-split",
refreshonly => true,
subscribe => File["${dir}/dtb-split"],
require => [
Class['m8_gpe::csplitb'],
- Class['m8_gpe::ruu'],
+ Exec["unpack-boot-${version}.img"],
],
}
- exec { 'decompile-dtbs':
+ exec { "decompile-dtbs-${version}":
command => "for dtb in *.dtb; do /usr/bin/dtc -I dtb -O dts -o ${dir}/dts/\$dtb.dts \$dtb; done",
cwd => "${dir}/dtb-split",
refreshonly => true,
- subscribe => Exec['split-boot-dtb'],
+ subscribe => Exec["split-boot-dtb-${version}"],
provider => shell,
}
@@ -43,33 +53,33 @@
#
# htc,project-id = <0x10a 0x0 0x10000 0x10f 0x0 0x10000 ...
#
- exec { 'modify-dts':
- command => '/bin/sed -ri \'s/(0x10f (0x. 0x10000))/0x10a \2 \1/g\' *.dts',
+ exec { "modify-dts-${version}":
+ command => '/bin/sed -ri \'s/(0x10f (0x. 0x10000))/0x10a \2 0x10b \2 \1/g\' *.dts',
cwd => "${dir}/dts",
unless => '/bin/grep "0x10a 0x. 0x10000" *.dts',
- require => Exec['decompile-dtbs'],
+ require => Exec["decompile-dtbs-${version}"],
}
- exec { 'compile-modified-dts':
+ exec { "compile-modified-dts-${version}":
command => "for dts in *.dts; do /usr/bin/dtc -I dts -O dtb -o ${dir}/dtb-modified/\$dts.dtb \$dts; done",
cwd => "${dir}/dts",
refreshonly => true,
- subscribe => Exec['modify-dts'],
+ subscribe => Exec["modify-dts-${version}"],
provider => shell,
}
- exec { 'remove-old-dt.img':
+ exec { "remove-old-dt-${version}.img":
command => "/bin/rm -f ${img}",
refreshonly => true,
- subscribe => Exec['compile-modified-dts'],
+ subscribe => Exec["compile-modified-dts-${version}"],
}
- exec { 'make-dt.img':
+ exec { "make-dt-${version}.img":
command => "${m8_gpe::dtbtool::binary} -s 2048 -d 'htc,project-id = <' -o ${img} -p /usr/bin/ ${dir}/dtb-modified/",
creates => $img,
require => [
Class['m8_gpe::dtbtool'],
- Exec['remove-old-dt.img'],
+ Exec["remove-old-dt-${version}.img"],
],
}
}
@@ -2,24 +2,18 @@
$target,
) {
$sources_dir = "${target}/sources"
- $zip = "${target}/m8_gpe.zip"
file { $sources_dir:
ensure => directory,
}
- class { 'm8_gpe::build': }
+ class { 'm8_gpe::ruu': }
- exec { 'remove-old-zip':
- command => "/bin/rm -f ${zip}",
- refreshonly => true,
- subscribe => Class['m8_gpe::build'],
+ m8_gpe::ota { 'LMY47O.H5':
+ source => 'http://android.clients.google.com/packages/ota/gpedogfood_htc_m8_generic/4eaf26db2c018451a068638bd01c6854a0eef0f1.OTA_M8_UL_L51_STOCK_UI_MR_Google_WWE_4.04.1700.5-4.04.1700.4_release_429773.zip',
}
- exec { 'zip':
- command => "/usr/bin/zip -r ${zip} .",
- cwd => $m8_gpe::build::dir,
- creates => $zip,
- require => Exec['remove-old-zip'],
+ m8_gpe::ota { 'LMY47O.H6':
+ source => 'http://android.clients.google.com/packages/ota/gpedogfood_htc_m8_generic/47d86b52e0571cd645216fbbe7d7e404ecd4c3da.OTA_M8_UL_L51_STOCK_UI_MR_Google_WWE_4.04.1700.6-4.04.1700.5_release_430317.zip',
}
}
@@ -0,0 +1,56 @@
+define m8_gpe::ota (
+ $version = $name,
+ $source,
+) {
+ $zip = "${m8_gpe::target}/m8_gpe-ota-${version}.zip"
+ $source_dir = "${m8_gpe::target}/ota-${version}"
+
+ m8_gpe::source { "ota-${version}":
+ source => $source,
+ type => zip,
+ }
+
+ m8_gpe::source { "firmware-${version}":
+ source => "${source_dir}/firmware.zip",
+ type => zip,
+ require => M8_Gpe::Source["ota-${version}"],
+ }
+
+ m8_gpe::boot { $version:
+ source_dir => "${m8_gpe::target}/firmware-${version}",
+ target_dir => $source_dir,
+ require => M8_gpe::Source["firmware-${version}"],
+ }
+
+ file { [
+ "${source_dir}/firmware.zip",
+ "${source_dir}/META-INF/CERT.RSA",
+ "${source_dir}/META-INF/CERT.SF",
+ "${source_dir}/META-INF/MANIFEST.MF",
+ "${source_dir}/META-INF/com/android",
+ ]:
+ ensure => absent,
+ force => true,
+ require => M8_gpe::Source["firmware-${version}"],
+ notify => Exec["remove-old-zip-ota-${version}"],
+ }
+
+ file { "${source_dir}/META-INF/com/google/android/updater-script":
+ source => "puppet:///modules/m8_gpe/ota/updater-script-${version}",
+ require => M8_gpe::Source["ota-${version}"],
+ notify => Exec["remove-old-zip-ota-${version}"],
+ }
+
+ exec { "remove-old-zip-ota-${version}":
+ command => "/bin/rm -f ${zip}",
+ refreshonly => true,
+ subscribe => M8_gpe::Boot[$version],
+ }
+
+ exec { "zip-ota-${version}":
+ command => "/usr/bin/zip -r ${zip} .",
+ cwd => $source_dir,
+ creates => $zip,
+ require => Exec["remove-old-zip-ota-${version}"],
+ }
+}
@@ -1,20 +1,41 @@
class m8_gpe::ruu {
+ $zip = "${m8_gpe::target}/m8_gpe-ruu.zip"
$source_dir = "${m8_gpe::target}/ruu"
+ $target_dir = "${m8_gpe::target}/build-ruu"
$boot_img = "${source_dir}/boot.img"
$system_img = "${source_dir}/system.img"
- class { 'm8_gpe::mkbootimg': }
+ include 'm8_gpe::mkbootimg'
m8_gpe::source { 'ruu':
source => 'https://thestaticvoid.com/dist/m8_gpe/sources/RUU-HTC_One_M8_GPE_5.1-4.04.1700.4.zip',
type => zip,
}
- exec { 'unpack-boot.img':
- command => "${m8_gpe::mkbootimg::unpackbootimg} -i ${boot_img}",
- cwd => "${source_dir}",
+ class { 'm8_gpe::build':
+ dir => $target_dir,
+ require => M8_gpe::Source['ruu'],
+ }
+
+ m8_gpe::boot { 'ruu':
+ source_dir => $source_dir,
+ target_dir => $target_dir,
+ require => Class['m8_gpe::build'],
+ }
+
+ exec { 'remove-old-zip-ruu':
+ command => "/bin/rm -f ${zip}",
refreshonly => true,
- subscribe => M8_gpe::Source['ruu'],
- require => Class['m8_gpe::mkbootimg'],
+ subscribe => [
+ M8_gpe::Boot['ruu'],
+ Class['m8_gpe::build'],
+ ]
+ }
+
+ exec { 'zip-ruu':
+ command => "/usr/bin/zip -r ${zip} .",
+ cwd => $m8_gpe::build::dir,
+ creates => $zip,
+ require => Exec['remove-old-zip-ruu'],
}
}
@@ -1,18 +1,27 @@
define m8_gpe::source (
$source,
$type = none,
+ $fetch = true,
) {
$ext = $type ? {
none => '',
default => ".${type}"
}
- $dest = "${m8_gpe::sources_dir}/${name}${ext}"
+ $dest = $fetch ? {
+ false => $source,
+ default => "${m8_gpe::sources_dir}/${name}${ext}",
+ }
+
$target = "${m8_gpe::target}/${name}"
- $fetch_command = $type ? {
- git => "/usr/bin/git clone --bare ${source} ${dest}",
- default => "/usr/bin/wget ${source} -O ${dest}",
+ if $source =~ /^\// {
+ $fetch_command = "/bin/cp ${source} ${dest}"
+ } else {
+ $fetch_command = $type ? {
+ git => "/usr/bin/git clone --bare ${source} ${dest}",
+ default => "/usr/bin/wget ${source} -O ${dest}",
+ }
}
exec { "fetch-${name}":
@@ -35,7 +44,7 @@
}
$extract_command = $type ? {
- zip => "/usr/bin/unzip ${dest}",
+ zip => "/usr/bin/unzip ${dest} || /bin/true",
tar => "/bin/tar --strip-components=1 -xvf ${dest}",
}

0 comments on commit fbd5f93

Please sign in to comment.