Skip to content

Instantly share code, notes, and snippets.

@HeavyDC
Forked from luzhuomi/pocketchip_debian10.md
Created February 17, 2021 15:04
Show Gist options
  • Select an option

  • Save HeavyDC/a3945d8cf00e8ce630c84204107f3faa to your computer and use it in GitHub Desktop.

Select an option

Save HeavyDC/a3945d8cf00e8ce630c84204107f3faa to your computer and use it in GitHub Desktop.

Revisions

  1. @luzhuomi luzhuomi revised this gist Jan 26, 2021. 1 changed file with 22 additions and 1 deletion.
    23 changes: 22 additions & 1 deletion pocketchip_debian10.md
    Original file line number Diff line number Diff line change
    @@ -214,8 +214,29 @@ EndSection
    ```

    ## Fixing the issue with pressing the home button causing chip to shutdown

    Thanks to https://www.reddit.com/user/pernig_/ awesome finding

    1. Edit this file `/etc/systemd/logind.conf` and change the following line

    ```
    #HandlePowerKey=poweroff
    ```
    to
    ```
    HandlePowerKey=ignore
    ```
    2. Save the file and run the following in the terminal as root

    ```bash
    $ systemctl kill -s HUP systemd-logind
    ```


    ## Reference
    Most of the steps in this tutorial were inspired/modified from the following references.
    1. https://github.com/Thore-Krug/Flash-CHIP
    2. https://yoursunny.com/t/2019/bye-CHIP/
    3. http://maba.dk/index.php/demo/pocketchip/
    3. http://maba.dk/index.php/demo/pocketchip/
    4. https://www.reddit.com/r/ChipCommunity/comments/l3xli8/upgraded_my_pocketchip_to_debian_10/
  2. @luzhuomi luzhuomi revised this gist Jan 25, 2021. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions pocketchip_debian10.md
    Original file line number Diff line number Diff line change
    @@ -199,7 +199,7 @@ Section "Device"
    Driver "fbdev"
    EndSection
    ```
    5. (Optional) install lightdm and i3 by following this [link](https://www.reddit.com/r/ChipCommunity/comments/abndo9/an_updated_guide_for_installing_i3_window_manager/)
    5. (Optional) install lightdm and i3 by following this link https://www.reddit.com/r/ChipCommunity/comments/abndo9/an_updated_guide_for_installing_i3_window_manager/

    6. Reboot. If your touch screen cursor movement is reversed, append the following to either `/etc/X11/xorg.conf` or `/usr/share/X11/xorg.conf.d/99-calibration.conf`

    @@ -216,6 +216,6 @@ EndSection

    ## Reference
    Most of the steps in this tutorial were inspired/modified from the following references.
    (https://github.com/Thore-Krug/Flash-CHIP)
    (https://yoursunny.com/t/2019/bye-CHIP/)
    (http://maba.dk/index.php/demo/pocketchip/)
    1. https://github.com/Thore-Krug/Flash-CHIP
    2. https://yoursunny.com/t/2019/bye-CHIP/
    3. http://maba.dk/index.php/demo/pocketchip/
  3. @luzhuomi luzhuomi revised this gist Jan 25, 2021. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions pocketchip_debian10.md
    Original file line number Diff line number Diff line change
    @@ -216,6 +216,6 @@ EndSection

    ## Reference
    Most of the steps in this tutorial were inspired/modified from the following references.
    ![](https://github.com/Thore-Krug/Flash-CHIP Ref1)
    ![](https://yoursunny.com/t/2019/bye-CHIP/ Ref2)
    ![](http://maba.dk/index.php/demo/pocketchip/ Ref3)
    (https://github.com/Thore-Krug/Flash-CHIP)
    (https://yoursunny.com/t/2019/bye-CHIP/)
    (http://maba.dk/index.php/demo/pocketchip/)
  4. @luzhuomi luzhuomi revised this gist Jan 25, 2021. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions pocketchip_debian10.md
    Original file line number Diff line number Diff line change
    @@ -216,6 +216,6 @@ EndSection

    ## Reference
    Most of the steps in this tutorial were inspired/modified from the following references.
    ![1](https://github.com/Thore-Krug/Flash-CHIP)
    ![2](https://yoursunny.com/t/2019/bye-CHIP/)
    ![3](http://maba.dk/index.php/demo/pocketchip/)
    ![](https://github.com/Thore-Krug/Flash-CHIP Ref1)
    ![](https://yoursunny.com/t/2019/bye-CHIP/ Ref2)
    ![](http://maba.dk/index.php/demo/pocketchip/ Ref3)
  5. @luzhuomi luzhuomi revised this gist Jan 25, 2021. 1 changed file with 4 additions and 5 deletions.
    9 changes: 4 additions & 5 deletions pocketchip_debian10.md
    Original file line number Diff line number Diff line change
    @@ -199,8 +199,7 @@ Section "Device"
    Driver "fbdev"
    EndSection
    ```
    5. (Optional) install lightdm and i3 by following this
    ![](https://www.reddit.com/r/ChipCommunity/comments/abndo9/an_updated_guide_for_installing_i3_window_manager/)
    5. (Optional) install lightdm and i3 by following this [link](https://www.reddit.com/r/ChipCommunity/comments/abndo9/an_updated_guide_for_installing_i3_window_manager/)

    6. Reboot. If your touch screen cursor movement is reversed, append the following to either `/etc/X11/xorg.conf` or `/usr/share/X11/xorg.conf.d/99-calibration.conf`

    @@ -217,6 +216,6 @@ EndSection

    ## Reference
    Most of the steps in this tutorial were inspired/modified from the following references.
    ![](https://github.com/Thore-Krug/Flash-CHIP)
    ![](https://yoursunny.com/t/2019/bye-CHIP/)
    ![](http://maba.dk/index.php/demo/pocketchip/)
    ![1](https://github.com/Thore-Krug/Flash-CHIP)
    ![2](https://yoursunny.com/t/2019/bye-CHIP/)
    ![3](http://maba.dk/index.php/demo/pocketchip/)
  6. @luzhuomi luzhuomi created this gist Jan 25, 2021.
    222 changes: 222 additions & 0 deletions pocketchip_debian10.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,222 @@
    # Pocket Chip Debian 10 Upgrade Guide

    The purpose of this tutorial is to walk through the required steps to upgrade NXT chip (or pocketchip) from debian jessie to debian buster.

    If you would like to start your Chip from scratch, follow the steps in the Preparation section.

    ## Preparation (Optional)

    A linux host machine, recommended Ubuntu 18.04. However I managed to do it with 20.10 with some tweak.

    1. Remove the C.H.I.P from its case (in case you have a Pocket C.H.I.P).
    2. Connect the FEL and a GROUND pin of the C.H.I.P (for example, with a paperclip).
    3. Connect the C.H.I.P its micro USB port to a USB port of your Linux machine.
    4. In the Linux machine:
    - run ` git clone https://github.com/thore-krug/Flash-CHIP.git` to clone this repository.
    - `cd` into the location where you stored this repository.
    - run `sudo chmod +x Flash.sh`
    - run `./Flash.sh`
    - Select the version you want to install.
    - Wait until the installation finishes.
    - Restart the Chip
    5. Connect to your chip using USB network or ssh over wifi. For USB network, run `screen /dev/ttyACM0`
    For Wifi ssh, run `ssh chip@<ip_address_of_chip>`
    6. Your chip is running Debian Jessie now.
    7. Update the apt source file. Replace all `jessie` with `stretch` in `/etc/apt/source.list`. Comment away or remove the following

    ```
    # deb http://http.debian.net/debian jessie-backports main contrib non-free
    # deb-src http://http.debian.net/debian jessie-backports main contrib non-free
    # deb http://opensource.nextthing.co/chip/debian/repo jessie main
    ```
    and add

    ```
    deb http://chip.jfpossibilities.com/chip/debian/repo jessie main
    deb http://chip.jfpossibilities.com/chip/debian/pocketchip jessie main
    ```
    After the modification, your `/etc/apt/source.list` should look something like

    ```
    deb http://ftp.us.debian.org/debian/ jessie main contrib non-free
    deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free
    deb http://security.debian.org/ jessie/updates main contrib non-free
    deb-src http://security.debian.org/ jessie/updates main contrib non-free
    deb http://chip.jfpossibilities.com/chip/debian/repo jessie main
    deb http://chip.jfpossibilities.com/chip/debian/pocketchip jessie main
    ```

    8. `sudo apt update && sudo apt upgrade`

    Note I started with the headless server version and manually install lightdm and i3wm after the upgrade. Your experience might defer if you use other images.

    ### Trouble-shooting

    1. If you are stuck at `waiting for FEL...`, try to run the script without plugin the chip to the USB port of the host machine.
    Instead, you start the script `./Flash.sh` and proceed until you see the prompt `waiting for FEL...`, then plug in the chip.
    2. If you are stuck at `flash usb_bulk_send() ERROR -7: Operation timed out`, your host machine is probably running a latest version of the sunix tool. Try to downgrade it by download the deb file from
    `sunxi-tools_1.4.1-1_amd64.deb` from `https://ubuntu.pkgs.org/18.04/ubuntu-universe-amd64/sunxi-tools_1.4.1-1_amd64.deb.html`. Then overwrite the existing installation with
    ```bash
    $ sudo dpkg -i sunxi-tools_1.4.1-1_amd64.deb
    ```
    And edit the `Flash.sh` file to comment away the following lines.

    ```bash
    # sunxi-tools \
    ```


    ## Upgrade From Jessie to Stretch

    1. Login to your chip.
    2. Update the apt source file. Replace all `jessie` with `stretch` in `/etc/apt/source.list`. Comment away or remove to the two lines
    ```
    # deb http://chip.jfpossibilities.com/chip/debian/repo jessie main
    # deb http://chip.jfpossibilities.com/chip/debian/pocketchip jessie main
    ```
    After the modification, `/etc/apt/source.list` file should be like the following

    ```
    deb http://ftp.us.debian.org/debian/ stretch main contrib non-free
    deb-src http://ftp.us.debian.org/debian/ stretch main contrib non-free
    deb http://security.debian.org/ stretch/updates main contrib non-free
    deb-src http://security.debian.org/ stretch/updates main contrib non-free
    ```

    3. `sudo apt update && sudo apt full-upgrade`
    4. Modify the file ` /etc/NetworkManager/NetworkManager.conf` to the following
    ```
    [main]
    plugins=ifupdown,keyfile
    [connection]
    wifi.mac-address-randomization=1
    [device]
    wifi.scan-rand-mac-address=no
    [ifupdown]
    managed=false
    [keyfile]
    unmanaged-devices=interface-name:wlan1
    ```

    5. If you have X running, modify the file ` /etc/X11/xorg.conf` to the following

    ```
    Section "Files"
    ModulePath "/usr/lib/arm-linux-gnueabihf/xorg/modules/"
    ModulePath "/usr/lib/xorg/modules/"
    EndSection
    Section "Monitor"
    Identifier "VGA"
    Option "PreferredMode" "1024x768_60.00"
    EndSection
    Section "Monitor"
    Identifier "HDMI"
    Option "PreferredMode" "1280x720_60.00"
    EndSection
    Section "Monitor"
    Identifier "Composite"
    Option "PreferredMode" "NTSC10"
    EndSection
    Section "Device"
    Identifier "Allwinner sun4i DRM"
    Driver "armsoc"
    Option "Monitor-Composite-0" "Composite"
    Option "Monitor-VGA-0" "VGA"
    Option "Monitor-HDMI-A-0" "HDMI"
    EndSection
    Section "Screen"
    Identifier "Screen0"
    Device "Card0"
    EndSection
    Section "Device"
    Identifier "Card0"
    Driver "modesetting"
    EndSection
    ```
    5. Restart your chip and it should be in Stretch now.

    ## Stretch to Buster

    1. Login to your chip
    2. Update `/etc/apt/source.list` to the following
    ```
    deb http://deb.debian.org/debian/ buster main contrib non-free
    #deb-src http://deb.debian.org/debian/ buster main contrib non-free
    #deb http://security.debian.org/ buster/updates main contrib non-free
    #deb-src http://security.debian.org/ buster/updates main contrib non-free
    #deb http://deb.debian.org/debian buster-backports main contrib non-free
    #deb-src http://deb.debian.org/debian buster-backports main contrib non-free
    ```
    3. `sudo apt update && sudo apt full-upgrade`
    4. Update ` /etc/X11/xorg.conf` to the following

    ```
    Section "Files"
    ModulePath "/usr/lib/arm-linux-gnueabihf/xorg/modules/"
    ModulePath "/usr/lib/xorg/modules/"
    EndSection
    Section "Monitor"
    Identifier "VGA"
    Option "PreferredMode" "1024x768_60.00"
    EndSection
    Section "Monitor"
    Identifier "HDMI"
    Option "PreferredMode" "1280x720_60.00"
    EndSection
    Section "Monitor"
    Identifier "Composite"
    Option "PreferredMode" "NTSC10"
    EndSection
    Section "Screen"
    Identifier "Screen0"
    Device "Card0"
    EndSection
    Section "Device"
    Identifier "Card0"
    Driver "fbdev"
    EndSection
    ```
    5. (Optional) install lightdm and i3 by following this
    ![](https://www.reddit.com/r/ChipCommunity/comments/abndo9/an_updated_guide_for_installing_i3_window_manager/)

    6. Reboot. If your touch screen cursor movement is reversed, append the following to either `/etc/X11/xorg.conf` or `/usr/share/X11/xorg.conf.d/99-calibration.conf`

    ```
    Section "InputClass"
    Identifier "calibration"
    MatchProduct "1c25000.rtp"
    Option "Calibration" "3992 182 3694 276"
    Option "SwapAxes" "0"
    Option "TransformationMatrix" "-1 0 1 0 -1 1 0 0 1"
    EndSection
    ```

    ## Reference
    Most of the steps in this tutorial were inspired/modified from the following references.
    ![](https://github.com/Thore-Krug/Flash-CHIP)
    ![](https://yoursunny.com/t/2019/bye-CHIP/)
    ![](http://maba.dk/index.php/demo/pocketchip/)