Repository navigation
Expand file tree
/
Copy pathbootloader.html
More file actions
609 lines (574 loc) · 21.9 KB
/
Copy pathbootloader.html
File metadata and controls
609 lines (574 loc) · 21.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OWDOS Bootloader</title>
<link rel="stylesheet" href="OWDOS.css">
<style>
* { margin:0; padding:0; box-sizing:border-box; }
html, body {
width:100%; height:100%; overflow:hidden;
background: #000;
font-family: var(--font-mono);
}
/* ── BOOT SCREENS ── */
.boot-screen { display:none; position:absolute; inset:0; }
.boot-screen.active { display:flex; }
/* ── FIRMWARE SPLASH ── */
#screen-fw {
background:#000;
flex-direction:column;
align-items:center;
justify-content:center;
}
.fw-logo {
display:flex; flex-direction:column; align-items:center; gap:16px;
opacity:0; animation: fadeIn 0.6s 0.3s ease forwards;
}
.fw-logo-icon { font-size:72px; }
.fw-model { font-size:18px; color:#aaa; font-family:var(--font-ui); font-weight:300; }
.fw-version { font-size:11px; color:#444; font-family:var(--font-mono); margin-top:4px; }
@keyframes fadeIn { to { opacity:1; } }
.fw-progress {
position:absolute; bottom:60px; left:50%; transform:translateX(-50%);
width:200px;
}
.fw-progress-bar {
height:2px; background:#222; border-radius:1px; overflow:hidden;
}
.fw-progress-fill {
height:100%; background:#fff; border-radius:1px; width:0%;
transition: width 0.3s ease;
}
.fw-progress-pct { font-size:10px; color:#444; text-align:center; margin-top:6px; }
/* ── VERIFIED BOOT (normal mode) ── */
#screen-verified {
background:#000;
flex-direction:column;
align-items:center;
justify-content:center;
gap:0;
}
.vb-logo { opacity:0; animation: fadeIn 0.5s 0.2s ease forwards; margin-bottom:32px; }
.vb-status-line {
font-size:11px; color:#333; font-family:var(--font-mono);
opacity:0; animation: fadeIn 0.3s ease forwards;
}
.vb-status-line.visible { opacity:1; }
/* ── DEVELOPER MODE BOOT ── */
#screen-devboot {
background:#000;
flex-direction:column;
align-items:center;
justify-content:center;
}
.devboot-wrap {
text-align:center;
max-width:520px;
}
.devboot-icon { font-size:64px; margin-bottom:20px; }
.devboot-title {
font-size:22px; color:#fff;
font-family:var(--font-ui); font-weight:400;
margin-bottom:12px;
}
.devboot-body {
font-size:13px; color:#888; line-height:1.8;
font-family:var(--font-ui);
margin-bottom:24px;
}
.devboot-countdown {
font-size:14px; color:#f9ab00;
font-family:var(--font-ui);
margin-bottom:20px;
}
.devboot-keys { display:flex; flex-direction:column; gap:8px; align-items:center; }
.devboot-key-row { display:flex; align-items:center; gap:8px; font-size:12px; color:#666; font-family:var(--font-ui); }
.boot-key {
display:inline-flex; align-items:center; justify-content:center;
min-width:34px; height:28px; padding:0 8px;
background:#1a1a1a; border:1px solid #333; border-radius:5px;
font-size:12px; color:#bbb; font-family:var(--font-mono);
}
.devboot-bar-wrap { margin-top:24px; width:300px; }
.devboot-bar { height:3px; background:#222; border-radius:2px; overflow:hidden; }
.devboot-bar-fill {
height:100%; background:#f9ab00; border-radius:2px;
width:100%;
transition: width 1s linear;
}
/* ── OS LOADING ── */
#screen-loading {
background:#000;
flex-direction:column;
align-items:center;
justify-content:center;
gap:20px;
}
.loading-logo { opacity:0; animation: fadeIn 0.5s 0.1s ease forwards; }
.loading-spinner {
width:32px; height:32px;
border:2.5px solid rgba(255,255,255,0.1);
border-top-color: rgba(255,255,255,0.7);
border-radius:50%;
animation: spin 0.9s linear infinite;
}
.loading-status { font-size:11px; color:#444; font-family:var(--font-mono); }
@keyframes spin { to { transform:rotate(360deg); } }
/* ── SERIAL CONSOLE (Ctrl+Alt+T style) ── */
#screen-console {
background:#000;
flex-direction:column;
padding:16px 20px;
font-size:12px; color:#33ff33;
overflow-y:auto;
}
.console-line { white-space:pre-wrap; line-height:1.6; }
.console-line.dim { color:#1a6e1a; }
.console-line.warn { color:#f9ab00; }
.console-line.err { color:#ff4444; }
.console-line.blue { color:#4285f4; }
/* ── BOOTSCREEN SELECTOR (dev mode) ── */
#screen-bootmenu {
background:#111;
flex-direction:column;
align-items:center;
justify-content:center;
gap:20px;
}
.bootmenu-title { font-size:18px; color:#fff; font-family:var(--font-ui); }
.bootmenu-subtitle { font-size:12px; color:#666; font-family:var(--font-ui); }
.bootmenu-items { display:flex; flex-direction:column; gap:8px; width:320px; }
.bootmenu-item {
display:flex; align-items:center; gap:14px;
padding:14px 18px; border-radius:8px;
background:#1a1a1a; border:1.5px solid #2a2a2a;
cursor:pointer; font-family:var(--font-ui);
transition:background 0.15s, border-color 0.15s;
}
.bootmenu-item:hover { background:#222; border-color:#444; }
.bootmenu-item.selected { border-color:#4285f4; background:#0a1a2e; }
.bootmenu-item-icon { font-size:24px; }
.bootmenu-item-name { font-size:14px; color:#fff; font-weight:500; }
.bootmenu-item-desc { font-size:11px; color:#666; margin-top:2px; }
/* Toast */
#toast {
position:fixed; bottom:20px; left:50%; transform:translateX(-50%) translateY(10px);
background:rgba(255,255,255,0.1); backdrop-filter:blur(8px);
color:#fff; padding:8px 18px; border-radius:22px;
font-size:13px; pointer-events:none; opacity:0;
transition:opacity 0.2s, transform 0.2s; z-index:9999;
font-family:var(--font-ui); white-space:nowrap;
}
#toast.show { opacity:1; transform:translateX(-50%) translateY(0); }
/* Key hint bar */
#boot-hint {
position:fixed; bottom:16px; right:20px;
font-size:10px; color:#333; font-family:var(--font-mono);
z-index:100; text-align:right; line-height:1.8;
}
</style>
</head>
<body><script src="system.js"></script>
<!-- ══ FIRMWARE SPLASH ══ -->
<div class="boot-screen active" id="screen-fw">
<div class="fw-logo">
<svg width="80" height="80" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="50" fill="#4285f4"/>
<circle cx="50" cy="50" r="22" fill="#fff"/>
<path d="M50 0 A50 50 0 0 1 93.3 25 L72 37 A28 28 0 0 0 50 22Z" fill="#ea4335"/>
<path d="M93.3 25 A50 50 0 0 1 93.3 75 L72 63 A28 28 0 0 0 72 37Z" fill="#fbbc05"/>
<path d="M93.3 75 A50 50 0 0 1 6.7 75 L28 63 A28 28 0 0 0 72 63Z" fill="#34a853"/>
</svg>
<div class="fw-model">OWDOS</div>
<div class="fw-version">OWDOS-FW.1.0.0 · OWBoot 1.0</div>
</div>
<div class="fw-progress">
<div class="fw-progress-bar"><div class="fw-progress-fill" id="fw-fill"></div></div>
<div class="fw-progress-pct" id="fw-pct">Initializing firmware...</div>
</div>
</div>
<!-- ══ VERIFIED BOOT STATUS ══ -->
<div class="boot-screen" id="screen-verified">
<svg class="vb-logo" width="72" height="72" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="50" fill="#4285f4"/>
<circle cx="50" cy="50" r="22" fill="#fff"/>
<path d="M50 0 A50 50 0 0 1 93.3 25 L72 37 A28 28 0 0 0 50 22Z" fill="#ea4335"/>
<path d="M93.3 25 A50 50 0 0 1 93.3 75 L72 63 A28 28 0 0 0 72 37Z" fill="#fbbc05"/>
<path d="M93.3 75 A50 50 0 0 1 6.7 75 L28 63 A28 28 0 0 0 72 63Z" fill="#34a853"/>
</svg>
<div id="vb-log" style="font-size:10px;color:#1a3a1a;font-family:var(--font-mono);text-align:left;max-width:600px;"></div>
</div>
<!-- ══ DEVELOPER MODE WARNING ══ -->
<div class="boot-screen" id="screen-devboot">
<div class="devboot-wrap">
<div class="devboot-icon">⚠️</div>
<div class="devboot-title">OS verification is OFF</div>
<div class="devboot-body">
Your OWDOS device is running in developer mode.<br>
Boot verification has been disabled. This OWDOS device will<br>
boot to OWDOS in <span id="devboot-sec">30</span> seconds.
</div>
<div class="devboot-keys">
<div class="devboot-key-row">
<span class="boot-key">Space</span> — Cancel developer mode (Powerwash)
</div>
<div class="devboot-key-row">
<span class="boot-key">Ctrl</span>+<span class="boot-key">D</span> — Boot OWDOS (skip timer)
</div>
<div class="devboot-key-row">
<span class="boot-key">Ctrl</span>+<span class="boot-key">U</span> — Boot from USB
</div>
<div class="devboot-key-row">
<span class="boot-key">Ctrl</span>+<span class="boot-key">L</span> — Boot legacy BIOS
</div>
</div>
<div class="devboot-bar-wrap">
<div class="devboot-bar"><div class="devboot-bar-fill" id="devboot-fill"></div></div>
</div>
</div>
</div>
<!-- ══ DEVELOPER BOOT MENU ══ -->
<div class="boot-screen" id="screen-bootmenu">
<div class="bootmenu-title">Select boot target</div>
<div class="bootmenu-subtitle">Use arrow keys and Enter, or click to select</div>
<div class="bootmenu-items">
<div class="bootmenu-item selected" id="bmenu-cros" onclick="selectBootItem(this,'OWDOS')">
<div class="bootmenu-item-icon">🌐</div>
<div>
<div class="bootmenu-item-name">OWDOS</div>
<div class="bootmenu-item-desc">Internal disk · /dev/nvme0n1p3</div>
</div>
</div>
<div class="bootmenu-item" id="bmenu-usb" onclick="selectBootItem(this,'USB')">
<div class="bootmenu-item-icon">💿</div>
<div>
<div class="bootmenu-item-name">USB / SD Card</div>
<div class="bootmenu-item-desc">No bootable device detected</div>
</div>
</div>
<div class="bootmenu-item" id="bmenu-legacy" onclick="selectBootItem(this,'Legacy')">
<div class="bootmenu-item-icon">🖥️</div>
<div>
<div class="bootmenu-item-name">Legacy BIOS</div>
<div class="bootmenu-item-desc">SeaBIOS · requires RW_LEGACY firmware</div>
</div>
</div>
</div>
<div style="margin-top:16px">
<button style="padding:8px 24px;background:#4285f4;color:#fff;border:none;border-radius:4px;
font-family:var(--font-ui);font-size:14px;cursor:pointer" onclick="bootSelected()">Boot</button>
</div>
</div>
<!-- ══ OS LOADING ══ -->
<div class="boot-screen" id="screen-loading">
<svg class="loading-logo" width="56" height="56" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="50" fill="#4285f4"/>
<circle cx="50" cy="50" r="22" fill="#fff"/>
<path d="M50 0 A50 50 0 0 1 93.3 25 L72 37 A28 28 0 0 0 50 22Z" fill="#ea4335"/>
<path d="M93.3 25 A50 50 0 0 1 93.3 75 L72 63 A28 28 0 0 0 72 63Z" fill="#34a853"/>
</svg>
<div class="loading-spinner"></div>
<div class="loading-status" id="loading-status">Starting OWDOS...</div>
</div>
<!-- ══ SERIAL CONSOLE ══ -->
<div class="boot-screen" id="screen-console">
<div id="console-out"></div>
</div>
<!-- Hint bar -->
<div id="boot-hint" id="boot-hint-bar">
Ctrl+Alt+T — console<br>
Ctrl+Alt+F2 — TTY2
</div>
<!-- Toast -->
<div id="toast"></div>
<script>
// ── STATE ────────────────────────────────────────────────────────
const params = new URLSearchParams(window.location.search);
const devMode = params.get('devmode') === '1';
let devbootTimer, devbootSecs = 30;
let selectedBoot = 'OWDOS';
let toastTimer;
// ── TOAST ────────────────────────────────────────────────────────
function showToast(msg) {
const t = document.getElementById('toast');
t.textContent = msg; t.classList.add('show');
clearTimeout(toastTimer);
toastTimer = setTimeout(() => t.classList.remove('show'), 2200);
}
// ── SCREEN SWITCHER ──────────────────────────────────────────────
function showScreen(id) {
document.querySelectorAll('.boot-screen').forEach(s => s.classList.remove('active'));
const el = document.getElementById(id);
if (el) el.classList.add('active');
}
// ── FIRMWARE BOOT SEQUENCE ───────────────────────────────────────
function startFirmwareBoot() {
const fill = document.getElementById('fw-fill');
const pct = document.getElementById('fw-pct');
const steps = [
[10, 'Initializing firmware...'],
[25, 'POST: Memory check...'],
[40, 'Loading EC firmware...'],
[55, 'Initializing TPM...'],
[70, 'Loading verified boot...'],
[85, 'Checking boot mode...'],
[100, devMode ? 'Developer mode detected.' : 'Verified boot OK.'],
];
let si = 0;
const go = () => {
if (si >= steps.length) {
setTimeout(() => {
if (devMode) {
showScreen('screen-devboot');
startDevbootCountdown();
} else {
showScreen('screen-verified');
startVerifiedBoot();
}
}, 400);
return;
}
const [p, msg] = steps[si++];
if (fill) fill.style.width = p + '%';
if (pct) pct.textContent = msg;
setTimeout(go, 300);
};
setTimeout(go, 200);
}
// ── VERIFIED BOOT LOG ────────────────────────────────────────────
function startVerifiedBoot() {
const log = document.getElementById('vb-log');
const lines = [
'Loading kernel from partition 2...',
'Verifying kernel signature (RSA8192 SHA512)...',
'Kernel signature OK.',
'Loading rootfs from partition 3...',
'Verifying rootfs hash (SHA256)...',
'Rootfs hash OK.',
'dm-verity: starting verification...',
'dm-verity: hash verified.',
'TPM PCR[0]: 0x000000000000000000000000',
'TPM PCR[1]: 0xa44f0f5a2a8e5e3b2c5d6e7f',
'TPM extend complete.',
'Handing off to kernel...',
];
let i = 0;
const tick = () => {
if (i >= lines.length) {
setTimeout(() => {
showScreen('screen-loading');
startOSLoad();
}, 300);
return;
}
const d = document.createElement('div');
d.className = 'vb-status-line visible';
d.textContent = lines[i++];
log.appendChild(d);
setTimeout(tick, 120);
};
tick();
}
// ── OS LOAD ──────────────────────────────────────────────────────
function startOSLoad() {
const status = document.getElementById('loading-status');
const stages = [
'Starting OWDOS...',
'Mounting filesystems...',
'Starting services...',
'Starting session_manager...',
'Starting login screen...',
];
let i = 0;
const tick = () => {
if (i >= stages.length) {
setTimeout(() => { window.location.href = 'oobe.html'; }, 500);
return;
}
if (status) status.textContent = stages[i++];
setTimeout(tick, 600);
};
tick();
}
// ── DEVBOOT COUNTDOWN ────────────────────────────────────────────
function startDevbootCountdown() {
devbootSecs = 30;
const secEl = document.getElementById('devboot-sec');
const fill = document.getElementById('devboot-fill');
clearInterval(devbootTimer);
devbootTimer = setInterval(() => {
devbootSecs--;
if (secEl) secEl.textContent = devbootSecs;
if (fill) fill.style.width = (devbootSecs / 30 * 100) + '%';
if (devbootSecs <= 0) {
clearInterval(devbootTimer);
bootOWDOS();
}
}, 1000);
}
function bootOWDOS() {
clearInterval(devbootTimer);
showScreen('screen-loading');
startOSLoad();
}
// ── BOOT MENU ────────────────────────────────────────────────────
function selectBootItem(el, name) {
document.querySelectorAll('.bootmenu-item').forEach(x => x.classList.remove('selected'));
el.classList.add('selected');
selectedBoot = name;
}
function bootSelected() {
if (selectedBoot === 'OWDOS') {
showScreen('screen-loading');
startOSLoad();
} else if (selectedBoot === 'USB') {
showToast('No bootable USB detected.');
} else if (selectedBoot === 'Legacy') {
showScreen('screen-console');
startLegacyBoot();
}
}
// ── LEGACY BOOT (SeaBIOS) ────────────────────────────────────────
function startLegacyBoot() {
const out = document.getElementById('console-out');
if (!out) return;
const lines = [
{ text:'SeaBIOS (version rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org)', cls:'' },
{ text:'Machine UUID ... 4f534336-4f43-4445-4244-4f4152445f49', cls:'dim' },
{ text:'', cls:'' },
{ text:'iPXE (http://ipxe.org) 00:02.0 C980 PCI2.10 PnP PMM+B7F9A9A0+B7EDA9A0 C980', cls:'dim' },
{ text:'', cls:'' },
{ text:'Booting from Hard Disk...', cls:'blue' },
{ text:'GRUB 2.06 loading...', cls:'' },
{ text:'', cls:'' },
{ text:'No bootable OS found on legacy BIOS path.', cls:'err' },
{ text:'Returning to OWDOS...', cls:'warn' },
];
let i = 0;
const tick = () => {
if (i >= lines.length) {
setTimeout(() => { showScreen('screen-devboot'); startDevbootCountdown(); }, 1500);
return;
}
const d = document.createElement('div');
d.className = 'console-line' + (lines[i].cls ? ' ' + lines[i].cls : '');
d.textContent = lines[i++].text;
out.appendChild(d);
setTimeout(tick, 160);
};
tick();
}
// ── SERIAL CONSOLE (Ctrl+Alt+T) ──────────────────────────────────
function showConsole() {
showScreen('screen-console');
const out = document.getElementById('console-out');
if (!out || out.children.length) return;
const d = document.createElement('div');
d.className = 'console-line';
d.textContent = 'Entering VT-2 console. Type "exit" to return to boot.';
out.appendChild(d);
const inpLine = document.createElement('div');
inpLine.className = 'console-line';
inpLine.innerHTML = '# ';
const inp = document.createElement('input');
inp.style.cssText = 'background:transparent;border:none;outline:none;color:#33ff33;font-family:var(--font-mono);font-size:12px;caret-color:#33ff33;width:400px;';
inp.onkeydown = consoleKey;
inpLine.appendChild(inp);
out.appendChild(inpLine);
setTimeout(() => inp.focus(), 50);
}
function consoleKey(e) {
if (e.key === 'Enter') {
const cmd = e.target.value.trim();
e.target.value = '';
const out = document.getElementById('console-out');
const r = document.createElement('div');
r.className = 'console-line';
r.textContent = '# ' + cmd;
out.insertBefore(r, e.target.parentNode);
if (cmd === 'exit') { showScreen(devMode ? 'screen-devboot' : 'screen-loading'); return; }
if (cmd) {
const resp = document.createElement('div');
resp.className = 'console-line dim';
resp.textContent = execConsoleCmd(cmd);
out.insertBefore(resp, e.target.parentNode);
}
}
}
function execConsoleCmd(cmd) {
const map = {
'help': 'exit crossystem dmesg mosys reboot poweroff',
'crossystem':'cros_debug=1\nmainfw_type=developer\ndevsw_boot=1\ntpm_kernver=5',
'dmesg': '[ 0.000000] Booting paravirtualized kernel\n[ 1.024018] EXT4-fs mounted\n[ 3.001442] cros-ec-keyb ready',
'reboot': 'Rebooting...',
'poweroff': 'Powering off...',
'mosys': 'platform: name="Hatch"\nboard: vendor="Google" name="Hatch" version="rev4"',
'uname -a': 'Linux localhost 6.1.78 #1 SMP PREEMPT_DYNAMIC x86_64 GNU/Linux',
};
return map[cmd] || `bash: ${cmd}: command not found`;
}
// ── KEYBOARD SHORTCUTS ────────────────────────────────────────────
document.addEventListener('keydown', e => {
const ctrl = e.ctrlKey, alt = e.altKey, shift = e.shiftKey;
const active = document.querySelector('.boot-screen.active');
const id = active ? active.id : '';
// Ctrl+D on devboot → skip countdown
if (ctrl && e.key === 'd' && id === 'screen-devboot') {
e.preventDefault(); clearInterval(devbootTimer);
bootOWDOS(); return;
}
// Ctrl+U → USB boot
if (ctrl && e.key === 'u' && id === 'screen-devboot') {
e.preventDefault();
showScreen('screen-bootmenu'); return;
}
// Ctrl+L → legacy
if (ctrl && e.key === 'l' && id === 'screen-devboot') {
e.preventDefault();
showScreen('screen-console'); startLegacyBoot(); return;
}
// Space → disable devmode (powerwash)
if (e.key === ' ' && id === 'screen-devboot') {
e.preventDefault(); clearInterval(devbootTimer);
showToast('Disabling developer mode — Powerwashing...');
setTimeout(() => { window.location.href = 'oobe.html'; }, 2000); return;
}
// Ctrl+Alt+T → console
if (ctrl && alt && e.key === 't') {
e.preventDefault(); showConsole(); return;
}
// Ctrl+Alt+F2 → TTY2
if (ctrl && alt && e.key === 'F2') {
e.preventDefault(); showConsole(); return;
}
// Esc → back to main / devboot
if (e.key === 'Escape') {
if (id === 'screen-console' || id === 'screen-bootmenu') {
if (devMode) { showScreen('screen-devboot'); startDevbootCountdown(); }
else { showScreen('screen-loading'); startOSLoad(); }
}
}
// Arrow keys on boot menu
if (id === 'screen-bootmenu') {
const items = ['bmenu-cros','bmenu-usb','bmenu-legacy'];
const cur = items.findIndex(x => document.getElementById(x)?.classList.contains('selected'));
if (e.key === 'ArrowDown') {
e.preventDefault();
const next = items[(cur + 1) % items.length];
selectBootItem(document.getElementById(next), ['OWDOS','USB','Legacy'][(cur+1)%3]);
}
if (e.key === 'ArrowUp') {
e.preventDefault();
const prev = items[(cur - 1 + items.length) % items.length];
selectBootItem(document.getElementById(prev), ['OWDOS','USB','Legacy'][(cur-1+3)%3]);
}
if (e.key === 'Enter') bootSelected();
}
});
// ── INIT ─────────────────────────────────────────────────────────
startFirmwareBoot();
</script>
</body>
</html>