2

A tutorial to upgrade NXT pocket C.H.I.P to Debian Buster

 11 months ago
source link: https://gist.github.com/luzhuomi/526fbcc30f3522f09eacf20d0f776fa5
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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
  1. 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
$ sudo dpkg -i sunxi-tools_1.4.1-1_amd64.deb

And edit the Flash.sh file to comment away the following lines.

 # 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
  1. sudo apt update && sudo apt full-upgrade
  2. 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
  1. 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
  1. 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
  1. sudo apt update && sudo apt full-upgrade
  2. 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
  1. (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/

  2. 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

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
HandlePowerKey=ignore
  1. Save the file and run the following in the terminal as root
$ systemctl kill -s HUP systemd-logind

Reference

Most of the steps in this tutorial were inspired/modified from the following references.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK