#!/usr/bin/tclsh # # ps3mfw -- PS3 MFW creator # # Copyright (C) Anonymous Developers (Code Monkeys) # # This software is distributed under the terms of the GNU General Public # License ("GPL") version 3, as published by the Free Software Foundation. # # Priority: 300 # Description: Patching LV1 hypervisor to Unmask bootldr by HV (BRICK RISK! for documenting purpose only) # Option --unmask-lv1: Unmask bootldr by HV # Type --unmask-lv1: boolean namespace eval ::unmask_lv1 { array set ::unmask_lv1::options { --unmask-lv1 true } proc main { } { set self "lv1.self" ::modify_coreos_file $self ::unmask_lv1::patch_self } proc patch_self {self} { if {!$::unmask_lv1::options(--unmask-lv1)} { log "WARNING: Enabled task has no enabled option" 1 } else { ::modify_self_file $self ::unmask_lv1::patch_elf } } proc patch_elf {elf} { if {$::unmask_lv1::options(--unmask-lv1)} { log "Patching LV1 hypervisor to Unmask bootldr by HV" set search "\x39\x84\x02\x00\xf8\x01\x00\x90" set replace "\x00" catch_die {::patch_elf $elf $search 2 $replace} \ "Unable to patch self [file tail $elf]" } } }