Photonicat 编译 OpenWRT, Debian: Difference between revisions

From Photonicat Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Debian==
==Create Debian System Image (Rockchip Official)==


===Host System Requirements===
===Host System Requirements===
Debian 11 (bullseye) or Ubuntu 20.04.
Debian 11 (bullseye) or Ubuntu 20.04. with Memory >= 16GB and disk space >= 100GB.


===Compiling Requirements===
===Compiling Requirements===
Line 33: Line 33:
The output path is rockdev, system image path is rockdev/pack
The output path is rockdev, system image path is rockdev/pack


==Build Debian/Ubuntu system image (mainline u-boot & kernel)==
Check README in https://github.com/photonicat/rockchip_rk3568_linux_mainline for building system image.


 
==Build OpenWRT==
==OpenWRT==
Photonicat image contains following packages:
Photonicat image contains following packages:
# OpenWRT (within rk3568-linux-sdk which builds bootloader, uboot, kernel and OpenWRT)
# OpenWRT (within rk3568-linux-sdk which builds bootloader, uboot, kernel and OpenWRT)
Line 90: Line 91:
The output path is <code>bin/targets/rockchip/armv8/</code>, system image will be named like <code>photonicatwrt-23.04-rxxxx+xx-xxxxxxxxx-rockchip-armv8-ariaboard_photonicat-squashfs-sysupgrade.img.gz</code>
The output path is <code>bin/targets/rockchip/armv8/</code>, system image will be named like <code>photonicatwrt-23.04-rxxxx+xx-xxxxxxxxx-rockchip-armv8-ariaboard_photonicat-squashfs-sysupgrade.img.gz</code>


===Edit your menuconfig===
===Edit your menuconfig (Optional)===
<pre>
<pre>
make menuconfig
make menuconfig
Line 98: Line 99:


IPKs will be under: <pre>bin/targets/rockchip/armv8/packages/</pre>
IPKs will be under: <pre>bin/targets/rockchip/armv8/packages/</pre>
===Build your own package, modules on OpenWRT (Optional)===
Use <pre>make menuconfig</pre> to select <pre><M> package_name</pre> for your desired package(s).
If you want to include your own packages to system image, see OpenWRT official documents https://openwrt.org/docs/guide-developer/packages for help.
===Install pcat-manager-web on OpenWRT (Optional)===
If you want to use original Web management tool, you should change the port used by luci to 8080, edit /etc/config/uhttpd on device, change
<pre>
list listen_http '0.0.0.0:80'
list listen_http '[::]:80'
list listen_https '0.0.0.0:443'
list listen_https '[::]:443'
</pre>
to
<pre>
list listen_http '0.0.0.0:8080'
list listen_http '[::]:8080'
list listen_https '0.0.0.0:8443'
list listen_https '[::]:8443'
</pre>
Then install pcat-manager-web on device:
<pre>
cd /tmp
wget https://dl.photonicat.com/repos/openwrt/r2304/volatile/pcat-manager-web_1.0.22-19_aarch64_generic.ipk
opkg install pcat-manager-web_1.0.22-19_aarch64_generic.ipk
</pre>
Reboot your device to apply changes.


