_wiki as submodule

This commit is contained in:
cuu 2024-12-15 16:11:10 +08:00
parent 46f5f4c4ed
commit 18cbeae995
24 changed files with 4 additions and 2198 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "_wiki"]
path = _wiki
url = git@github.com:clockworkpi/DevTerm.wiki.git

1
_wiki Submodule

@ -0,0 +1 @@
Subproject commit cf7fa6031a3a6bcca41f659b1599fef47f5267af

View File

@ -1,16 +0,0 @@
# Upgrade bootloader and firmware
for os image 69 and later
https://forum.rvspace.org/t/visionfive-2-debian-image-december-released/1097/43?page=2
https://github.com/starfive-tech/VisionFive2/releases/ download latest sdcard.img, dd to sd card, then hdmi or serial port wait for the system to start
## Flash files
```
flashcp -v u-boot-spl.bin.normal.out /dev/mtd0
flashcp -v visionfive2_fw_payload.img /dev/mtd1
```
## 7110 full os large mirror address
https://debian.starfivetech.com/

View File

@ -1,59 +0,0 @@
# System
ubuntu 22.04 gcc8.4.0
```
sudo apt install gcc-8 gcc-8-aarch64-linux-gnu gcc-8-arm-linux-gnueabihf
```
# Download patch
```
git clone https://github.com/clockworkpi/DevTerm.git
```
# Download kernel and patch it
```
git clone https://github.com/raspberrypi/linux
cd linux
git checkout 3a33f11c48572b9dd0fecac164b3990fc9234da8
cp ~/DevTerm/Code/patch/cm4/cm4_kernel_0704.patch .
git apply cm4_kernel_0704.patch
#Strongly recommend to use gcc 8.4.0 as the cross compiler
KERNEL=kernel7l make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2711_defconfig
KERNEL=kernel7l make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j1
INSTALL_MOD_PATH=./modules make modules_install
rm modules/lib/modules/*/build
rm modules/lib/modules/*/source
mkdir output
mkdir output/boot
mkdir output/lib/modules -p
mkdir output/boot/overlays
cp -rf modules/lib/modules/5.10.17-v7l+ output/lib/modules/
cp arch/arm/boot/dts/overlays/*.dtbo output/boot/overlays/
cp arch/arm/boot/dts/bcm2711-rpi-cm4.dtb output/boot/
cp arch/arm/boot/zImage output/boot/kernel7l.img
```
output is the folder contains all kernel stuff
# config.txt
```
disable_overscan=1
dtparam=audio=on
[pi4]
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
[all]
dtoverlay=dwc2,dr_mode=host
dtoverlay=vc4-kms-v3d-pi4,cma-384
dtoverlay=devterm-pmu
dtoverlay=devterm-panel
dtoverlay=devterm-misc
dtoverlay=audremap,pins_12_13
dtparam=spi=on
gpio=10=ip,np
```

View File

