Hacking Thursday
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # OpenWrt 學習筆記 一名新鮮人與一名過來人的對話交流實錄。 採主題式回合交流編集。 ## 章節 - EP1. 刷機 - EP2. /etc/config 與 UCI - EP3. Web UI -- LuCI - EP4. 橋接、延伸、中繼 ## EP1. 刷機 ## EP2. /etc/config 與 UCI ### 參考連結 - [[OpenWrt Wiki] The UCI system](https://openwrt.org/docs/guide-user/base-system/uci) ## EP3. Web UI -- LuCI ### What is LuCI? * A web user interface * A free, clean, extensible * Uses the Lua programming language * A MVC-Webframework Ref: [LuCI – Technical Reference](https://openwrt.org/docs/techref/luci) ### 參考連結 - [OpenWrt LuCI Wiki](https://github.com/openwrt/luci/wiki) - [openwrt开发使用-增加luci - 良知犹存 - 博客园](https://www.cnblogs.com/conscience-remain/p/16989818.html) ## EP4. 橋接、延伸、中繼 - Bridge, Extender, Repeater - https://openwrt.org/docs/guide-user/network/wifi/wifiextenders/start ## EP5. Porting Morse Micro Module driver to Raspberry Pi 3 ### Prepare #### Hardware - Raspberry Pi 3 Model B+(TODO: 3B+ ?, 型號資訊可參考[這裡](https://en.wikipedia.org/wiki/Raspberry_Pi#Model_comparison)) - Morse Micro Module AHM26108D(TODO: 型號資訊?) - Host PC Ubuntu 20.04 LTS(Build System) #### Software - Raspberry Pi OS - MM6108 Linux Driver Release Package 1.12.4 (TODO: 有 public URL?)沒有 - Pre-install package on the Host PC ##### Pre-install package on the Host PC ``` $ sudo apt-get update $ sudo apt-get install unzip git make g++ gcc flex bison libc6-dev libncurses5-dev libssl-dev bc ``` ### Install Raspberry Pi 3 OS Download Raspberry Pi Imager to install Raspberry Pi OS https://www.raspberrypi.com/software/ 請安裝Raspberry Pi OS (64Bits) ### Building Linux Kernel 6.6 version #### Download Linux Kernel ``` $ git clone --depth=1 --branch rpi-6.6.y https://github.com/raspberrypi/linux.git ``` P.S. `--depth=1` 表示 `git log` 只拉最新一層 commit,不會下載整條 History ,以節省下載時間與容量。 #### Patching Linux Kernel ``` $ unzip "MM6108 Linux Driver Release Package 1.12.4.zip" $ cd "MM6108 Linux Driver Release Package 1.12.4/" $ unzip morsemicro_kernel_patches_rel_1_12_4_2024_Jun_11.zip $ cat morsemicro_kernel_patches_rel_1_12_4_2024_Jun_11/6.6.x/*.patch | patch -g0 -p1 -E -d ~/linux/ ``` NOTE: `patch` 的選項說明: <https://www.gnu.org/software/diffutils/manual/html_node/patch-Options.html> #### Modify Kernel Driver Option ``` $ cd ~/linux/ $ KERNEL=kernel8 $ make ARCH=arm64 bcm2711_defconfig ``` #### Cross-compile the Linux Kernel ##### Install toolchain ``` $ sudo apt install crossbuild-essential-arm64 ``` ##### Building Linux Kernel ``` $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbs ``` #### Compiler Morse Micro Driver ``` $ cd ~/MM6108\ Linux\ Driver\ Release\ Package\ 1.12.4/ $ unzip morsemicro_driver_rel_1_12_4_2024_Jun_11.zip $ cd morsemicro_driver_rel_1_12_4_2024_Jun_11/ $ ... ``` # Queue, TODO (待後置的資料,先暫放此處) ## 2024-10-28 ``` Q: OpenWrt 是不是就是四大主軸,一編譯與刷機,二改硬體資訊如DTS, porting driver,三 OpenWrt 的網路設定(UCI setting),四改Web UI,只要這些都搞懂,是不是也就差不多了? A: 是啊 ``` OpenWrt 四大主軸: - 編譯與刷機 - 硬體參數修改, DTS, Driver Porting - OpenWrt 網路設定, UCI - Web UI ``` 理解一個事物有多個方式。一是從作者本人口述,一是從上而下的閱讀架構說明文件,另一是由下而上的探索式的自適應組織。 大多數的我們,從小接受學校教育,已經習慣以線性教材式的訓練課程來學習。 但面對陌生事物,且還沒有理想指引的環境下,採取探索式會更有效一些。 ``` - 對照 Upstream 的 LuCI source code 作 Trace code 前, 注意要先定位版本對應關係。若版本對應錯置,容易發生"刻舟求劍"、"用明朝的劍斬清朝的官"的窘境。 ## 2024-10-29 ``` 自己是採取 backtrace code 的方式,反向探索 LuCI 的架構。 訣竅門,針對要改的地方,在那裡觸發一次 backtrace 。 就會得到一份 function 樹狀關係圖切片。 從那個切片,就能反解出整個架構的部分情報,而且是直接跟目標相關的情報。 用這個方式,多改幾個地方,多了幾個角度切片,最終能一步步反解拼湊而掌握整體架構。 因此,上述找 button 的特徵,就是對 LuCI 的一次取樣切片。 過程中,可以找到對應的 module 跟檔案位置。 先讀 LuCI 的架構文件,有助於你框出問題的範圍。 但,初入手的人再怎麼縮框,也無法到很精確。 因此,我慣以針對性切片法下手。 ``` - [luci/luci.mk](https://github.com/openwrt/luci/blob/master/luci.mk) - [luci/themes/luci-theme-openwrt-2020/Makefile](https://github.com/openwrt/luci/blob/master/themes/luci-theme-openwrt-2020/Makefile) - [[OpenWrt Wiki] LuCI essentials](https://openwrt.org/docs/guide-user/luci/luci.essentials) - [ath79: add support for ALFA Network WiFi CampPro Nano Duo · openwrt/openwrt@861a9da](https://github.com/openwrt/openwrt/commit/861a9dac68b9427758ed1771dfb533db2a5bb88e)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully