Fastboot を使用して Xperia 1 II に 5 II のシステムを書き込む

Android

 こんにちは!ガジェットぴろぐです。

 今回は、Xperia 1 II に、Xperia 5 II のシステムファイルを書き込む手順をご紹介します。

このブログ内で紹介している手順は、最悪の場合端末が起動しなくなる(文鎮化)場合があります。自己責任にて作業を行ってください。

準備

今回書き込む手順には、Fastboot を使用して行う方法を紹介します。

Fastboot は、Google が Android Studio の機能の一つとして公開してるもので、Android アプリの開発や、デバイスのブートローダーを解除したり、システムイメージを書き込んだりする場合に必要な fastboot が含まれているパッケージとなります。

システムを修復する方法や、Stock ROM を書き込む方法については、以下の記事に記述しているのでご参考までに確認してみてください。

SDK Platform-Tools をダウンロードする

Android Developers サイトから、SDK Platform-Tools for Windows をダウンロードします。

SDK Platform-Tools リリースノート  |  Android Studio  |  Android Developers
Android SDK Platform-Tools は Android SDK 用のコンポーネントです。

サイトを開くと、SDK Platform-Tools リリースノートが表示されるので、少し下の方に移動します。

 ダウンロードセクションまで進むと、Windows, Mac, Linux に合わせたダウンロードリンクが公開されているので、デバイスに合うファイルをダウンロードします。

 今回の場合は、一番上の「SDK Platform-Tools for Windows をダウンロード」から、Windows 向けのファイルをダウンロードします。

 クリックすると、利用規約が表示されるので、利用規約に目を通した後、「上記利用規約を読んだうえで利用規約に同意します。」にチェックを入れ、「ダウンロードする: Android SDK Platform-Tools (Windows 用)」をクリックしファイルをダウンロードします。

ダウンロードしたファイルを展開し、「adb.exe」「fastboot.exe」があるフォルダまで進めば「SDK Platform-Tools」の準備は終了となります。

XperiFirm でファームウェアを取得する

今回は、Xperia 1 II に、5 II のファームウェアを書き込む手順で紹介していますが、1 II に Xperia PRO のファームウェアや、確認はしておりませんが、1 に 5 や、1 III に 5 III、のファームウェアを焼くことも可能かと思います。

[TOOL] XperiFirm ~ Xperia Firmware Downloader [v5.7.0]
NOTE: This thread is the only official source of XperiFirm! Websites like xperifirm.com and xperifirmtool.com were not authorized to redistribute my software! ...

xda-developers.com から、XperiFirm (現時点だと、5.6.5) をダウンロードします。ダウンロードしたファイルを展開し、「XperiFirm-x64.exe」を起動します。

起動後は、右下の設定ボタンから、「Unpack firmware automatically」にチェックを入れ「OK」を押して内容を確定しておきましょう。

「Always ask where to download firmware files」で、毎回ダウンロード先を尋ねるようにするか、「Download firmware files to:」でファームウェアをダウンロードするフォルダを決めておきましょう。

XQ-AT42 に、XQ-AS42 のファームウェアを焼くので、XperiFirm では、Smartphone (2020) タブから、Xperia 5 II (PDX-206) と進み、XQ-AS42 dual を選択し、中央タブに一つだけ表示されている「Customized JP」をクリックします。

クリックすると、「Available Firmware」「58.1.A.8.18」(アップデートがあればまた変わる) が表示されるので、クリックして「Download」します。

ファームウェアをアンパックする

・unsin

[TOOL] UnSIN ~ SIN v3/v4/v5 Unpacker [v2.0]
This tool was especially made for the new SIN v3 format used in Xperia Z3+/Z4 and Xperia Z4 Tablet (and more recent Xperia devices as well), as well as SIN v4 f...

・lpunpack

GitHub - LonelyFool/lpunpack_and_lpmake: android super.img tools
android super.img tools. Contribute to LonelyFool/lpunpack_and_lpmake development by creating an account on GitHub.

の2つをダウンロードします。両方とも展開し、lpunpack に関しては、「make.sh」から、「lpunpack」バイナリをビルドして実行できるようにしておいてください。

先程メモしたダウンロードフォルダにコマンドプロンプトを使用して cd コマンドで移動し、unsin を使用して、super.sin イメージから、super.img イメージを取り出し、lpunpack で各パーティションにある img ファイルを取り出します。

> unsin super_X-FLASH-ALL-2389.sin

少し待つと「super_X-FLASH-ALL-2389.img」が生成されます。

このタイミングで、「vbmeta, vbmeta_system」も unsin から img ファイルを取り出しておきましょう。

