summaryrefslogtreecommitdiffstats
path: root/assets
diff options
context:
space:
mode:
authorErnesto Castellotti <mail@ernestocastellotti.it>2023-01-10 19:34:50 +0100
committerSimone <26844016+simonebortolin@users.noreply.github.com>2023-01-12 00:02:02 +0100
commit1cfe3237aa323abc0be0d66fe0a3363301b8120d (patch)
tree6b387eb2100bc7196442a9c9bfcfbf8a4c13b0ab /assets
parentMoved useful functions to assets/js/rootLantiq.js (diff)
downloadhack-gpon.github.io-1cfe3237aa323abc0be0d66fe0a3363301b8120d.tar
hack-gpon.github.io-1cfe3237aa323abc0be0d66fe0a3363301b8120d.tar.gz
hack-gpon.github.io-1cfe3237aa323abc0be0d66fe0a3363301b8120d.tar.bz2
hack-gpon.github.io-1cfe3237aa323abc0be0d66fe0a3363301b8120d.tar.lz
hack-gpon.github.io-1cfe3237aa323abc0be0d66fe0a3363301b8120d.tar.xz
hack-gpon.github.io-1cfe3237aa323abc0be0d66fe0a3363301b8120d.tar.zst
hack-gpon.github.io-1cfe3237aa323abc0be0d66fe0a3363301b8120d.zip
Diffstat (limited to 'assets')
-rw-r--r--assets/js/rootLantiq.js53
1 files changed, 49 insertions, 4 deletions
diff --git a/assets/js/rootLantiq.js b/assets/js/rootLantiq.js
index 24858c1..a25d202 100644
--- a/assets/js/rootLantiq.js
+++ b/assets/js/rootLantiq.js
@@ -2,7 +2,7 @@ function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
-async function waitUbootStop(writer, reader) {
+async function waitUbootStop(writer, reader, outputMsgCallback) {
const interval = setInterval(function() {
writer.write(String.fromCharCode(3));
}, 10);
@@ -11,7 +11,7 @@ async function waitUbootStop(writer, reader) {
const { value, done } = await reader.read();
if (value.startsWith('U-Boot')) {
- loading("Root in progress: Trigger characters received. DO NOT TOUCH THE HUAWEI MA5671A UNTIL THE PROCEDURE IS COMPLETED!",0);
+ outputMsgCallback("Root in progress: Trigger characters received. DO NOT TOUCH THE HUAWEI MA5671A UNTIL THE PROCEDURE IS COMPLETED!");
await delay(5000);
clearInterval(interval);
break;
@@ -36,7 +36,7 @@ async function checkUbootUnlocked(reader) {
}
}
-async function waitFailbackShell(writer, reader) {
+async function waitFailbackShell(writer, reader, outputMsgCallback) {
while (true) {
const { value, done } = await reader.read();
@@ -45,7 +45,7 @@ async function waitFailbackShell(writer, reader) {
writer.write('f\n');
}, 10);
- loading("Root in progress: Trigger characters received. Waiting for boot to end...",1);
+ outputMsgCallback("Root in progress: Trigger characters received. Waiting for boot to end...",1);
await delay(3000);
clearInterval(interval);
break;
@@ -66,3 +66,48 @@ async function waitFailbackShell(writer, reader) {
}
}
}
+
+async function lantiqRootUboot(writer, reader, outputMsgCallback) {
+ await delay(10000);
+ outputMsgCallback("Now you need to insert the Huawei MA5671A into the SFP adapter, if the procedure does not go ahead, check the connections and then remove and reconnect the Huawei MA5671A again",0);
+
+ while(true) {
+ await waitUbootStop(writer, reader, outputMsgCallback);
+ const ubootUnlocked = await checkUbootUnlocked(reader);
+
+ if (ubootUnlocked == true) {
+ break;
+ }
+
+ outputMsgCallback("Root in progress: Set U-Boot bootdelay to 5...");
+ writer.write('setenv bootdelay 5\n');
+ await delay(1000);
+ outputMsgCallback("Root in progress: Enable ASC serial...");
+ writer.write('setenv asc0 0\n');
+ await delay(1000);
+ outputMsgCallback("Root in progress: Set GPIO to unlock serial...");
+ writer.write('setenv preboot "gpio set 3;gpio input 2;gpio input 105;gpio input 106;gpio input 107;gpio input 108"\n');
+ await delay(1000);
+ outputMsgCallback("Root in progress: Save changes...");
+ writer.write('saveenv\n');
+ await delay(1000);
+ outputMsgCallback("Root in progress: Rebooting...");
+ writer.write('reset\n');
+ await delay(1000);
+ }
+
+ outputMsgCallback("Root in progress: RebootingYY...");
+ writer.write('reset\n');
+ await delay(1000);
+}
+
+async function unlockHuaweiShell(writer, reader, outputMsgCallback) {
+ outputMsgCallback("Waiting for reboot");
+ await waitFailbackShell(writer, reader);
+ outputMsgCallback("Root in progress: Enable full Linux shell...");
+ writer.write('mount_root && mkdir -p /overlay/etc && sed "s|/opt/lantiq/bin/minishell|/bin/ash|g" /rom/etc/passwd > /overlay/etc/passwd\n');
+ await delay(1000);
+ outputMsgCallback("Root in progress: Umount rootfs partitions...");
+ writer.write('umount /overlay && umount -a\n');
+ await delay(1000);
+}