@ -1,15 +0,0 @@
# a06 a04
```
git clone https://github.com/clockworkpi/DevTerm.git
sudo systemctl stop devterm-socat devterm-printer
sudo apt remove devterm-wiringpi-cpi
cd DevTerm/Code/devterm_wiringpi_cpi/
sudo ./build
cd ~/DevTerm/Code/thermal_printer/
sudo apt install -y libfreetype-dev
make

View File

@ -1,53 +0,0 @@
# Download kernel source for andriod of rpi4
**sync-andriod-kernel.sh**
```
#!/bin/bash
BIN_DIR=$HOME/bin
REPO_PATH=$BIN_DIR/repo
if [ ! -d $BIN_DIR ]
then
mkdir $BIN_DIR
add_path_env $BIN_DIR
curl https://storage.googleapis.com/git-repo-downloads/repo > $REPO_PATH
chmod a+x $REPO_PATH
else
echo "folder already exits. $BIN_DIR"
fi
export PATH=$PATH:$BIN_DIR
cd /data/andriod-kernel
repo init -u https://github.com/android-rpi/kernel_manifest -b arpi-5.10
repo sync
```
# Compile
```
cd /data/andriod-kernel/
./build/build.sh
```
# Replace files
```
sudo losetup --show -f -P lineage-19.1-20220511-UNOFFICIAL-KonstaKANG-rpi4.img # assume /dev/loop0
sudo mount /dev/loop0p1 /mnt/p1
# Copy kernel binaries to boot partition
cp -rf /data/andriod-kernel/out/arpi-5.10/dist/Image to /mnt/p1
cp -rf /data/andriod-kernel/out/arpi-5.10/dist/bcm2711-rpi-*.dtb /mnt/p1
cp -rf /data/andriod-kernel/out/arpi-5.10/dist/vc4-kms-v3d-pi4.dtbo to /mnt/p1/overlays/
sudo umount /mnt/p1
sudo losetup -D /dev/loop0
```
# Reference Url
* https://github.com/android-rpi/kernel_manifest
* https://github.com/android-rpi/device_arpi_rpi4

View File

@ -1,64 +0,0 @@
# Build bin
```
git clone https://github.com/rogerclarkmelbourne/STM32duino-bootloader
cd STM32duino-bootloader
make generic-pc13
```
this will produce `bootloader_only_binaries/generic_boot20_pc13.bin`
## Convert bootloader to hex format
using `srec_cat` to convert
windows: http://srecord.sourceforge.net/
linux: sudo apt install srecord
```
srec_cat bootloader_only_binaries/generic_boot20_pc13.bin -Binary -offset 0x08000000 -output bootloader_only_binaries/generic_boot20_pc13.hex -Intel
```
## Next is to use stm32Cube to flash the bootloader
* Download the stm32cube programmer
[stm32cube programmer](https://www.st.com/en/development-tools/stm32cubeprog.html)
* Put 1 ON in the back of keyboard
* Connect keyboard with a usb-serial convert by fpc, in order of [IO MAP](https://github.com/clockworkpi/DevTerm/wiki/Keyboard-with-FPC-60pin-0.5mm)
* Click connect on STM32cube programmer
* flash it
![2022-09-26_13-04](https://user-images.githubusercontent.com/523580/192197890-dcb6d6fc-0ef5-4870-b9d3-ae03fc5f5110.png)
![2022-09-26_13-04_1](https://user-images.githubusercontent.com/523580/192197900-c7f8b448-3812-403f-b7b0-728248533790.png)
![2022-09-26_13-09](https://user-images.githubusercontent.com/523580/192198205-8edecc5f-c30e-4837-8b3c-7f97c97ba40a.png)
# Flash Arudino
## Arduino IDE
* add stm32duino pacakage index in **Preference panel** : http://dan.drown.org/stm32duino/package_STM32duino_index.json as **Additional Boards Manager URLs:** and install STM32F1xx/GD32F1xx boards
![image](https://user-images.githubusercontent.com/523580/192198944-fd0fbf55-0977-42bb-9256-f7bcdf331466.png)
* verbose all outputs:
![image](https://user-images.githubusercontent.com/523580/192198967-d4738c42-897e-412a-b630-afab45d274c3.png)
* Select upload method ,board type is **Generic STM32F103R series **
![image](https://user-images.githubusercontent.com/523580/192198991-9757e354-c8ec-4859-95e9-dba732773fb1.png)
* Set cpu mhz to 48Mhz
![image](https://user-images.githubusercontent.com/523580/192199043-7f877adb-830e-4323-8799-06e115843b46.png)
* Put 1 OFF in the back of keyboard
* User arduino IDE to open [devterm_keyboard.ino](https://github.com/clockworkpi/DevTerm/blob/main/Code/devterm_keyboard/devterm_keyboard.ino)
* flash it
![image](https://user-images.githubusercontent.com/523580/192199494-8778bfcc-fcff-4bd0-9f51-f034a080f981.png)
# CN version
https://shimo.im/docs/Tc8RVQWdjvXtwhYv/ 《GD32f103rgt6/CKSF103R* 与stm32duino bootloader》
custom keyboard:
https://forum.clockworkpi.com/t/keyboard-stuck-in-bootloader-mode/8830/11

View File

@ -1,57 +0,0 @@
# Prepare
```
mkdir -p ~/data/andriod
mkdir -p ~/data/github/lineage-rpi
cd ~/data/github/lineage-rpi
git clone https://github.com/lineage-rpi/android_kernel_brcm_rpi -b lineage-19.1
git clone https://github.com/lineage-rpi/proprietary_vendor_brcm -b lineage-19.1
cd ~/data/andriod
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 -b pie-release
```
# Fix firmware path
edit `~/data/github/lineage-rpi/android_kernel_brcm_rpi/arch/arm64/configs/lineageos_rpi4_defconfig` line 1537
to be
`CONFIG_EXTRA_FIRMWARE_DIR="/home/cpi/data/github/lineage-rpi/proprietary_vendor_brcm/rpi4/proprietary/vendor/firmware"`
# Compile
```
cd ~/data/github/lineage-rpi/android_kernel_brcm_rpi
```
create **m.sh** with content like:
```
#!/bin/bash
export PATH=/home/cpi/data/andriod/aarch64-linux-android-4.9/bin:$PATH
ARCH=arm64 CROSS_COMPILE=aarch64-linux-androidkernel- make lineageos_rpi4_defconfig
ARCH=arm64 CROSS_COMPILE=aarch64-linux-androidkernel- make Image dtbs -j1
```
```
chmod +x m.sh
./m.sh # start kernel compile
```
# Replace files
copy
* bcm2711-rpi-400.dtb
* bcm2711-rpi-4-b.dtb
* bcm2711-rpi-cm4.dtb
* bcm2711-rpi-cm4s.dtb
from `~/data/github/lineage-rpi/android_kernel_brcm_rpi/arch/arm64/boot/dts/broadcom/` to lineage os image boot partition
copy `~/data/github/lineage-rpi/android_kernel_brcm_rpi/arch/arm64/boot/Image` to to lineage os image boot partition
copy `~/data/github/lineage-rpi/android_kernel_brcm_rpi/arch/arm64/boot/dts/overlays/vc4-kms-v3d.dtbo` to to lineage os image boot partition/overlays
# Kernel config
https://gist.github.com/cuu/92bfa28a9b6de421834e5f9f408a12a4

View File

@ -1,61 +0,0 @@
# Compile the widescreen version of Cave Story from the source code
### Install the necessary packages:
```
sudo apt update
sudo apt install build-essential libpng-dev libjpeg-dev make cmake cmake-data git libsdl2-dev libsdl2-doc libsdl2-gfx-dev libsdl2-gfx-doc libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev cmake -y -qq
```
### Compile the engine (it takes about 1 hour):
```
cd ~
git clone https://github.com/nxengine/nxengine-evo
```
### Modified to the widescreen version:
`vim ~/nxengine-evo/src/graphics/Renderer.cpp`
### Edit the 225 line and save and exit the following line
```
{(char *)"1280x480", 1280, 480, 640, 240, 2, true, true},
```
```
cd nxengine-evo
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
cd ~/nxengine-evo
wget https://www.cavestory.org/downloads/cavestoryen.zip
unzip cavestoryen.zip
cp -r CaveStory/data/* data/
cp CaveStory/Doukutsu.exe .
./build/nxextract
cd build
sudo make install
```
### Confirm that the original version can run normally:
`./nxengine-evo`
### Run the modified version:
`./nxengine-evo`
### After running, press the Esc key, enter Options->Graphics, select the resolution as 1280x480, and open the full screen.
### Reinstall after confirming that there is no problem:
```
cd ~/nxengine-evo/build
sudo make install
```
You can use the command **nxengine-evo **to run the game in any directory

View File

@ -1,233 +0,0 @@
**This wiki maybe outdated since armbian build system is always updating , so don't panic**
# Generate the prototype os image
```
cd ~
git clone https://github.com/armbian/build.git
git clone https://github.com/clockworkpi/DevTerm.git
cd build
git reset --hard 5fa022603c0948cc59688ba782b3711f980a0be3
cp -rf ~/DevTerm/Code/patch/armbian_build_a04/userpatches/* userpatches/
cp -rf ~/DevTerm/Code/patch/armbian_build_a04/config/boards/* config/boards/
cp -rf ~/DevTerm/Code/patch/armbian_build_a04/config/kernel/* config/kernel/
#Then exec ./compile.sh under armbian build
cd ~/build && ./compile.sh
```
after image done
uncompress the
`linux-dtb-current-sunxi64_21.11.0-trunk_arm64.deb`
`linux-image-current-sunxi64_21.11.0-trunk_arm64.deb`
and then combine all files ,all the postinst, preinst,prerm,postrm
to be one `devterm-kernel-current-cpi-a04.deb`
the reason is if not doing this , `apt-get upgrade` will replace the linux-dto,linux-image* in future, which will cause boot failed
so to keep a04 linux kernel in safe , I made devterm-kernel-current-cpi-a04
# Prepare to chroot into the image
```
sudo apt install -y qemu-user-static
sudo losetup -f # find the avaiable loop device number,eg:loop11
sudo losetup -P /dev/loop11 ~/build/output/images/Armbian_21.11.0-trunk_Clockworkpi-a04_hirsute_current_5.10.75_xfce_desktop.img
sudo mount /dev/loop11p1 /mnt/p1/
cd /mnt/p1
sudo mount --bind /dev dev/
sudo mount --bind /sys sys/
sudo mount --bind /proc proc/
sudo mount --bind /dev/pts dev/pts
sudo chroot .
```
## Inside chroot
(inside)
### import clockworpi apt
```
curl https://raw.githubusercontent.com/clockworkpi/apt/main/debian/KEY.gpg | tee /etc/apt/trusted.gpg.d/clockworkpi.asc
echo "deb https://raw.githubusercontent.com/clockworkpi/apt/main/debian/ stable main" | tee /etc/apt/sources.list.d/clockworkpi.list
```
### Preset cpi username and password
```
sh /etc/profile.d/armbian-check-first-login.sh
```
### Install kernel
```
sudo apt update
sudo apt install -y devterm-kernel-current-cpi-a04
apt install -y xfce4-power-manager
touch /home/cpi/.first_start
chown cpi:cpi /home/cpi/.first_start
```
### Allow sudo cpi without password prompt
```
echo -e "cpi\tALL=(ALL:ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/cpi
```
### Config xrandr
```
sudo bash -c 'cat << EOF > /etc/X11/Xsession.d/100custom_xrandr
xrandr --output DSI-1 --rotate right
xrandr --output None-1 --rotate right
EOF'
```
### Config lightdm
#### autologin
```
sudo bash -c 'cat <<EOF > /etc/lightdm/lightdm.conf.d/12-autologin.conf
[Seat:*]
autologin-user=cpi
autologin-user-timeout=0
EOF'
```
```
sudo bash -c 'cat <<EOF > /etc/lightdm/lightdm.conf.d/13-rotate-dsi.conf
[Seat:*]
greeter-setup-script=/etc/lightdm/setup.sh
EOF'
```
```
sudo bash -c 'cat <<EOF >/etc/lightdm/setup.sh
#!/bin/bash
xrandr --output DSI-1 --rotate right
xrandr --output None-1 --rotate right
exit 0
EOF'
sudo chmod +x /etc/lightdm/setup.sh
```
#### config lightdm background
```
sudo sed -i '/background/c\background = #202020' /etc/lightdm/slick-greeter.conf
```
### Disable app crash report dialog
```
sudo sed -i '/enabled=1/c\enabled=0' /etc/default/apport
```
### Hide suspend button
cd /home/cpi/.config/xfce4/xfconf/xfce-perchannel-xml
```
sudo sed -i 's/\(name\=\".*ShowSuspend.*\"\s\)value="\(true\|false\)"/\1value=\"false\"/gi' xfce4-session.xml
sudo sed -i 's/\(type\=\".*string.*\"\s\)value="\(+suspend\)"/\1value=\"-suspend\"/gi' xfce4-panel.xml
```
### Add framebuffer console rotate /boot/armbianEnv.txt
```
extraargs=fbcon=rotate:1
```
### Change ssh login banner
In `/etc/update-motd.d/10-armbian-header`
```
TERM=linux toilet -f standard -F metal $(echo $BOARD_NAME | sed 's/Orange Pi/OPi/' | sed 's/NanoPi/NPi/' | sed 's/Banana Pi/BPi/' | sed 's/Clockworkpi A04/Clockworkpi/')
```
### Install devterm packages
```
sudo apt update
sudo apt install -y devterm-wiringpi-cpi-a04 devterm-thermal-printer devterm-thermal-printer-cups devterm-first-start-a04 devterm-fan-daemon-cpi-a04 devterm-audio-patch
```
### Disable sshd
```
sudo touch /etc/ssh/sshd_not_to_be_run
```
### Install ibus input method for CJK
`sudo apt install ibus ibus-pinyin ibus-gtk ibus-gtk3 -y`
```
cat <<EOF >/home/cpi/.config/autostart/ibus.desktop
[Desktop Entry]
Exec=ibus-daemon -drxR
GenericName=IBus
Name[zh_CN]=IBus
Name=IBus
Name[en_US]=IBus
StartupNotify=true
Terminal=false
Type=Application
EOF
```
```
sudo bash -c 'cat <<EOF >/etc/profile.d/ibus.sh
#!/bin/bash
export XIM_PROGRAM=ibus
export XIM=ibus
export XMODIFIERS=@im=ibus
export GTK_IM_MODULE=ibus
export QT_IM_MODULE=ibus
EOF'
```
### GDM3
due to the panfrost screen flashing issue with lightdm,use gdm3 instead of lightdm
` sudo apt install gdm3`
```
sudo bash -c 'cat <<EOF > /usr/share/gdm/greeter/autostart/01_rotate.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Rotate Screen
Exec=/etc/lightdm/setup.sh
Terminal=false
NoDisplay=true
EOF'
```
#### gdm3 background and hide poweroff,suspend
In `/etc/gdm3/greeter.dconf-defaults `
```
...
[org/gnome/desktop/background]
picture-options='none'
primary-color='#222222'
...
[org/gnome/login-screen]
disable-restart-buttons=true
```
#### config gdm3 autologin
/etc/gdm3/custom.conf
```
[daemon]
...
AutomaticLoginEnable = true
AutomaticLogin = cpi
```
## libreoffice fix for panfrost issue
` sudo apt install libreoffice-gtk3 `
# Exit from chroot
```
exit
(out)
sudo umount /mnt/p1/dev/pts
sudo umount /mnt/p1/dev
sudo umount /mnt/p1/proc
sudo umount /mnt/p1/sys
##clear bash
sudo rm -rf root/.bash_history
cd -
sudo umount /mnt/p1
sudo losetup -D /dev/loop11
```

View File

@ -1,212 +0,0 @@
# Intro
DevTerm A06 os image based on Armbian with current kernel branch, XFCE desktop
and it is better to run a Ubuntu 21.04 in a VirtualBox with a good bandwidth network to do all the jobs
If the condition of the network is not so well,
the Armbian build process will fail on some packages downloading or mirrors connecting
The entire operation requires a certain experience in linux
be careful
**This wiki maybe outdated since armbian build system is always updating , so don't panic**
# Build armbian image for A06
```
cd ~
git clone https://github.com/armbian/build.git
git clone https://github.com/clockworkpi/DevTerm.git
cd build
git reset --hard 43d179914ae9e1ebb5d72315d9f9f68f5fb3e330
mkdir -p userpatches/kernel/rockchip64-current/
mkdir -p userpatches/u-boot/u-boot-rockchip64-mainline/
git apply ~/DevTerm/Code/patch/armbian_build_a06/patch/armbian.patch
cp ~/DevTerm/Code/patch/armbian_build_a06/patch/kernel*.patch userpatches/kernel/rockchip64-current/
cp ~/DevTerm/Code/patch/armbian_build_a06/patch/uboot*.patch userpatches/u-boot/u-boot-rockchip64-mainline/
cp -f ~/DevTerm/Code/patch/armbian_build_a06/patch/lib.config userpatches/
cp ~/DevTerm/Code/patch/armbian_build_a06/patch/clockworkpi-a06.conf config/boards/
#Then exec ./compile.sh under armbian build
cd ~/build && sudo ./compile.sh BOARD=clockworkpi-a06 BRANCH=current BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_ONLY=yes KERNEL_CONFIGURE=no
```
after image done
uncompress the
`linux-dtb-current-rockchip64_21.08.0-trunk_arm64.deb`
`linux-image-current-rockchip64_21.08.0-trunk_arm64.deb`
and then combine all files ,all the postinst, preinst,prerm,postrm
to be one `devterm-kernel-current-cpi-a06.deb`
the reason is if not doing this , `apt-get upgrade` will replace the linux-dto,linux-image* in future, which will cause boot failed
so to keep a06 linux kernel in safe , I made devterm-kernel-current-cpi-a06
# Chroot image
```
sudo losetup -P /dev/loop0 Armbian_21.08.0-trunk_Clockworkpi-a06_focal_current_5.10.55_xfce_desktop.img
sudo mount /dev/loop0p1 /mnt/p1
cd /mnt/p1
sudo mount --bind /dev dev/
sudo mount --bind /sys sys/
sudo mount --bind /proc proc/
sudo mount --bind /dev/pts dev/pts
sudo mv etc/ld.so.preload etc/ld_so_preload
sudo chroot .
```
## Inside Chroot
### Run password wizard
```
sh /etc/profile.d/armbian-check-first-login.sh
```
set **root** password,create default user **cpi** with password **cpi**
```
touch /home/cpi/.first_start
chown cpi:cpi /home/cpi/.first_start
```
### Install devterm software
```
sudo apt update
sudo apt install curl wget -y
curl https://raw.githubusercontent.com/clockworkpi/apt/main/debian/KEY.gpg | sudo tee /etc/apt/trusted.gpg.d/clockworkpi.asc
echo "deb https://raw.githubusercontent.com/clockworkpi/apt/main/debian/ stable main" | sudo tee /etc/apt/sources.list.d/clockworkpi.list
sudo apt update
sudo apt remove linux-image*
sudo apt install devterm-kernel-current-cpi-a06 devterm-fan-daemon-cpi-a06 devterm-thermal-printer devterm-thermal-printer-cups devterm-wiringpi-cpi devterm-first-start-a06 devterm-audio-patch
```
### /boot/ArmbianEnv.txt
```
bootlogo=false
extraargs= fbcon=rotate:1
...
```
### autologin
```
sudo bash -c 'cat <<EOF > /etc/lightdm/lightdm.conf.d/12-autologin.conf
[Seat:*]
autologin-user=cpi
autologin-user-timeout=0
EOF'
```
### config lightdm
```
sudo bash -c 'cat << EOF > /etc/lightdm/lightdm.conf.d/13-rotate-dsi.conf
[Seat:*]
greeter-setup-script=/etc/lightdm/setup.sh
EOF'
sudo bash -c 'cat <<EOF >/etc/lightdm/setup.sh
#!/bin/bash
xrandr --output DSI-1 --rotate right
exit 0
EOF'
sudo chmod +x /etc/lightdm/setup.sh
```
### config xrandr
```
sudo bash -c 'cat << EOF > /etc/X11/Xsession.d/100custom_xrandr
xrandr --output DSI-1 --rotate right
EOF'
```
### additional software
```
sudo apt remove celluloid mpv
sudo apt install -y arandr chromium-browser vlc cpupower-gui xfce4-power-manager
```
### /etc/default/apport
`enable=0`
### ssh banner fix
/etc/update-motd.d/10-armbian-header
```
.... sed 's/Banana Pi/BPi/' | sed 's/Clockworkpi A06/Clockworkpi/')
```
### Disable Display power management in xfce4 power manager
display power management must be disabled ,once the display turn off, you need to reboot to get it back
~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-power-manager.xml
```
<?xml version="1.0" encoding="UTF-8"?>
<channel name="xfce4-power-manager" version="1.0">
<property name="xfce4-power-manager" type="empty">
<property name="power-button-action" type="empty"/>
<property name="brightness-switch-restore-on-exit" type="int" value="0"/>
<property name="brightness-switch" type="int" value="0"/>
<property name="show-tray-icon" type="int" value="1"/>
<property name="lid-action-on-battery" type="uint" value="1"/>
<property name="logind-handle-lid-switch" type="bool" value="false"/>
<property name="lid-action-on-ac" type="uint" value="0"/>
<property name="inactivity-sleep-mode-on-battery" type="uint" value="1"/>
<property name="sleep-button-action" type="uint" value="1"/>
<property name="hibernate-button-action" type="uint" value="1"/>
<property name="lock-screen-suspend-hibernate" type="bool" value="false"/>
<property name="critical-power-action" type="uint" value="4"/>
<property name="critical-power-level" type="uint" value="5"/>
<property name="dpms-enabled" type="bool" value="false"/>
<property name="blank-on-ac" type="int" value="0"/>
<property name="brightness-on-battery" type="uint" value="120"/>
<property name="blank-on-battery" type="int" value="0"/>
<property name="brightness-on-ac" type="uint" value="120"/>
<property name="brightness-level-on-battery" type="uint" value="40"/>
<property name="brightness-level-on-ac" type="uint" value="42"/>
</property>
</channel>
```
### Default wallpaper
```
/usr/share/backgrounds/xfce/xfce-verticals.png
```
# Quit Chroot
```
exit
sudo mv etc/ld_so_preload etc/ld.so.preload
sudo umount /mnt/p1/dev/pts
sudo umount /mnt/p1/dev
sudo umount /mnt/p1/proc
sudo umount /mnt/p1/sys
##clear bash
sudo rm -rf root/.bash_history
sudo rm usr/bin/qemu-arm-static
cd -
sudo umount /mnt/p1
```
umount may failed at /mnt/p1/dev
just use `ps aux | grep cupsd` to see if there a process named like `/usr/bin/qemu-aarch64-static /usr/sbin/cupsd -C /etc/cups/cupsd.conf -s /etc/cups/cups-files.conf`
find the pid ,use `sudo kill -9 ${pid}` with that pid
then umount again
# Flash the image to SD card
* Linux
`sudo dd if=Armbian_21.08.0-trunk_Clockworkpi-a06_focal_current_5.10.55_xfce_desktop.img of=/dev/sdX bs=8M status=progress`
# Ubuntu 2104 Hirsute went offline
fix:
https://forum.clockworkpi.com/t/hirsute-went-offline-late-july-2022-how-to-manage/8770/3
new os image: 26f52bfde573479960d8696f407d19b9 http://dl.clockworkpi.com/DevTerm_A06_v0.2h.img.bz2
switched to ubuntu jammy ,LTS up to 2037
# 2023 06 30 new kernel patch:
https://github.com/clockworkpi/uConsole/tree/master/Code/patch/a06/20230630

View File

@ -1,94 +0,0 @@
## Intro
The image based on raspberry pi os
and it is better to run a Ubuntu 21.04 in a VirtualBox to do all the jobs
The entire operation requires a certain experience in linux
be careful
## Start a chroot env
```
wget https://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2021-05-28/2021-05-07-raspios-buster-armhf-full.zip
unzip 2021-05-07-raspios-buster-armhf-full.zip
sudo losetup --show -f -P 2021-05-07-raspios-buster-armhf-full.img #assume loop0
sudo mount /dev/loop0p2 /mnt/p2
sudo mount /dev/loop0p1 /mnt/p2/boot
cd /mnt/p2
sudo mount --bind /dev dev/
sudo mount --bind /sys sys/
sudo mount --bind /proc proc/
sudo mount --bind /dev/pts dev/pts
#sudo mv etc/ld.so.preload etc/ld_so_preload
sudo chroot .
```
## Inside chroot
```
curl https://raw.githubusercontent.com/clockworkpi/apt/main/debian/KEY.gpg | sudo tee /etc/apt/trusted.gpg.d/clockworkpi.asc
echo "deb https://raw.githubusercontent.com/clockworkpi/apt/main/debian/ stable main" | sudo tee -a /etc/apt/sources.list.d/clockworkpi.list
sudo apt update && sudo apt install devterm-thermal-printer devterm-keyboard-firmware devterm-fan-temp-daemon-rpi devterm-thermal-printer-cups devterm-kernel-rpi devterm-audio-patch -y
```
**Config xrandr**
```
sudo bash -c 'cat << EOF > etc/X11/Xsession.d/100custom_xrandr
xrandr --output DSI-1 --rotate right
EOF'
```
**config lightdm**
`/etc/lightdm/lightdm.conf`
`greeter-setup-script=/etc/lightdm/setup.sh`
```
sudo bash -c 'cat <<EOF >/etc/lightdm/setup.sh
#!/bin/bash
xrandr --output DSI-1 --rotate right
exit 0
EOF'
```
`sudo chmod +x /etc/lightdm/setup.sh`
**Modify /etc/dphys-swapfile**
```
CONF_SWAPSIZE=512
```
**Change the default wallpaper**
The following files changed
* /etc/xdg/pcmanfm/LXDE-pi/desktop-items-0.conf
* /etc/xdg/pcmanfm/LXDE-pi/desktop-items-1.conf
* /etc/lightdm/pi-greeter.conf
* /home/pi/.config/pcmanfm/LXDE-pi/desktop-items-0.conf
Delete wallpaper address `temple.jpg`,change the `desktop_bg` color to `#202020`
change `/etc/hostname` to clockworkpi
in `/boot/cmdline.txt` ,add `fbcon=rotate:1`, remove `quiet`
### Now quit the chroot env
```
exit
#sudo mv etc/ld_so_preload etc/ld.so.preload
sudo umount /mnt/p2/dev/pts
sudo umount /mnt/p2/dev
sudo umount /mnt/p2/proc
sudo umount /mnt/p2/sys
##clear bash
sudo rm -rf root/.bash_history
#sudo rm usr/bin/qemu-arm-static
cd -
sudo umount /mnt/p2/boot
sudo umount /mnt/p2
sudo losetup -D /dev/loop0 #assume loop0
```
### Flash the image to SD card
* Linux
`sudo dd if=2021-05-07-raspios-buster-armhf-full.img of=/dev/sdX bs=8M status=progress`

View File

@ -1,140 +0,0 @@
## Intro
The image based on raspberry pi os
for raspberry pi cm4 with devterm cm4 adapter
and it is better to run a Ubuntu 21.04 in a VirtualBox to do all the jobs
The entire operation requires a certain experience in linux
be careful
## Start a chroot env
```bash
wget https://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2021-05-28/2021-05-07-raspios-buster-armhf-full.zip
unzip 2021-05-07-raspios-buster-armhf-full.zip
sudo losetup --show -f -P 2021-05-07-raspios-buster-armhf-full.img #assume loop0
sudo mount /dev/loop0p2 /mnt/p2
sudo mount /dev/loop0p1 /mnt/p2/boot
cd /mnt/p2
sudo mount --bind /dev dev/
sudo mount --bind /sys sys/
sudo mount --bind /proc proc/
sudo mount --bind /dev/pts dev/pts
#sudo mv etc/ld.so.preload etc/ld_so_preload
sudo chroot .
```
## Inside chroot
```bash
curl https://raw.githubusercontent.com/clockworkpi/apt/main/debian/KEY.gpg | sudo tee /etc/apt/trusted.gpg.d/clockworkpi.asc
echo "deb https://raw.githubusercontent.com/clockworkpi/apt/main/debian/ stable main" | sudo tee -a /etc/apt/sources.list.d/clockworkpi.list
sudo apt update && sudo apt install devterm-thermal-printer-cm4 devterm-fan-temp-daemon-cm4 devterm-kernel-cm4-rpi devterm-audio-patch devterm-wiringpi-cm4-cpi -y
sudo apt install -y devterm-thermal-printer-cups
```
**Config xrandr**
```
sudo bash -c 'cat << EOF > etc/X11/Xsession.d/100custom_xrandr
xrandr --output DSI-1 --rotate right
EOF'
```
**config lightdm**
`/etc/lightdm/lightdm.conf`
`greeter-setup-script=/etc/lightdm/setup.sh`
```
sudo bash -c 'cat <<EOF >/etc/lightdm/setup.sh
#!/bin/bash
xrandr --output DSI-1 --rotate right
exit 0
EOF'
```
`sudo chmod +x /etc/lightdm/setup.sh`
**Modify /etc/dphys-swapfile**
```
CONF_SWAPSIZE=512
```
**Change the default wallpaper**
The following files changed
* /etc/xdg/pcmanfm/LXDE-pi/desktop-items-0.conf
* /etc/xdg/pcmanfm/LXDE-pi/desktop-items-1.conf
* /etc/lightdm/pi-greeter.conf
* /home/pi/.config/pcmanfm/LXDE-pi/desktop-items-0.conf
Delete wallpaper address `temple.jpg`,change the `desktop_bg` color to `#202020`
change `/etc/hostname` to clockworkpi
in `/boot/cmdline.txt` ,add `fbcon=rotate:1`, remove `quiet`
**Screen rotation**
change
```
/etc/skel/.config/monitors.xml
/home/{pi,rpi-first-boot-wizard}/.config/monitors.xml
```
to be like
```xml
<monitors version="2">
<configuration>
<logicalmonitor>
<x>0</x>
<y>0</y>
<primary>yes</primary>
<monitor>
<monitorspec>
<connector>DSI-1</connector>
<vendor>unknown</vendor>
<product>unknown</product>
<serial>unknown</serial>
</monitorspec>
<mode>
<width>480</width>
<height>1280</height>
<rate>60.000</rate>
</mode>
</monitor>
<transform>
<rotation>right</rotation>
</transform>
</logicalmonitor>
</configuration>
</monitors>
```
for uConsole, replace **480 to 720** in above **monitors.xml**
### console rotation
/boot/cmdline.txt add **fbcon=rotate:1** in the end of
```
console=......... fbcon=rotate:1
```
### Now quit the chroot env
```bash
exit
#sudo mv etc/ld_so_preload etc/ld.so.preload
sudo umount /mnt/p2/dev/pts
sudo umount /mnt/p2/dev
sudo umount /mnt/p2/proc
sudo umount /mnt/p2/sys
##clear bash
sudo rm -rf root/.bash_history
#sudo rm usr/bin/qemu-arm-static
cd -
sudo umount /mnt/p2/boot
sudo umount /mnt/p2
sudo losetup -D /dev/loop0 #assume loop0
```
### Flash the image to SD card
* Linux
`sudo dd if=2021-05-07-raspios-buster-armhf-full.img of=/dev/sdX bs=8M status=progress`

View File

@ -1,471 +0,0 @@
# Before start
Our system image is modified based on fedora wiki
Mainly replace the kernel and rootfs
Some linux experience is required to handle every possible situation
there are some discrepancies with the final system image
So this document is more suitable for the guidance of the R-01 system image
# Prepare
a ubuntu linux system, like ubuntu 21.04
install riscv64 gcc
```
sudo apt install gcc-11-riscv64-linux-gnu binutils-riscv64-linux-gnu
sudo apt install git
sudo apt install make
sudo apt install build-essential
sudo apt install libfontconfig1
sudo apt install ncurses-devel
sudo apt install libncurses-dev
sudo apt install build-essential
sudo apt install flex bison
sudo apt install python3-distutils
sudo apt install swig
sudo apt install python3-dev
sudo apt install openssl
sudo apt install libssl-dev
```
install qemu static for chroot
`sudo apt install qemu-user-static`
manually fix default compiler link:
```
sudo ln -s /usr/bin/riscv64-linux-gnu-cpp-11 /usr/bin/riscv64-linux-gnu-cpp
sudo ln -s /usr/bin/riscv64-linux-gnu-gcc-nm-11 /usr/bin/riscv64-linux-gnu-gcc-nm
sudo ln -s /usr/bin/riscv64-linux-gnu-gcov-dump-11 /usr/bin/riscv64-linux-gnu-gcov-dump
sudo ln -s /usr/bin/riscv64-linux-gnu-gcc-11 /usr/bin/riscv64-linux-gnu-gcc
sudo ln -s /usr/bin/riscv64-linux-gnu-gcc-ranlib-11 /usr/bin/riscv64-linux-gnu-gcc-ranlib
sudo ln -s /usr/bin/riscv64-linux-gnu-gcov-tool-11 /usr/bin/riscv64-linux-gnu-gcov-tool
sudo ln -s /usr/bin/riscv64-linux-gnu-gcc-ar-11 /usr/bin/riscv64-linux-gnu-gcc-ar
sudo ln -s /usr/bin/riscv64-linux-gnu-gcov-11 /usr/bin/riscv64-linux-gnu-gcov
sudo ln -s /usr/bin/riscv64-linux-gnu-lto-dump-11 /usr/bin/riscv64-linux-gnu-lto-dump
```
# Bootloader
### reference doc:
https://fedoraproject.org/wiki/Architectures/RISC-V/Allwinner
```
git clone https://github.com/smaeul/sun20i_d1_spl
pushd sun20i_d1_spl
git checkout origin/mainline
make CROSS_COMPILE=riscv64-linux-gnu- p=sun20iw1p1 mmc
popd
```
```
pushd sun20i_d1_spl
sudo dd if=nboot/boot0_sdcard_sun20iw1p1.bin of=/dev/sdX bs=512 seek=16
```
git clone https://github.com/tekkamanninja/opensbi -b allwinner_d1
pushd opensbi
CROSS_COMPILE=riscv64-linux-gnu- PLATFORM=generic FW_PIC=y BUILD_INFO=y make
popd
```
git clone https://github.com/tekkamanninja/u-boot -b allwinner_d1
pushd u-boot
make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv nezha_defconfig
make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv menuconfig
make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv u-boot.bin u-boot.dtb
popd
```
**in menuconfig, there is an import option must be selected:**
![menuconfig](https://raw.githubusercontent.com/clockworkpi/DevTerm/main/Pictures/Image%202022-04-11%20112248.png)
otherwises, the boot will hang
## u-boot.toc1
**toc1.cfg**
```
[opensbi]
file = fw_dynamic.bin
addr = 0x40000000
[dtb]
file = u-boot.dtb
addr = 0x44000000
[u-boot]
file = u-boot.bin
addr = 0x4a000000
```
```
pushd u-boot
cp ${PATH_TO_TOC1_CFG}/toc1.cfg ${PATH_TO_OPENSBI}/fw_dynamic.bin .
tools/mkimage -T sunxi_toc1 -d toc1.cfg u-boot.toc1
popd
```
pushd u-boot
sudo dd if=u-boot.toc1 of=/dev/sdX bs=512 seek=32800
![boot ](https://raw.githubusercontent.com/clockworkpi/DevTerm/main/Pictures/Image%202022-04-10%20192110.png)
# Disk partition prepare
## Original fedora image fdisk partition
```
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xda568ce2
Device Boot Start End Sectors Size Id Type
fedora-riscv64-d1-developer-xfce-rawhide-Rawhide-20211124-132603.n.0-sda.raw.img2 69632 319487 249856 122M c W95 FAT32 (LBA)
fedora-riscv64-d1-developer-xfce-rawhide-Rawhide-20211124-132603.n.0-sda.raw.img3 * 319488 1320959 1001472 489M 83 Linux
fedora-riscv64-d1-developer-xfce-rawhide-Rawhide-20211124-132603.n.0-sda.raw.img4 1320960 25319423 23998464 11.5G 83 Linux
```
## Create disk image file
### create image file with dd
```
MEGA=16777216
dd if=/dev/zero bs=$MEGA count=1024 of=disk.img
echo -e "o\nn\np\n2\n69632\n319487\nn\np\n3\n319488\n1320959\nn\np\n4\n1320960\n\n\nt\n2\nc\na\n3\n\nw" | fdisk disk.img
fdisk -l disk.img
```
```
sudo losetup --show -f -P disk.img #/dev/loop1
sudo mkfs.vfat /dev/loop1p2
sudo mkfs.ext4 /dev/loop1p3
sudo mkfs.ext4 /dev/loop1p4
```
# Download ubuntu riscv image for rootfs
https://wiki.ubuntu.com/RISC-V
https://cdimage.ubuntu.com/releases/21.04/release/
https://cdimage.ubuntu.com/releases/21.04/release/ubuntu-21.04-preinstalled-server-riscv64+unmatched.img.xz
## Take rootfs of ubuntu out
```
sudo losetup --show -f -P ubuntu-21.04-preinstalled-server-riscv64+unmatched.img # eg: /dev/loop1,depends on your linux system
sudo mount /dev/loop1p1 /mnt/p1
sudo tar cpjfv ubuntu-21.04-preinstalled-server-riscv64+unmatched_rootfs.tar.bz2 -C /mnt/p1/ .
sudo umount /mnt/p1
sudo losetup -D /dev/loop1 #dettach,release /dev/loop1
```
download link:
https://mega.nz/file/IQFlWZKL#_ERlz3GXoUgxsIoaLHK8oQ2A6SNFcHhZpS2tF3N6RaQ
https://mega.nz/file/IIlAHKST#PP8feOr6tHxdbD-Zoyj64G4TfG7HG_1s3VHasisP6h0
## Prebuilt files
### boot partition
#### ubuntu_2104_devterm_d1_boot.tar.bz2
```
https://mega.nz/file/NEsV1SRQ#FexV7wJhiUQKLcfBol4bB5m8UsX1O5qWet8geONclY4
https://mega.nz/file/YJUjiKKb#nrxH6BDvyGjpNSyZEzbRqbHk9ed9RE7jcuOPbTdximM
```
*included files*
```
├── board.dtb
├── **boot**
│ └── uEnv.txt
├── config-5.4.61
├── **efi**
├── **extlinux**
│ ├── extlinux.conf
│ └── extlinux.conf.cpi.bak
├── **grub2**
│ └── **themes**
│ └── **system**
│ └── **background.png**
├── grub.cfg
├── System.map-5.4.61
├── **uEnv.txt** -\> boot/uEnv.txt
└── vmlinuz-5.4.61
```
#### ubuntu_2104_devterm_d1_EFI.tar.bz2
https://mega.nz/file/kNUBRBIB#NsPzKTDWbfBSTth7-eVz9gPjeaEdYnP7PfuYGz28cOk
**extlinux.conf is the file actually do the boot configuration**
# How to compile kernel
## get kernel source
https://github.com/cuu/last_linux-5.4.git
it is a mirror kernel code from tina_d1_h of all winner with all patched for devterm R-01
## Official toolchain
https://github.com/cuu/toolchain-thead-glibc #It's official allwinner toolchain
download toolchain
## Steps for compiling kernel
extract and put toolchain in any folder you like
then edit **m.sh** in `last_linux-5.4`
set correct path of toolchain for PATH
```
export PATH=/data/tina_d1_h/prebuilt/gcc/linux-x86/riscv/toolchain-thead-glibc/riscv64-glibc-gcc-thead_20200702/bin/:$PATH
```
to be
```
export PATH=/wherever_you_put_toolchain/riscv64-glibc-gcc-thead_20200702/bin/:$PATH
```
then simply run ./m.sh to compile kernel
we just simple use the prebuit toolchain from all-winner to compile the patched kernel code based on all-winner tina for devterm_r01
and we have to ,because allwinner prebuilt toolchain has the neccessary custom opcode for the kernel of R-01
kernel patch url: https://github.com/clockworkpi/DevTerm/tree/main/Code/patch/d1
to get original tina code from allwinner ,visit https://open.allwinnertech.com/
## Mainline toolchain
https://github.com/riscv/riscv-gnu-toolchain
all the same as Official toolchain except need to disable Vector in kernel `make menuconfig`
![d1_disable_vector_kernel](https://raw.githubusercontent.com/clockworkpi/DevTerm/main/Pictures/d1_disable_vector_kernel.jpg)
# Make alpha os image
required file list:
* ubuntu_2104_devterm_d1_EFI.tar.bz2
* ubuntu_2104_devterm_d1_boot.tar.bz2
* ubuntu-21.04-preinstalled-server-riscv64+unmatched_rootfs.tar.bz2
* boot0_sdcard_sun20iw1p1.bin
* u-boot.toc1
* disk.img with all partitions formatted
```
sudo losetup --show -f -P disk.img ## assume we will have /dev/loop1
sudo dd if=boot0_sdcard_sun20iw1p1.bin of=/dev/loop1 bs=512 seek=16
sudo dd if=u-boot.toc1 of=/dev/loop1 bs=512 seek=32800
sudo mount /dev/loop1p2 /mnt/p2
sudo mount /dev/loop1p3 /mnt/p3
sudo mount /dev/loop1p4 /mnt/p4
sudo tar xpjfv ubuntu_2104_devterm_d1_EFI.tar.bz2 -C /mnt/p2
sudo tar xpjfv ubuntu_2104_devterm_d1_boot.tar.bz2 -C /mnt/p3
sudo tar xpjfv ubuntu-21.04-preinstalled-server-riscv64+unmatched_rootfs.tar.bz2 -C /mnt/p4
```
## Chroot part
```
sudo mount /dev/loop1p3 /mnt/p4/boot
cd /mnt/p4
sudo mount --bind /dev dev/
sudo mount --bind /sys sys/
sudo mount --bind /proc proc/
sudo mount --bind /dev/pts dev/pts
sudo chroot .
```
### upgrade to devel
now we are in chroot
```
touch /etc/cloud/cloud-init.disabled
apt remove update-notifier-common
apt-get update && apt-get purge needrestart
```
then edit `/etc/apt/source.list`, replace all hirsute to devel
then
```
apt update
apt-get dist-upgrade
```
wait a long time until upgrade done(or retry if failed,it is neccessary for having a newer xorg/mesa in riscv to display)
after upgrade
```
apt update
apt install mesa-utils libgl1-mesa-glx libglx-mesa0 libgles2-mesa libegl-mesa0
apt install -y xterm cmus alsamixergui qutebrowser elinks vim emacs tilde bc gnuplot dosbox chocolate-doom gimp xfig xpdf xaos x11-apps gkrellm imagemagick inkscape
apt remove multipath-tools
```
### add cpi user
```
useradd -m cpi
#add into groups
usermod -a -G adm,dialout,cdrom,floppy,sudo,audio,dip,video,plugdev,netdev,lxd,pulse,pulse-access cpi
```
### Deploy the TWM window manager env.
The R-01 uses twm as default window manager for low resource usage
```
wget https://github.com/clockworkpi/DevTerm/blob/main/Code/R01/d1_twm.tar.bz2?raw=true
tar xpjfv d1_twm.tar.bz2 -C /home/cpi
chown -R cpi:cpi /home/cpi
```
### xorg fbdev config
rotate Xorg
```
ubuntu@ubuntu:~$ cat /etc/X11/xorg.conf.d/10-d1.conf
Section "Device"
Identifier "FBDEV"
Driver "fbdev"
Option "fbdev" "/dev/fb0"
Option "Rotate" "cw"
Option "SwapbuffersWait" "true"
EndSection
Section "Screen"
Identifier "Screen0"
Device "FBDEV"
DefaultDepth 24
Subsection "Display"
Depth 24
Modes "1280x480" "480x1280"
EndSubsection
EndSection
```
### Optmise time of boot
```
sudo systemctl mask apt-daily.service apt-daily-upgrade.service
sudo systemctl disable apt-daily.service apt-daily-upgrade.service
sudo systemctl disable apt-daily.timer apt-daily-upgrade.timer
sudo systemctl disable NetworkManager-wait-online.service
sudo systemctl disable systemd-random-seed.service
sudo systemctl disable e2scrub_reap.service
sudo systemctl disable systemd-networkd-wait-online.service
sudo systemctl disable lvm2-monitor.service
sudo systemctl disable snapd.seeded.service
sudo systemctl disable pppd-dns.service
sudo systemctl disable avahi-daemon.service
sudo systemctl disable ModemManager.service
sudo systemctl disable apport.service
sudo systemctl mask apport.service
sudo systemctl disable accounts-daemon.service
sudo systemctl mask accounts-daemon.service
sudo systemctl disable udisks2.service
```
### faster login
```
All scripts in /etc/update-motd.d/ transferred to other place or just deleted them all
```
### Install devterm related package
```
curl https://raw.githubusercontent.com/clockworkpi/apt/main/debian/KEY.gpg | sudo tee /etc/apt/trusted.gpg.d/clockworkpi.asc
echo "deb https://raw.githubusercontent.com/clockworkpi/apt/main/debian/ stable main" | sudo tee /etc/apt/sources.list.d/clockworkpi.list
apt update
apt install devterm-audio-patch devterm-backlight-cpi devterm-keyboard-firmware devterm-thermal-printer devterm-thermal-printer-cups devterm-wiringpi-cpi
```
## Get out chroot
```
exit
cd
sudo umount /mnt/p4/dev/pts
sudo umount /mnt/p4/dev/
sudo umount /mnt/p4/proc
sudo umount /mnt/p4/sys
sudo umount /mnt/p4/boot
sudo umount /mnt/p3
sudo umount /mnt/p2
sudo umount /mnt/p4
sudo losetup -D /dev/loop1
```
# Final part
now we have a chroot edited os image file disk.img in 16GB with ubuntu devel branch root fs
you can still use
```
sudo losetup --show -f -P disk.img
sudo gparted /dev/loop1
```
to shrink the disk size to be like 8G or less to fit your sd card
then dd it into sd card
# Compiling other stuff
## WiringPI
```
git clone https://github.com/clockworkpi/DevTerm.git
wget https://github.com/WiringPi/WiringPi/archive/refs/tags/final_official_2.50.tar.gz
tar zxvf final_official_2.50.tar.gz
cd WiringPi-final_official_2.50/
cp ../DevTerm/Code/patch/d1/wiringCP0329.patch .
git apply wiringCP0329.patch
sudo ./build
#Choice: 2
```
# For apt upgrade
apt upgrade on R01 os will mess up the content of extlinux.conf
lead the boot failed
so mount the sd card(with R01 os) on a PC (like Linux )
then go into the **boot partition** of the sd card
you will see
```
extlinux.conf
extlinux.conf.cpi.bak
```
replace extlinux.conf with extlinux.conf.cpi.bak
the **extlinux.conf.cpi.bak** is for this kind of situation
# Hints
https://forum.clockworkpi.com/t/r01-os-early-hints/8636

View File

@ -1,33 +0,0 @@
`sudo apt install ibus ibus-pinyin -y`
```
cat <<EOF >~/.config/autostart/ibus.desktop
[Desktop Entry]
Exec=ibus-daemon -drxR
GenericName=IBus
Name[zh_CN]=IBus
Name=IBus
Name[en_US]=IBus
StartupNotify=true
Terminal=false
Type=Application
EOF
```
```
sudo bash -c 'cat <<EOF >/etc/profile.d/ibus.sh
#!/bin/bash
export XIM_PROGRAM=ibus
export XIM=ibus
export XMODIFIERS=@im=ibus
export GTK_IM_MODULE=ibus
export QT_IM_MODULE=ibus
EOF'
```
`sudo reboot `
Then right-click the ibus icon in the upper right corner of the top menu
select preferences
add (Add) **pinyin** input method, the default is super+space to enable the input method
you can change the shortcut in **iBus Preferences**

View File

@ -1,78 +0,0 @@
### Orginal image download URL
https://downloads.raspberrypi.org/raspios_full_armhf/images/raspios_full_armhf-2021-05-28/2021-05-07-raspios-buster-armhf-full.zip
#### Modification request list
- [x] screen rotation for xrandr,fbcon,lightdm
- [x] Remove the wallpaper and change the solid color #202020
- [x] Install all rpi-related debs in the apt source
#### Packages in devterm apt source
1. devterm-audio-patch (check whether the 3.5 audio interface is plugged in, pull up a certain GPIO)
1. devterm-fan-temp-daemon-rpi (detect the temperature of rpi, raise the io drive fan, written in python)
1. devterm-kernel-rpi (modified kernel, 4.x series)
1. devterm-keyboard-firmware (Devterm keyboard firmware flashing tool, Advanced users only!)
1. devterm-thermal-printer (thermal printer program and systemd scripts)
1. devterm-thermal-printer-cups (CUPS filter for the thermal printer, and add the thermal printer to cups, so devterm printer can be seen in chromium)
##### Add clockworkpi to apt source list
see https://github.com/clockworkpi/apt/tree/main/debian
```
wget -O - https://raw.githubusercontent.com/clockworkpi/apt/main/debian/KEY.gpg | sudo apt-key add -
echo "deb https://raw.githubusercontent.com/clockworkpi/apt/main/debian/ stable main" | sudo tee -a /etc/apt/sources.list.d/clockworkpi.list
```
##### Config xrandr
```
sudo bash -c 'cat << EOF > etc/X11/Xsession.d/100custom_xrandr
xrandr --output DSI-1 --rotate right
EOF'
```
##### Config lightdm
in `/etc/lightdm/lightdm.conf`
```
greeter-setup-script=/etc/lightdm/setup.sh
```
*setup.sh*
```
#!/bin/bash
xrandr --output DSI-1 --rotate right
exit 0
```
`sudo chmod +x etc/lightdm/setup.sh`
##### Modify /etc/dphys-swapfile
```
CONF_SWAPSIZE=512
```
##### Change the default wallpaper
The following files changed
* /etc/xdg/pcmanfm/LXDE-pi/desktop-items-0.conf
* /etc/xdg/pcmanfm/LXDE-pi/desktop-items-1.conf
* /etc/lightdm/pi-greeter.conf
* /home/pi/.config/pcmanfm/LXDE-pi/desktop-items-0.conf
Delete wallpaper address `temple.jpg`
Modify the `desktop_bg` color to `#202020`
#### config.txt
Add `dtparam=audio=on` to solve the problem of no sound card under HDMI
##### /etc/hostname to clockworkpi
##### /boot/cmdline.txt ,add fbcon=rotate:1, remove quiet
### Image download url
https://forum.clockworkpi.com/t/devterm-os-cm3-image-files/7151/1

View File

@ -1,83 +0,0 @@
### Img file
[ubuntu-21.04-preinstalled-server-armhf+raspi.img](https://cdimage.ubuntu.com/releases/21.04/release/ubuntu-21.04-preinstalled-server-armhf+raspi.img.xz)
### Prepare
Edit /boot/cmdline.txt and /etc/fstab of this img
**/boot/cmdline.txt**
```
console=serial0,115200 console=tty1 root=PARTUUID=78e1086a-02 rootfstype=ext4 elevator=deadline rootwait fixrtc splash fbcon=rotate:1
```
to use HDMI console,consider to remove **fbcon=rotate:1** in `/boot/cmdline.txt`
**/etc/fstab**
```
PARTUUID=78e1086a-02 / ext4 discard,errors=remount-ro 0 1
PARTUUID=78e1086a-01 /boot/ vfat defaults 0 1
```
### Enter chroot
```
sudo losetup -P /dev/loop10 ubuntu-21.04-preinstalled-server-armhf+raspi.img
sudo mount /dev/loop10p2 /mnt/p2
sudo mount /dev/loop10p1 /mnt/p2/boot
cd /mnt/p2
sudo mount --bind /dev dev/
sudo mount --bind /sys sys/
sudo mount --bind /proc proc/
sudo mount --bind /dev/pts dev/pts
sudo chroot .
```
### Inside chroot
```
sudo unlink /etc/resolv.conf
echo -en "nameserver 1.1.1.1\nnameserver 8.8.8.8\n" > /etc/resolv.conf
sudo apt remove linux-image-raspi linux-image-5.11.0-1007-raspi -y
sudo apt install net-tools network-manager -y
wget -O - https://raw.githubusercontent.com/clockworkpi/apt/main/debian/KEY.gpg | sudo apt-key add
echo "deb https://raw.githubusercontent.com/clockworkpi/apt/main/debian/ stable main" | sudo tee -a /etc/apt/sources.list.d/clockworkpi.list
sudo apt update && sudo apt install devterm-thermal-printer devterm-keyboard-firmware devterm-fan-temp-daemon-rpi devterm-thermal-printer-cups devterm-kernel-rpi devterm-audio-patch devterm-backlight-rpi -y
```
```
mkdir /etc/lightdm/lightdm.conf.d/ -p
sudo bash -c 'cat <<EOF >/etc/lightdm/lightdm.conf.d/99-cpi.conf
[SeatDefaults]
greeter-setup-script=/etc/lightdm/setup.sh
EOF'
sudo bash -c 'cat <<EOF >/etc/lightdm/setup.sh
#!/bin/bash
xrandr --output DSI-1 --rotate right
exit 0
EOF'
sudo chmod +x /etc/lightdm/setup.sh
sudo bash -c 'cat << EOF > /etc/X11/Xsession.d/100custom_xrandr
xrandr --output DSI-1 --rotate right
EOF'
```
`sudo apt-get install tasksel`
`sudo cp -f /lib/firmware/brcm/brcmfmac43456-sdio.raspberrypi,400.txt /lib/firmware/brcm/brcmfmac43456-sdio.txt`
`sudo apt install wiringpi`
`sudo ln -s /lib/arm-linux-gnueabihf/libwiringPi.so.2 /lib/arm-linux-gnueabihf/libwiringPi.so`
### Outside chroot
dd img to sd card
power on CM3
config the network
`sudo tasksel` to select desktop env to install

