{
 "除錯工具箱與開機失敗診斷#1": {
  "type": "flow",
  "layout": "snake",
  "reveal": [
   0,
   5,
   5
  ],
  "nodes": [
   {
    "label": "Boot ROM",
    "color": 0
   },
   {
    "label": "U-Boot",
    "color": 1
   },
   {
    "label": "Kernel",
    "color": 2
   },
   {
    "label": "init",
    "color": 3
   },
   {
    "label": "應用程式",
    "color": 4
   }
  ]
 },
 "除錯工具箱與開機失敗診斷#4": {
  "type": "table",
  "head": [
   "症狀",
   "往哪裡查"
  ],
  "rows": [
   [
    "畫面完全沒有輸出",
    "電源、接線、SD 卡"
   ],
   [
    "U-Boot 提示後無 kernel 訊息",
    "console 與 DTB"
   ],
   [
    "Bad Linux ARM64 Image magic",
    "映像格式與啟動指令不符"
   ]
  ],
  "widths": [
   3,
   3
  ],
  "reveal": [
   0,
   1,
   2,
   3
  ]
 },
 "除錯工具箱與開機失敗診斷#6": {
  "type": "table",
  "head": [
   "症狀",
   "往哪裡查"
  ],
  "rows": [
   [
    "Attempted to kill init",
    "1 號行程結束了"
   ],
   [
    "登入提示不出現",
    "getty 的設定"
   ],
   [
    "裝置沒有出現",
    "裝置樹和驅動"
   ]
  ],
  "widths": [
   3,
   2
  ],
  "reveal": [
   0,
   1,
   2,
   3
  ]
 },
 "除錯工具箱與開機失敗診斷#7": {
  "type": "table",
  "head": [
   "指令",
   "作用"
  ],
  "rows": [
   [
    "dmesg -w",
    "持續跟隨新訊息"
   ],
   [
    "dmesg --level=err,warn",
    "只看錯誤與警告"
   ],
   [
    "cat /proc/sys/kernel/printk",
    "四個數字:日誌等級設定"
   ],
   [
    "dmesg -n 7",
    "console 等級調到最詳細"
   ]
  ],
  "widths": [
   3,
   3
  ],
  "reveal": [
   2,
   4,
   4
  ]
 },
 "OTA 更新:A/B 分區、回復與安全#2": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5
  ],
  "cards": [
   {
    "title": "原子性",
    "points": [
     "完整成功",
     "或完全沒發生"
    ]
   },
   {
    "title": "可回復",
    "points": [
     "開機失敗",
     "自動回舊版本"
    ]
   },
   {
    "title": "可驗證",
    "points": [
     "更新包要簽章",
     "驗證通過才安裝"
    ]
   },
   {
    "title": "不中斷服務",
    "points": [
     "背景寫入",
     "重開機才切換"
    ]
   },
   {
    "title": "保留資料",
    "points": [
     "使用者資料與設定",
     "更新後仍在"
    ]
   }
  ]
 },
 "OTA 更新:A/B 分區、回復與安全#3": {
  "type": "table",
  "head": [
   "策略",
   "特色"
  ],
  "rows": [
   [
    "A/B 雙分區",
    "slot A 與 B,最可靠,需兩倍空間"
   ],
   [
    "恢復分區",
    "省空間,更新時裝置暫不能用"
   ],
   [
    "差分更新",
    "只傳差異,實作複雜"
   ],
   [
    "容器或 OSTree",
    "檔案或映像層級原子切換"
   ]
  ],
  "widths": [
   2,
   3
  ],
  "reveal": [
   0,
   1,
   1,
   2,
   3,
   4,
   4
  ]
 },
 "OTA 更新:A/B 分區、回復與安全#4": {
  "type": "flow",
  "layout": "row",
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ],
  "nodes": [
   {
    "label": "寫入新 slot",
    "sub": "upgrade_available",
    "color": 0
   },
   {
    "label": "重新開機",
    "sub": "計數加一",
    "color": 1
   },
   {
    "label": "自我檢查",
    "sub": "通過才清除計數",
    "color": 2
   },
   {
    "label": "切回舊 slot",
    "sub": "altbootcmd",
    "color": 3
   }
  ]
 },
 "OTA 更新:A/B 分區、回復與安全#6": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ],
  "cards": [
   {
    "title": "RAUC",
    "points": [
     "簽章的 bundle",
     "支援 A/B",
     "整合 U-Boot、GRUB"
    ]
   },
   {
    "title": "SWUpdate",
    "points": [
     "彈性很大的更新代理",
     "映像、腳本、差分、簽章"
    ]
   },
   {
    "title": "Mender",
    "points": [
     "雲端管理後台",
     "客戶端",
     "整合 Yocto"
    ]
   },
   {
    "title": "OSTree",
    "points": [
     "檔案層級版本化",
     "常見於進階系統"
    ]
   }
  ]
 },
 "最佳化:開機時間與映像大小#1": {
  "type": "cards",
  "reveal": [
   0,
   0,
   1,
   2,
   3,
   4
  ],
  "cards": [
   {
    "title": "序列主控台",
    "points": [
     "看時間戳記",
     "kernel 訊息開頭的數字"
    ]
   },
   {
    "title": "initcall_debug",
    "points": [
     "kernel 命令列加上",
     "dmesg 列出每個初始化函式"
    ]
   },
   {
    "title": "systemd 分析",
    "points": [
     "內建分析工具"
    ]
   },
   {
    "title": "U-Boot bootdelay",
    "points": [
     "設為 0 或 1"
    ]
   }
  ]
 },
 "最佳化:開機時間與映像大小#2": {
  "type": "table",
  "head": [
   "指令",
   "作用"
  ],
  "rows": [
   [
    "dmesg | grep initcall | sort -t= -k2 -n -r | head",
    "依耗時排序,看最前面幾筆"
   ],
   [
    "systemd-analyze",
    "總開機時間,分 kernel 與使用者空間"
   ],
   [
    "systemd-analyze blame",
    "各服務耗時排行"
   ]
  ],
  "widths": [
   4,
   3
  ],
  "reveal": [
   0,
   1,
   2,
   3
  ]
 },
 "最佳化:開機時間與映像大小#4": {
  "type": "cards",
  "reveal": [
   0,
   1,
   1,
   2,
   2
  ],
  "cards": [
   {
    "title": "Bootloader",
    "points": [
     "降低 boot delay",
     "關掉網路、USB 掃描",
     "用較快的儲存裝置"
    ]
   },
   {
    "title": "Kernel",
    "points": [
     "精簡設定",
     "開機參數加 quiet"
    ]
   }
  ]
 },
 "最佳化:開機時間與映像大小#7": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ],
  "cards": [
   {
    "title": "精簡工具",
    "points": [
     "BusyBox 取代 core utils",
     "選較小的 C 函式庫"
    ]
   },
   {
    "title": "去除符號",
    "points": [
     "做 strip",
     "Buildroot 預設會做"
    ]
   },
   {
    "title": "精簡 Kernel",
    "points": [
     "大小優先的最佳化",
     "關掉用不到的子系統"
    ]
   },
   {
    "title": "壓縮檔案系統",
    "points": [
     "SquashFS 搭配 XZ",
     "讀取時要解壓縮"
    ]
   }
  ]
 },
 "課程總整理與下一步#3": {
  "type": "flow",
  "layout": "row",
  "reveal": [
   0,
   0,
   1,
   2
  ],
  "nodes": [
   {
    "label": "① 卡在哪個階段?",
    "sub": "Boot ROM、U-Boot、kernel、init、應用程式",
    "color": 0
   },
   {
    "label": "② 輸入是什麼?",
    "sub": "映像檔、DTB、開機參數、rootfs",
    "color": 1
   }
  ]
 },
 "課程總整理與下一步#4": {
  "type": "flow",
  "layout": "row",
  "reveal": [
   0,
   1,
   2
  ],
  "nodes": [
   {
    "label": "③ 輸出在哪看?",
    "sub": "序列埠、dmesg、日誌、GDB",
    "color": 2
   },
   {
    "label": "④ 昨天改了什麼?",
    "sub": "一次只改一件事",
    "color": 3
   }
  ]
 },
 "課程總整理與下一步#5": {
  "type": "cards",
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ],
  "cards": [
   {
    "title": "專案 A",
    "points": [
     "QEMU 上用 Buildroot",
     "加入自己的 C 程式"
    ]
   },
   {
    "title": "專案 B",
    "points": [
     "Raspberry Pi",
     "libgpiod 與 I2C 感測器"
    ]
   },
   {
    "title": "專案 C",
    "points": [
     "Yocto 自建 layer",
     "加入 RAUC 做 A/B"
    ]
   },
   {
    "title": "專案 D",
    "points": [
     "為虛構板子寫裝置樹",
     "驗證 gpio-leds"
    ]
   }
  ]
 }
}