適当なフォルダを一つ作成し、今回は「unpack」とします。lpunpack でこのフォルダに各パーティションイメージを取り出すよう WSL などでコマンドを実行します。

$ ./lpunpack ./super_X-FLASH-ALL-2389.img ./unpack

こちらも少し待つと、「unpack」フォルダに「odm_, product_, system_, system_ext_, vendor_」から始まる a,b ファイルが生成されるので、これを fastbootd で全て焼いていきます。

Fastboot(d) でファームウェアを焼く

 Xperia 本体の電源を落とし、ボリュームアップキーを押しながらパソコンと本体を USB 接続し、電源ランプが青色に点灯すれば fastboot に入れました。

AOSP build instructions | Developer World

 AOSP build instructions ページにも記載がある通り、2020年以降のデバイスでは、システムイメージを書き込む時には、fastbootd に入る必要があるので、Platform-Tools の中にある fastboot コマンドを実行して fastbootd に入ります。

> fastboot reboot fastboot

fastbootd に入ると赤文字ででかでかと fastbootd と表示されるのでこれが出たらファームウェアを順番に焼いていきます。

最初に vbmeta、vbmeta_system を焼き、後でシステムイメージを焼いていきます。

> fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
> fastboot --disable-verity --disable-verification flash vbmeta_system vbmeta_system.img
> fastboot flash odm_a odm_a.img
> fastboot flash odm_b odm_b.img
> fastboot flash product_a product_a.img
> fastboot flash product_b product_b.img
> fastboot flash system_a system_a.img
> fastboot flash system_b system_b.img
> fastboot flash system_ext_a system_ext_a.img
> fastboot flash system_ext_b system_ext_b.img
> fastboot flash vendor_a vendor_a.img
> fastboot flash vendor_b vendor_b.img

※ 0 KB のファイルは焼かなくてもいいかも…?

これでファームウェアの書き込みが完了したので、ボリュームキーを操作して「Reboot system now」に合わせたら電源ボタンを押して再起動しましょう。

コメント