==Flash system images to the onboard eMMC==
==Flash system images to the onboard eMMC==
Prepare update tools and files:
<pre>
git clone https://github.com/rockchip-linux/rkdeveloptool.git
cd rkdeveloptool
sudo apt-get install libudev-dev libusb-1.0-0-dev dh-autoreconf
aclocal
autoreconf -i
autoheader
automake --add-missing
./configure
make
wget https://dl.photonicat.com/images/MiniLoaderAll.bin
</pre>
Refer: [[Photonicat_快速上手#4G/5G版本按键功能定义]] to enter the firmware update mode, use A-to-A cable to connect USB OTG port to PC, and use the command below:
Refer: [[Photonicat_快速上手#4G/5G版本按键功能定义]] to enter the firmware update mode, use A-to-A cable to connect USB OTG port to PC, and use the command below:
<pre>
<pre>
sudo tools/linux/Linux_Upgrade_Tool/Linux_Upgrade_Tool/upgrade_tool uf rockdev/pack/BOARDCONFIG-RK3568-PHOTONICAT-OPENWRT-DDR4-GPT-IMAGE_DATE-IMAGE_TIME.img #Replace IMAGE_DATE and IMAGE_TIME with the one you get.
gunzip photonicatwrt-23.04-rxxxx+xx-xxxxxxxxx-rockchip-armv8-ariaboard_photonicat-squashfs-sysupgrade.img.gz #Replace file name with the one you get indeed.
sudo ./rkdeveloptool db MiniLoaderAll.bin
sudo ./rkdeveloptool wl 0 photonicatwrt-23.04-rxxxx+xx-xxxxxxxxx-rockchip-armv8-ariaboard_photonicat-squashfs-sysupgrade.img
sudo ./rkdeveloptool rd
</pre>
</pre>


==Build your own package, modules==
 
use <pre>make menuconfig</pre> to select <pre><M> package_name</pre> for your desired package(s).
==How to modify your own version of kernel for openwrt==
Compile <code>rockchip_rk3568_openwrt</code> with above steps.
 
Modify:
*DTB: https://github.com/photonicat/rockchip_rk3568_openwrt/blob/master/target/linux/rockchip/files/arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts
*kernel patches: (we need to add/ modify your version of kernel patches into this dir and recompile): https://github.com/photonicat/rockchip_rk3568_openwrt/tree/master/target/linux/rockchip/patches-6.1
 
Recompile and done.

Latest revision as of 14:08, 30 April 2024

Create Debian System Image (Rockchip Official)

Host System Requirements

Debian 11 (bullseye) or Ubuntu 20.04. with Memory >= 16GB and disk space >= 100GB.

Compiling Requirements

On Debian/Ubuntu systems, install the packages:

sudo apt-get install build-essential flex bison genext2fs

Get Repo files by tarball(with .git)

wget https://dl.photonicat.com/repos/rk3568-debian-source-20220927.tar.xz

Install live build packages

Install live build packages if not installed yet:

sudo dpkg -i debian/ubuntu-build-service/packages/*.deb
sudo apt-get install -f

Config build target

Run the command below:

./rk3568-config-photonicat-debian.sh

Build system image

Run the command below:

./build.sh

The output path is rockdev, system image path is rockdev/pack

Build Debian/Ubuntu system image (mainline u-boot & kernel)

Check README in https://github.com/photonicat/rockchip_rk3568_linux_mainline for building system image.

Build OpenWRT

Photonicat image contains following packages:

  1. OpenWRT (within rk3568-linux-sdk which builds bootloader, uboot, kernel and OpenWRT)
  2. pcat-manager (within rk3568-linux-sdk)
  3. pcat-manager-web (python closed source. install manually: e.g: https://dl.photonicat.com/repos/openwrt/volatile/pcat-manager-web_1.0.9-0_aarch64_cortex-a53.ipk, we need to change luci listen port to 8080.)
  4. quectel-cm (within rk3568-linux-sdk)

rk3568-linux-sdk will fetch uboot, kernel, openwrt, and copmile them in one build script.

In addition to default packages we have 3 more package for power and modem manager.

  • modem/power_manager (written in c)
  • web interface for displaying mobile modem and battery info. (written in python)
  • c program modem watchdog

Host System Requirements

Debian 11 (bullseye) or Ubuntu 20.04, other distributions may work but not tested.

Compiling Requirements

Please a NORMAL USER, not root

On Debian/Ubuntu systems, install the packages:

sudo apt update
sudo apt upgrade -y
sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
   bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib \
   git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev \
   libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz \
   mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pyelftools \
   libpython3-dev qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip \
   vim wget xmlto xxd zlib1g-dev

Get repo files

Get repo files from Github (non-root user):

git clone https://github.com/photonicat/rockchip_rk3568_openwrt.git
cd rockchip_rk3568_openwrt

Config build target

Run the command below:

./scripts/feeds update -a                 
./scripts/feeds install -a                                                                        
cp ./configs/base_defconfig .config

Build system image

Run the command below:

make

The output path is bin/targets/rockchip/armv8/, system image will be named like photonicatwrt-23.04-rxxxx+xx-xxxxxxxxx-rockchip-armv8-ariaboard_photonicat-squashfs-sysupgrade.img.gz

Edit your menuconfig (Optional)

make menuconfig

save and re-run build process again.

IPKs will be under:

bin/targets/rockchip/armv8/packages/

Build your own package, modules on OpenWRT (Optional)

Use

make menuconfig

to select

<M> package_name

for your desired package(s).

If you want to include your own packages to system image, see OpenWRT official documents https://openwrt.org/docs/guide-developer/packages for help.

Install pcat-manager-web on OpenWRT (Optional)

If you want to use original Web management tool, you should change the port used by luci to 8080, edit /etc/config/uhttpd on device, change

	list listen_http '0.0.0.0:80'
	list listen_http '[::]:80'
	list listen_https '0.0.0.0:443'
	list listen_https '[::]:443'

to

	list listen_http '0.0.0.0:8080'
	list listen_http '[::]:8080'
	list listen_https '0.0.0.0:8443'
	list listen_https '[::]:8443'

Then install pcat-manager-web on device:

cd /tmp
wget https://dl.photonicat.com/repos/openwrt/r2304/volatile/pcat-manager-web_1.0.22-19_aarch64_generic.ipk
opkg install pcat-manager-web_1.0.22-19_aarch64_generic.ipk

Reboot your device to apply changes.

Flash system images to the onboard eMMC

Prepare update tools and files:

git clone https://github.com/rockchip-linux/rkdeveloptool.git
cd rkdeveloptool
sudo apt-get install libudev-dev libusb-1.0-0-dev dh-autoreconf
aclocal
autoreconf -i
autoheader
automake --add-missing
./configure
make
wget https://dl.photonicat.com/images/MiniLoaderAll.bin

Refer: Photonicat_快速上手#4G/5G版本按键功能定义 to enter the firmware update mode, use A-to-A cable to connect USB OTG port to PC, and use the command below:

gunzip photonicatwrt-23.04-rxxxx+xx-xxxxxxxxx-rockchip-armv8-ariaboard_photonicat-squashfs-sysupgrade.img.gz #Replace file name with the one you get indeed.
sudo ./rkdeveloptool db MiniLoaderAll.bin
sudo ./rkdeveloptool wl 0 photonicatwrt-23.04-rxxxx+xx-xxxxxxxxx-rockchip-armv8-ariaboard_photonicat-squashfs-sysupgrade.img
sudo ./rkdeveloptool rd


How to modify your own version of kernel for openwrt

Compile rockchip_rk3568_openwrt with above steps.

Modify:

Recompile and done.