summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimone <26844016+simonebortolin@users.noreply.github.com>2023-01-18 14:16:05 +0100
committerGitHub <noreply@github.com>2023-01-18 14:16:05 +0100
commitc5b278600f65b87a2dfc1ba9d78c20ddeb9218d9 (patch)
tree0d0375ff9ef6de854e5a529dc9552b12dc0ef8e3
parentGeneral refactor of Hardware Specifications, Serial and heading - Lantiq (#115) (diff)
downloadhack-gpon.github.io-c5b278600f65b87a2dfc1ba9d78c20ddeb9218d9.tar
hack-gpon.github.io-c5b278600f65b87a2dfc1ba9d78c20ddeb9218d9.tar.gz
hack-gpon.github.io-c5b278600f65b87a2dfc1ba9d78c20ddeb9218d9.tar.bz2
hack-gpon.github.io-c5b278600f65b87a2dfc1ba9d78c20ddeb9218d9.tar.lz
hack-gpon.github.io-c5b278600f65b87a2dfc1ba9d78c20ddeb9218d9.tar.xz
hack-gpon.github.io-c5b278600f65b87a2dfc1ba9d78c20ddeb9218d9.tar.zst
hack-gpon.github.io-c5b278600f65b87a2dfc1ba9d78c20ddeb9218d9.zip
-rw-r--r--_includes/ymodem_lantiq.html205
-rw-r--r--_ont/ont-huawei-ma5671a-root-web.md1
-rw-r--r--_ont/ont-huawei-ma5671a-root.md2
-rw-r--r--_ont/ont-huawei-ma5671a-ymodem.md202
4 files changed, 215 insertions, 195 deletions
diff --git a/_includes/ymodem_lantiq.html b/_includes/ymodem_lantiq.html
new file mode 100644
index 0000000..2dc5c84
--- /dev/null
+++ b/_includes/ymodem_lantiq.html
@@ -0,0 +1,205 @@
+<div class="modal" data-jtd-modal="flash-modal" data-jtd-modal-backdrop="static" id="flash-modal">
+ <div class="modal-content">
+ <div class="modal-header">
+ <span class="close">&times;</span>
+ <h2>Flash firmware</h2>
+ </div>
+ <form id="flash-form" class="p-4" novalidate>
+ <div class="form-floating mb-3">
+ <input type="file" class="form-control" placeholder="Flash MTD" name="flash-mtd" id="flash-mtd" required>
+ <label for="flash-mtd">Flash MTD</label>
+ </div>
+ <div class="mb-3 form-check">
+ <input type="checkbox" class="form-check-input" id="baud-rate-oc" name="baud-rate-oc">
+ <label class="form-check-label" for="baud-rate-oc">230400 baud rate, do not enable unless told to do so</label>
+ </div>
+ <div class="form-check">
+ <input class="form-check-input" type="radio" name="image" id="image0" value="image0">
+ <label class="form-check-label" for="image0">
+ Image 0
+ </label>
+ </div>
+ <div class="form-check">
+ <input class="form-check-input" type="radio" name="image" id="image1" value="image1">
+ <label class="form-check-label" for="image1">
+ Image 1
+ </label>
+ </div>
+ <div class="mb-3">
+ <input type="submit" class="btn btn-primary" value="Flash!">
+ </div>
+ <progress id="flash-progress" value="0" max="100"></progress>
+ <p id="flash-text-step"></p>
+ </form>
+ </div>
+</div>
+
+<script type="text/javascript" src="/assets/js/xymini.js"></script>
+{% if include.dontLoadRootScript != true %}
+<script type="text/javascript" src="/assets/js/rootLantiq.js"></script>
+<script type="text/javascript" src="/assets/js/serialUtil.js"></script>
+{% endif %}
+<script>
+ if ('serial' in navigator) {
+ document.getElementById('flash-start-button').disabled = false;
+ } else {
+ document.getElementById('flash-browser-error').style.display = 'block';
+ }
+ const acontroller = new AbortController();
+ const cs = acontroller.signal;
+ let flashModal = document.getElementById("flash-modal");
+ let flashForm = document.getElementById("flash-form");
+ let flashProgress = document.getElementById("flash-progress");
+ let flashTextStep = document.getElementById("flash-text-step");
+ flashModal.addEventListener('modal-jtd-close', async function(event) {
+ acontroller.abort();
+ });
+ flashModal.addEventListener('modal-jtd-open', async function(event) {
+ flash({signal: cs});
+ });
+ function initTextStep() {
+ flashTextStep.textContent = "";
+ flashTextStep.classList.remove('text-success-400');
+ flashTextStep.classList.remove('text-error-400');
+ }
+ function pause(message) {
+ flashTextStep.textContent = message;
+ }
+ function loading(message) {
+ flashTextStep.textContent = message;
+ }
+ function showError(message) {
+ flashTextStep.textContent = message;
+ flashTextStep.classList.add('text-error-400');
+ flashTextStep.classList.remove('text-success-400');
+ }
+ function showSuccess(message) {
+ flashTextStep.textContent = message;
+ flashTextStep.classList.add('text-success-400');
+ flashTextStep.classList.remove('text-error-400');
+ }
+ async function flash({ signal } = {}) {
+ initTextStep();
+ let port;
+ try {
+ port = await navigator.serial.requestPort();
+ } catch (err) {
+ showError(`Error: ${err.message}`);
+ console.log(`Error: ${err.message}\n`);
+ return;
+ }
+ if (!port) {
+ showError('Error: port not open');
+ console.log('Error: port not open\n');
+ return;
+ }
+ flashForm.addEventListener('submit', async function(event) {
+ if (!flashForm.checkValidity()) {
+ event.preventDefault();
+ [...flashForm.elements].map(function(e){return e.parentNode}).forEach(function(e){e.classList.toogle('was-validated', true)});
+ } else {
+ event.preventDefault();
+ [...flashForm.elements].map(function(e){return e.parentNode}).forEach(function(e){e.classList.toogle('was-validated', false)});
+ var fomrdata = new FormData(flashForm);
+ var file = fomrdata.get('flash-mtd');
+ var image = fomrdata.get('image');
+ var data = new Uint8Array(await file.arrayBuffer());
+ console.log(data);
+
+ /* Unlock U-Boot if needed and stop booting */
+ let result = await lantiqRootUboot(port, "{{include.modelName}}",
+ (msg) => {
+ loading(msg);
+ console.log(msg);
+ },
+ (err) => {
+ showError(err);
+ console.log(err);
+ }
+ );
+
+ if (!result) {
+ return;
+ }
+
+ let baudrate = 115200;
+ if(fomrdata.has('baud-rate-oc')) {
+ let newBaudrate = 230400;
+ loading(`Changing baudrate to: ${newBaudrate}`);
+
+ result = await changeBaudrate(port, newBaudrate, baudrate,
+ (err) => {
+ showError(err);
+ console.log(err);
+ }
+ );
+
+ if (result) {
+ baudrate = newBaudrate;
+ } else {
+ return;
+ }
+ }
+
+ loading("Start sending image to the SFP...");
+ result = await sendImageMtd(port, data, baudrate,
+ (err) => {
+ showError(err);
+ console.log(err);
+ },
+ (byteTransfered) => {
+ const perc = (byteTransfered/data.length) * 100;
+ const percTrunc = Math.trunc(perc*100)/100; /* Two decimal trunc */
+ flashProgress.value = perc;
+ loading(`Image transfer: ${percTrunc}% complete`)
+ }
+ );
+
+ if (!result) {
+ return;
+ }
+
+ result = await waitEndImageLoad(port, baudrate,
+ (err) => {
+ showError(err);
+ console.log(err);
+ }
+ );
+
+ if (!result) {
+ return;
+ }
+
+ if(fomrdata.has('baud-rate-oc')) {
+ let newBaudrate = 115200;
+ loading(`Restore baudrate to: ${newBaudrate}`);
+
+ result = await changeBaudrate(port, newBaudrate, baudrate,
+ (err) => {
+ showError(err);
+ console.log(err);
+ }
+ );
+
+ if (result) {
+ baudrate = newBaudrate;
+ } else {
+ return;
+ }
+ }
+
+ loading("Transfer complete, image flash in progress. DO NOT REMOVE the SFP!");
+ result = await flashImageMtd(port, image, baudrate,
+ (err) => {
+ showError(err);
+ console.log(err);
+ }
+ );
+
+ if (result) {
+ showSuccess("Flash completed, now you can remove the SFP");
+ }
+ }
+ });
+ };
+</script> \ No newline at end of file
diff --git a/_ont/ont-huawei-ma5671a-root-web.md b/_ont/ont-huawei-ma5671a-root-web.md
index 22ac1ed..b0cfc9a 100644
--- a/_ont/ont-huawei-ma5671a-root-web.md
+++ b/_ont/ont-huawei-ma5671a-root-web.md
@@ -35,6 +35,7 @@ Connect the TTL adapter to the computer, once done press the following button. A
{% include alert.html content="Your browser does not support JavaScript!" alert="Note" icon="svg-warning" color="red" %}
</noscript>
+{% include alert.html content="If this procedure does not work, you can use this [alternative procedure](/ont-huawei-ma5671a-ymodem)" alert="Info" icon="svg-info" color="blue" %}
# Connect to the stick via SSH
diff --git a/_ont/ont-huawei-ma5671a-root.md b/_ont/ont-huawei-ma5671a-root.md
index fa671d2..1216cea 100644
--- a/_ont/ont-huawei-ma5671a-root.md
+++ b/_ont/ont-huawei-ma5671a-root.md
@@ -15,6 +15,8 @@ search_exclude: true
Can be accessed via the link [Web root procedure](/ont-huawei-ma5671a-root-web)
+{% include alert.html content="If this procedure does not work, you can use this [alternative procedure](/ont-huawei-ma5671a-ymodem). Do not use the V2 and V1 versions under any circumstances." alert="Info" icon="svg-warning" color="red" %}
+
# Root Procedure for Huawei MA5671A (V2 - Python)
{% include alert.html content="This version remains for documentation purposes only. Please use the latest procedure: [Web root procedure](/ont-huawei-ma5671a-root-web)" alert="Important" icon="svg-warning" color="red" %}
diff --git a/_ont/ont-huawei-ma5671a-ymodem.md b/_ont/ont-huawei-ma5671a-ymodem.md
index 9756dd0..803aea8 100644
--- a/_ont/ont-huawei-ma5671a-ymodem.md
+++ b/_ont/ont-huawei-ma5671a-ymodem.md
@@ -5,202 +5,14 @@ parent: Huawei MA5671A
layout: default
---
-<div class="modal" data-jtd-modal="flash-modal" data-jtd-modal-backdrop="static" id="flash-modal">
- <div class="modal-content">
- <div class="modal-header">
- <span class="close">&times;</span>
- <h2>Flash firmware</h2>
- </div>
- <form id="flash-form" class="p-4" novalidate>
- <div class="form-floating mb-3">
- <input type="file" class="form-control" placeholder="Flash MTD" name="flash-mtd" id="flash-mtd" required>
- <label for="flash-mtd">Flash MTD</label>
- </div>
- <div class="mb-3 form-check">
- <input type="checkbox" class="form-check-input" id="baud-rate-oc" name="baud-rate-oc">
- <label class="form-check-label" for="baud-rate-oc">230400 baud rate, do not enable unless told to do so</label>
- </div>
- <div class="form-check">
- <input class="form-check-input" type="radio" name="image" id="image0" value="image0">
- <label class="form-check-label" for="image0">
- Image 0
- </label>
- </div>
- <div class="form-check">
- <input class="form-check-input" type="radio" name="image" id="image1" value="image1">
- <label class="form-check-label" for="image1">
- Image 1
- </label>
- </div>
- <div class="mb-3">
- <input type="submit" class="btn btn-primary" value="Flash!">
- </div>
- <progress id="flash-progress" value="0" max="100"></progress>
- <p id="flash-text-step"></p>
- </form>
- </div>
-</div>
+This procedure flashes the firmware in the stick via serial. You have to get firmware to flash, some are listed on the [Huawei MA5671A page](/ont-huawei-ma5671a).
+{: .text-center .fs-6 }
<button id="flash-start-button" class="btn btn-blue" data-jtd-toogle="modal" data-jtd-target="#flash-modal">Start flash!</button>
-<script type="text/javascript" src="/assets/js/xymini.js"></script>
-<script type="text/javascript" src="/assets/js/rootLantiq.js"></script>
-<script type="text/javascript" src="/assets/js/serialUtil.js"></script>
-<script>
- const acontroller = new AbortController();
- const cs = acontroller.signal;
- let flashModal = document.getElementById("flash-modal");
- let flashForm = document.getElementById("flash-form");
- let flashProgress = document.getElementById("flash-progress");
- let flashTextStep = document.getElementById("flash-text-step");
- flashModal.addEventListener('modal-jtd-close', async function(event) {
- acontroller.abort();
- });
- flashModal.addEventListener('modal-jtd-open', async function(event) {
- flash({signal: cs});
- });
- function initTextStep() {
- flashTextStep.textContent = "";
- flashTextStep.classList.remove('success');
- flashTextStep.classList.remove('error');
- }
- function pause(message) {
- flashTextStep.textContent = message;
- }
- function loading(message) {
- flashTextStep.textContent = message;
- }
- function showError(message) {
- flashTextStep.textContent = message;
- flashTextStep.classList.add('error');
- flashTextStep.classList.remove('success');
- }
- function showSuccess(message) {
- flashTextStep.textContent = message;
- flashTextStep.classList.add('success');
- flashTextStep.classList.remove('error');
- }
- async function flash({ signal } = {}) {
- initTextStep();
- let port;
- try {
- port = await navigator.serial.requestPort();
- } catch (err) {
- showError(`Error: ${err.message}`);
- console.log(`Error: ${err.message}\n`);
- return;
- }
- if (!port) {
- showError('Error: port not open');
- console.log('Error: port not open\n');
- return;
- }
- flashForm.addEventListener('submit', async function(event) {
- [...flashForm.elements].map(function(e){return e.parentNode}).forEach(function(e){e.classList.toggle('was-validated', true)});
- if (!flashForm.checkValidity()) {
- event.preventDefault();
- } else {
- event.preventDefault();
- var fomrdata = new FormData(flashForm);
- var file = fomrdata.get('flash-mtd');
- var image = fomrdata.get('image');
- var data = new Uint8Array(await file.arrayBuffer());
- console.log(data);
+<div id="flash-browser-error" style="display:none">{% include alert.html content="This browser is not compatible with the web-root procedure. See the <a href='https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API#browser_compatibility'>Browser compatibility</a>" alert="Note" icon="svg-warning" color="red" %}</div>
+<noscript>
+{% include alert.html content="Your browser does not support JavaScript!" alert="Note" icon="svg-warning" color="red" %}
+</noscript>
- /* Unlock U-Boot if needed and stop booting */
- let result = await lantiqRootUboot(port, "Huawei MA5671A",
- (msg) => {
- loading(msg);
- console.log(msg);
- },
- (err) => {
- showError(err);
- console.log(err);
- }
- );
-
- if (!result) {
- return;
- }
-
- let baudrate = 115200;
- if(fomrdata.has('baud-rate-oc')) {
- let newBaudrate = 230400;
- loading(`Changing baudrate to: ${newBaudrate}`);
-
- result = await changeBaudrate(port, newBaudrate, baudrate,
- (err) => {
- showError(err);
- console.log(err);
- }
- );
-
- if (result) {
- baudrate = newBaudrate;
- } else {
- return;
- }
- }
-
- loading("Start sending image to the SFP...");
- result = await sendImageMtd(port, data, baudrate,
- (err) => {
- showError(err);
- console.log(err);
- },
- (byteTransfered) => {
- const perc = (byteTransfered/data.length) * 100;
- const percTrunc = Math.trunc(perc*100)/100; /* Two decimal trunc */
- flashProgress.value = perc;
- loading(`Image transfer: ${percTrunc}% complete`)
- }
- );
-
- if (!result) {
- return;
- }
-
- result = await waitEndImageLoad(port, baudrate,
- (err) => {
- showError(err);
- console.log(err);
- }
- );
-
- if (!result) {
- return;
- }
-
- if(fomrdata.has('baud-rate-oc')) {
- let newBaudrate = 115200;
- loading(`Restore baudrate to: ${newBaudrate}`);
-
- result = await changeBaudrate(port, newBaudrate, baudrate,
- (err) => {
- showError(err);
- console.log(err);
- }
- );
-
- if (result) {
- baudrate = newBaudrate;
- } else {
- return;
- }
- }
-
- loading("Transfer complete, image flash in progress. DO NOT REMOVE the SFP!");
- result = await flashImageMtd(port, image, baudrate,
- (err) => {
- showError(err);
- console.log(err);
- }
- );
-
- if (result) {
- showSuccess("Flash completed, now you can remove SFP");
- }
- }
- });
- };
-</script>
+{% include ymodem_lantiq.html modelName="Huawei MA5671A" %}