");const o=ie?ie.createHTML(e):e;if(nt===tt)try{t=(new W).parseFromString(o,at)}catch(e){}if(!t||!t.documentElement){t=le.createDocument(nt,"template",null);try{t.documentElement.innerHTML=ot?ae:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),nt===tt?ue.call(t,Ie?"html":"body")[0]:Ie?t.documentElement:i},bt=function(e){return ce.call(e.ownerDocument||e,e,H.SHOW_ELEMENT|H.SHOW_COMMENT|H.SHOW_TEXT|H.SHOW_PROCESSING_INSTRUCTION|H.SHOW_CDATA_SECTION,null)},St=function(e){return e instanceof B&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof z)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Rt=function(e){return"function"==typeof b&&e instanceof b},wt=function(e,t,n){pe[e]&&u(pe[e],(e=>{e.call(o,t,n,ut)}))},Ct=function(e){let t=null;if(wt("beforeSanitizeElements",e,null),St(e))return _t(e),!0;const n=st(e.nodeName);if(wt("uponSanitizeElement",e,{tagName:n,allowedTags:Ne}),e.hasChildNodes()&&!Rt(e.firstElementChild)&&_(/<[/\w]/g,e.innerHTML)&&_(/<[/\w]/g,e.textContent))return _t(e),!0;if(e.nodeType===J)return _t(e),!0;if(Me&&e.nodeType===Q&&_(/<[/\w]/g,e.data))return _t(e),!0;if(!Ne[n]||Ce[n]){if(!Ce[n]&&Dt(n)){if(we.tagNameCheck instanceof RegExp&&_(we.tagNameCheck,n))return!1;if(we.tagNameCheck instanceof Function&&we.tagNameCheck(n))return!1}if(Ye&&!qe[n]){const t=re(e)||e.parentNode,n=oe(e)||e.childNodes;if(n&&t){for(let o=n.length-1;o>=0;--o){const r=X(n[o],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,$(e))}}}return _t(e),!0}return e instanceof R&&!Et(e)?(_t(e),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!_(/<\/no(script|embed|frames)/i,e.innerHTML)?(ke&&e.nodeType===Z&&(t=e.textContent,u([fe,de,he],(e=>{t=g(t,e," ")})),e.textContent!==t&&(p(o.removed,{element:e.cloneNode()}),e.textContent=t)),wt("afterSanitizeElements",e,null),!1):(_t(e),!0)},Lt=function(e,t,n){if(Be&&("id"===t||"name"===t)&&(n in r||n in mt))return!1;if(ve&&!Le[t]&&_(ge,t));else if(De&&_(Te,t));else if(!Se[t]||Le[t]){if(!(Dt(e)&&(we.tagNameCheck instanceof RegExp&&_(we.tagNameCheck,e)||we.tagNameCheck instanceof Function&&we.tagNameCheck(e))&&(we.attributeNameCheck instanceof RegExp&&_(we.attributeNameCheck,t)||we.attributeNameCheck instanceof Function&&we.attributeNameCheck(t))||"is"===t&&we.allowCustomizedBuiltInElements&&(we.tagNameCheck instanceof RegExp&&_(we.tagNameCheck,n)||we.tagNameCheck instanceof Function&&we.tagNameCheck(n))))return!1}else if(Ze[t]);else if(_(Ae,g(n,Ee,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==T(n,"data:")||!Ke[e]){if(Oe&&!_(ye,g(n,Ee,"")));else if(n)return!1}else;return!0},Dt=function(e){return"annotation-xml"!==e&&h(e,_e)},vt=function(e){wt("beforeSanitizeAttributes",e,null);const{attributes:t}=e;if(!t)return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Se};let r=t.length;for(;r--;){const i=t[r],{name:a,namespaceURI:l,value:c}=i,s=st(a);let p="value"===a?c:y(c);if(n.attrName=s,n.attrValue=p,n.keepAttr=!0,n.forceKeepAttr=void 0,wt("uponSanitizeAttribute",e,n),p=n.attrValue,n.forceKeepAttr)continue;if(At(a,e),!n.keepAttr)continue;if(!xe&&_(/\/>/i,p)){At(a,e);continue}if(Me&&_(/((--!?|])>)|<\/(style|title)/i,p)){At(a,e);continue}ke&&u([fe,de,he],(e=>{p=g(p,e," ")}));const f=st(e.nodeName);if(Lt(f,s,p)){if(!We||"id"!==s&&"name"!==s||(At(a,e),p=Ge+p),ie&&"object"==typeof G&&"function"==typeof G.getAttributeType)if(l);else switch(G.getAttributeType(f,s)){case"TrustedHTML":p=ie.createHTML(p);break;case"TrustedScriptURL":p=ie.createScriptURL(p)}try{l?e.setAttributeNS(l,a,p):e.setAttribute(a,p),St(e)?_t(e):m(o.removed)}catch(e){}}}wt("afterSanitizeAttributes",e,null)},Ot=function e(t){let n=null;const o=bt(t);for(wt("beforeSanitizeShadowDOM",t,null);n=o.nextNode();)wt("uponSanitizeShadowNode",n,null),Ct(n)||(n.content instanceof s&&e(n.content),vt(n));wt("afterSanitizeShadowDOM",t,null)};return o.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=null,i=null,l=null;if(ot=!e,ot&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Rt(e)){if("function"!=typeof e.toString)throw A("toString is not a function");if("string"!=typeof(e=e.toString()))throw A("dirty is not a string, aborting")}if(!o.isSupported)return e;if(Ue||ft(t),o.removed=[],"string"==typeof e&&(je=!1),je){if(e.nodeName){const t=st(e.nodeName);if(!Ne[t]||Ce[t])throw A("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof b)n=Nt("\x3c!----\x3e"),r=n.ownerDocument.importNode(e,!0),r.nodeType===V&&"BODY"===r.nodeName||"HTML"===r.nodeName?n=r:n.appendChild(r);else{if(!Fe&&!ke&&!Ie&&-1===e.indexOf("<"))return ie&&ze?ie.createHTML(e):e;if(n=Nt(e),!n)return Fe?null:ze?ae:""}n&&Pe&&_t(n.firstChild);const c=bt(je?e:n);for(;i=c.nextNode();)Ct(i)||(i.content instanceof s&&Ot(i.content),vt(i));if(je)return e;if(Fe){if(He)for(l=se.call(n.ownerDocument);n.firstChild;)l.appendChild(n.firstChild);else l=n;return(Se.shadowroot||Se.shadowrootmode)&&(l=me.call(a,l,!0)),l}let m=Ie?n.outerHTML:n.innerHTML;return Ie&&Ne["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&_(q,n.ownerDocument.doctype.name)&&(m="\n"+m),ke&&u([fe,de,he],(e=>{m=g(m,e," ")})),ie&&ze?ie.createHTML(m):m},o.setConfig=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ft(e),Ue=!0},o.clearConfig=function(){ut=null,Ue=!1},o.isValidAttribute=function(e,t,n){ut||ft({});const o=st(e),r=st(t);return Lt(o,r,n)},o.addHook=function(e,t){"function"==typeof t&&(pe[e]=pe[e]||[],p(pe[e],t))},o.removeHook=function(e){if(pe[e])return m(pe[e])},o.removeHooks=function(e){pe[e]&&(pe[e]=[])},o.removeAllHooks=function(){pe={}},o}();return oe}));
タイトルとURLをコピーしました