View File

@ -1,19 +0,0 @@
The GPIO on cm4 is different
| old | new |
|-----|-----|
| 28 | 18 |
| 29 | 19 |
| 30 | 20 |
| 31 | 21 |
| 32 | 14 |
| 33 | 15 |
| 34 | 24 |
| 35 | 25 |
| 36 | 26 |
| 37 | 27 |
| 38 | 6 |
| 39 | 7 |
| 40 | 16 |
| 41 | 17 |
| 43 | 23 |

View File

@ -1,71 +0,0 @@
# Prepare
Before everything
We assume that you have a Devterm with stock os running
and a little bit of Linux compiling experience
know how to install packages by package manager like apt
## WiringPi
### CM3 or CM4
```
sudo apt install -y wiringpi libwiringpi-dev libcups2-dev
```
### A06 A04
```
git clone https://github.com/clockworkpi/DevTerm.git
cd DevTerm/Code/devterm_wiringpi_cpi/
sudo ./build
#chose 0 or 1 depend which board you have
```
### R01
```
git clone https://github.com/clockworkpi/DevTerm.git
wget https://github.com/WiringPi/WiringPi/archive/refs/tags/final_official_2.50.tar.gz
tar zxvf final_official_2.50.tar.gz
cd WiringPi-final_official_2.50/
cp ../DevTerm/Code/patch/d1/wiringCP0329.patch .
git apply wiringCP0329.patch
sudo ./build
#Choice: 2
```
# Compile thermal printer driver code
```
git clone https://github.com/clockworkpi/DevTerm.git
cd DevTerm/Code/thermal_printer
make
sudo systemctl stop devterm-printer
sudo cp -rf devterm_thermal_printer.elf /usr/local/bin
sudo systemctl start devterm-printer
```
## Debug or run it from manually
1. setup socat socket for data receving for thermal printer
```
sudo systemctl stop devterm-printer #stop service
sudo systemctl stop devterm-socat #stop service
sudo socat -d -d pty,link=/tmp/DEVTERM_PRINTER_OUT,raw,echo=0 pty,link=/tmp/DEVTERM_PRINTER_IN,raw,echo=0
sudo ./usr/local/bin/devterm_socat.sh # <- this .sh file is in DevTerm/Code/thermal_printer/usr/local/bin/
```
1. run devterm_thermal_printer.elf
```
sudo ./devterm_thermal_printer.elf
```
now you can test the printer by cat or echo something into `/tmp/DEVTERM_PRINTER_IN`
eg: `echo "hello world\n\n\n\n\n\n\n\n\n\n" > /tmp/DEVTERM_PRINTER_IN
we recommend use [tmux](https://github.com/tmux/tmux/wiki) to do this job
so that you can run and see all the commands output in a single terminal window
## For CUPS
just install `devterm-thermal-printer-cups`
``` sudo apt install devterm-thermal-printer-cups```
this package will add a CUPS serial printer adapter,a CUPS filter for the DevTerm's thermal printer
and will let other programs to print content through image printing using DevTerm's thermal printer
source code is in https://github.com/clockworkpi/DevTerm/tree/main/Code/devterm_thermal_printer_cups
all devterm related deb packages available at
https://github.com/clockworkpi/apt

View File

@ -1,6 +0,0 @@
Welcome to the DevTerm wiki!
If you want to edit the wiki, just clone https://github.com/clockworkpi/DevTerm, and add markdown files to the **wiki** folder
Then Send Pull Request , once got merged, wiki will be shown at https://github.com/clockworkpi/DevTerm/wiki

View File

@ -1,26 +0,0 @@
# cool-retro-term
### Install the necessary packages:
#### CM3
```
sudo apt update
sudo apt install build-essential qmlscene qt5-qmake qt5-default qtdeclarative5-dev qml-module-qtquick-controls qml-module-qtgraphicaleffects qml-module-qtquick-dialogs qml-module-qtquick-localstorage qml-module-qtquick-window2 qml-module-qt-labs-settings qml-module-qt-labs-folderlistmodel
```
#### ubuntu (A06)
```
sudo apt update
sudo apt install build-essential qmlscene qt5-qmake qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools qtdeclarative5-dev qml-module-qtquick-controls qml-module-qtgraphicaleffects qml-module-qtquick-dialogs qml-module-qtquick-localstorage qml-module-qtquick-window2 qml-module-qt-labs-settings qml-module-qt-labs-folderlistmodel
```
### Compile (it takes about 30 minutes):
```
cd ~
git clone --recursive https://github.com/Swordfish90/cool-retro-term.git
cd cool-retro-term
git reset --hard dac2b4
qmake && make
cp -r qmltermwidget/src/qmldir qmltermwidget/lib/kb-layouts qmltermwidget/lib/color-schemes qmltermwidget/src/QMLTermScrollbar.qml qmltermwidget/QMLTermWidget
```
### Run
`./cool-retro-term --fullscreen`

View File

@ -1,54 +0,0 @@
## Env
VirtualBox with ubuntu 20.04
## Toolchain
https://github.com/raspberrypi/tools/tree/master/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin
## Get kernel
1. git clone https://github.com/raspberrypi/linux.git
1. cd linux
1. git checkout remotes/origin/rpi-4.19.y
1. git reset --hard cc39f1c9f82f6fe5a437836811d906c709e0661c
1. git apply [devterm-4.19_v0.1.patch](https://raw.githubusercontent.com/clockworkpi/DevTerm/main/Code/kernel/devterm-4.19_v0.1.patch)
## Compile
```
KERNEL=kernel7 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
KERNEL=kernel7 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j3
export INSTALL_MOD_PATH=./modules
rm -rf $INSTALL_MOD_PATH
make modules_install
rm $INSTALL_MOD_PATH/lib/modules/*/build
rm $INSTALL_MOD_PATH/lib/modules/*/source
```
## copy kernel to SD card
$1 is the sd card location (mount point)
```
export INSTALL_MOD_PATH=./modules
sudo cp -r $INSTALL_MOD_PATH/lib/modules $1/rootfs/lib/
cat config_a >> $1/boot/config.txt
cp arch/arm/boot/zImage $1/boot/kernel7.img
cp arch/arm/boot/dts/bcm2710-rpi-cm3.dtb $1/boot/bcm2710-rpi-cm3.dtb
cp arch/arm/boot/dts/overlays/*.dtbo $1/boot/overlays/
```
## config_a
```
ignore_lcd=1
dtoverlay=vc4-kms-v3d,audio=0,cma-384
dtoverlay=devterm-pmu
dtoverlay=devterm-panel
dtoverlay=devterm-wifi
dtoverlay=devterm-bt
dtoverlay=devterm-misc
gpio=5=op,dh
gpio=9=op,dh
gpio=10=ip,np
gpio=11=op,dh
enable_uart=1
```

View File

@ -1,25 +0,0 @@
usb-serial | keyboard IO number | keyboard IO register
-- | -- | --
3v3 | 3 | 3v3
TXD | 16 | PA10
RXD | 15 | PA9
GND | 1 | GND
USB | keyboard IO number | keyboard IO register
-- | -- | --
5v power | 5 | 5v
GND | 22 | GND
data + | 18 | PA12(USB_DP)
data - | 17 | PA11(USB_DM)
can not have USB and usb-serial both ON
sudo stm32flash -r devterm.kbd.0.3_48mhz.bin -S 0x08000000:65536 /dev/ttyUSB0
srec_cat devterm.kbd.0.3_48mhz.bin -Binary -offset 0x08000000 -output devterm.kbd.0.3_48mhz.hex -Intel
stm32flash -w devterm_kbd.bin -v -S 0x08000000 /dev/ttyUSB0
![WechatIMG50](https://user-images.githubusercontent.com/523580/186061860-02efc332-eae9-4200-ae37-c312af5d0f96.jpeg)

View File

@ -1,328 +0,0 @@
4G modem
# Packages
```
sudo apt install -y modemmmanager network-manager pppoe
```
# Power ON 4G ext(uconsole)
```
echo "pulling up gpio 34"
sudo gpio mode 34 out
sudo gpio write 34 1
echo "pulling up 33 to reset "
sudo gpio mode 33 out
sudo gpio write 33 1
sleep 5
sudo gpio write 33 0
echo "pulling back 33"
sleep 10
echo "done"
```
## cm4 version
```
sudo gpio mode 24 out
sudo gpio write 24 1
sudo gpio mode 15 out
sudo gpio write 15 1
sleep 5
sudo gpio write 15 0
```
## devterm 4G module
POWER 42
RESET 43
# Power OFF 4G ext(uconsole)
```
echo "Power off 4G module"
sudo gpio mode 34 out
sudo gpio write 34 0
sudo gpio write 34 1
sleep 3
sudo gpio write 34 0
sleep 10
echo "Done"
```
## cm4 version
```
echo "Power off 4G module"
sudo gpio mode 24 out
sudo gpio write 24 0
sudo gpio write 24 1
sleep 3
sudo gpio write 24 0
sleep 10
echo "Done"
```
## List modem
```
mmcli -L
```
/org/freedesktop/ModemManager1/Modem/0 [QUALCOMM INCORPORATED] SIMCOM_SIM7600G-H
## Enable modem
```
sudo mmcli -m 0 - e
```
## How to use nmcli to create a NetworkManager 4G connection
```
sudo nmcli c add type gsm ifname cdc-wdm0 con-name 4GNet apn yourapn gsm.username gsmusername gsm.password gsmpassword
```
replace **yourapn** and **gsmusername** with your carrier service
then we can see a `4GNet` in NetworkManager (like KDE's network manager UI)
I got the cdc-wdm0 from with **qmi_wwan** driver
```
mmcli -m 0 | grep "primary port"
```
it will be **ttyUSB2** if use **qcdm** driver
Now we can use **nmtui** to connect 4GNet
or
```
sudo nmcli connection up 4GNet
sudo nmcli connection down 4GNet
```
if everything is right ,you will have your **ppp0** in `sudo ifconfig`
Here is reference arguments I've used for nmcli
```
connection.id: Movistar
connection.uuid: acab2207-347a-424c-b366-b2c4ef4e4c75
connection.stable-id: --
connection.type: gsm
connection.interface-name: ttyAMA0
connection.autoconnect: no
connection.autoconnect-priority: 0
connection.autoconnect-retries: -1 (default)
connection.multi-connect: 0 (default)
connection.auth-retries: -1
connection.timestamp: 0
connection.read-only: no
connection.permissions: --
connection.zone: --
connection.master: --
connection.slave-type: --
connection.autoconnect-slaves: -1 (default)
connection.secondaries: --
connection.gateway-ping-timeout: 0
connection.metered: unknown
connection.lldp: default
connection.mdns: -1 (default)
connection.llmnr: -1 (default)
ipv4.method: auto
ipv4.dns: --
ipv4.dns-search: --
ipv4.dns-options: ""
ipv4.dns-priority: 0
ipv4.addresses: --
ipv4.gateway: --
ipv4.routes: --
ipv4.route-metric: -1
ipv4.route-table: 0 (unspec)
ipv4.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-timeout: 0 (default)
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: --
ipv4.dhcp-fqdn: --
ipv4.never-default: no
ipv4.may-fail: yes
ipv4.dad-timeout: -1 (default)
ipv6.method: auto
ipv6.dns: --
ipv6.dns-search: --
ipv6.dns-options: ""
ipv6.dns-priority: 0
ipv6.addresses: --
ipv6.gateway: --
ipv6.routes: --
ipv6.route-metric: -1
ipv6.route-table: 0 (unspec)
ipv6.ignore-auto-routes: no
ipv6.ignore-auto-dns: no
ipv6.never-default: no
ipv6.may-fail: yes
ipv6.ip6-privacy: -1 (unknown)
ipv6.addr-gen-mode: stable-privacy
ipv6.dhcp-duid: --
ipv6.dhcp-send-hostname: yes
ipv6.dhcp-hostname: --
ipv6.token: --
serial.baud: 115200
serial.bits: 8
serial.parity: none
serial.stopbits: 1
serial.send-delay: 0
ppp.noauth: yes
ppp.refuse-eap: no
ppp.refuse-pap: no
ppp.refuse-chap: no
ppp.refuse-mschap: no
ppp.refuse-mschapv2: no
ppp.nobsdcomp: no
ppp.nodeflate: no
ppp.no-vj-comp: no
ppp.require-mppe: no
ppp.require-mppe-128: no
ppp.mppe-stateful: no
ppp.crtscts: no
ppp.baud: 115200
ppp.mru: 0
ppp.mtu: auto
ppp.lcp-echo-failure: 0
ppp.lcp-echo-interval: 0
gsm.number: *99#
gsm.username: --
gsm.password: <hidden>
gsm.password-flags: 0 (none)
gsm.apn: internet.movistar.com.co
gsm.network-id: --
gsm.pin: <hidden>
gsm.pin-flags: 0 (none)
gsm.home-only: no
gsm.device-id: --
gsm.sim-id: --
gsm.sim-operator-id: --
gsm.mtu: auto
proxy.method: none
proxy.browser-only: no
proxy.pac-url: --
proxy.pac-script: --
```
if nmcli can not start the gsm connection with errors like Ipv4 stack ,dual-stack addressing not supported by the modem
that means we need to re-compile the kernel
requires all ppp driver in kernel
**Devices drivers ->Network device support**
and compile as *, not module
```
Linux Kernel Configuration
└─> Device Drivers
└─> USB support
└─> USB Wireless Device Management support
as module
```
```
Linux Kernel Configuration
└─> Device Drivers
└─> Network device support
└─> USB Network Adapters
└─> QMI WWAN driver for Qualcomm MSM based 3G and LTE modems
as module
```
on A06
```
sudo apt install pppoe
```
## In order to use SIMCOM_SIM7600G-H to call or receive calls
we have to blacklist some kernel modules
```
$ cat /etc/modprobe.d/blacklist-qmi.conf
blacklist qmi_wwan
blacklist cdc_wdm
```
```
mmcli -m 0 --messaging-list-sms
mmcli -m 0 --voice-list-calls
mmcli -m 0 --voice-create-call='number=xxxxxxxxxxxx'
mmcli -m 0 --voice-list-calls
mmcli -m 0 --start -o 0
mmcli -m 0 --accept -o 1
```
# Enable ModemManager debug
change `/etc/systemd/system/dbus-org.freedesktop.ModemManager1.service`
add --debug after `/usr/sbin/ModemManager`
```bash
...
[Service]
Type=dbus
BusName=org.freedesktop.ModemManager1
ExecStart=/usr/sbin/ModemManager --debug
StandardError=null
Restart=on-abort
...
```
Then
```
sudo systemctl daemon-reload
sudo systemctl restart ModemManager.service
```
## show audio levels
```
sudo mmcli -m 0 --command "AT+CLVL=?"
response: '+CLVL: (0-5)'
```
## show current levels
```
sudo mmcli -m 0 --command "AT+CLVL?"
response: '+CLVL: 4'
```
```
sudo mmcli -m 0 --command "AT+CLVL=5"
response: ''
```
```
sudo mmcli -m 0 --command "AT+CLVL=10"
error: command failed: 'GDBus.Error:org.freedesktop.ModemManager1.Error.MobileEquipment.Unknown: Unknown error'
```
## mute mic
```
sudo mmcli -m 0 --command "AT+CMUT=?"
response: '+CMUT: (0-1)'
```
```
sudo mmcli -m 0 --command "AT+CMUT?"
response: '+CMUT: 0'
```
```
Mute (but may need to be used during a call)
sudo mmcli -m 0 --command "AT+CMUT=1"
```
no ring volume
## Test signal
```
sudo mmcli -m any --signal-setup=10 # 10secs to refresh
sudo mmcli -m any # to see signal quality
```