mirror of
https://gitee.com/bianbu-linux/openwrt-docs
synced 2025-04-18 19:35:15 -04:00
Merge remote-tracking branch 'origin/main' into HEAD
This commit is contained in:
commit
4164f3eead
17 changed files with 887 additions and 0 deletions
91
.bianbu-ci.yml
Normal file
91
.bianbu-ci.yml
Normal file
|
@ -0,0 +1,91 @@
|
|||
variables:
|
||||
WEBSITE_NAME: "bianbu-linux-website"
|
||||
|
||||
default:
|
||||
image: "harbor.bianbu.xyz/gitlab/node:v2"
|
||||
before_script:
|
||||
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
|
||||
- eval $(ssh-agent -s)
|
||||
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
|
||||
- mkdir -p ~/.ssh
|
||||
- chmod 700 ~/.ssh
|
||||
- ssh-keyscan gitlab.dc.com >> ~/.ssh/known_hosts
|
||||
- chmod 644 ~/.ssh/known_hosts
|
||||
|
||||
stages:
|
||||
- test
|
||||
- review
|
||||
- release
|
||||
|
||||
pages:
|
||||
stage: test
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
BASE_URL: /-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/public/
|
||||
script:
|
||||
- echo "Downloading website code..."
|
||||
- git clone --depth 1 --recurse-submodules git@gitlab.dc.com:bianbu/$WEBSITE_NAME.git
|
||||
- cd $WEBSITE_NAME/submodules/$CI_PROJECT_NAME
|
||||
- git checkout $CI_COMMIT_SHORT_SHA
|
||||
- echo "Download complete."
|
||||
- echo "Compiling the code..."
|
||||
- cd ../..
|
||||
- npm --registry https://nexus.bianbu.xyz/repository/npmproxy/ install --no-strict-ssl
|
||||
- bash prepare.sh
|
||||
- npm run build
|
||||
- echo "Compile complete."
|
||||
- mv build ../public
|
||||
artifacts:
|
||||
paths:
|
||||
- public/
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
|
||||
test-job:
|
||||
stage: test
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
script:
|
||||
- echo "Downloading website code..."
|
||||
- git clone --depth 1 --recurse-submodules git@gitlab.dc.com:bianbu/$WEBSITE_NAME.git
|
||||
- cd $WEBSITE_NAME/submodules/$CI_PROJECT_NAME
|
||||
- git checkout $CI_COMMIT_SHORT_SHA
|
||||
- echo "Download complete."
|
||||
- echo "Testing the code whether it can be compiled..."
|
||||
- cd ../..
|
||||
- npm --registry https://nexus.bianbu.xyz/repository/npmproxy/ install --no-strict-ssl
|
||||
- bash prepare.sh
|
||||
- npm run build
|
||||
- echo "Test complete."
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "main"
|
||||
|
||||
review-job:
|
||||
stage: review
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
needs:
|
||||
- job: test-job
|
||||
trigger:
|
||||
project: bianbu/$WEBSITE_NAME
|
||||
branch: main
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "main"
|
||||
|
||||
release-job:
|
||||
stage: release
|
||||
variables:
|
||||
GIT_STRATEGY: clone
|
||||
GIT_DEPTH: 0
|
||||
script:
|
||||
- 'command -v nc >/dev/null || ( apt-get update -y && apt-get install ncat -y )'
|
||||
- export GIT_SSH_COMMAND='ssh -o ProxyCommand="nc -X connect -x proxy1.dc.com:1080 %h %p" -o StrictHostKeyChecking=no'
|
||||
- git config --global user.name "Bianbu-CI"
|
||||
- git config --global user.email "bianbu-ci@spacemit.com"
|
||||
- git remote add gitee git@gitee.com:bianbu-linux/$CI_PROJECT_NAME.git
|
||||
- git fetch gitee
|
||||
- git checkout gitee/main
|
||||
- git merge --no-ff --no-edit origin/main
|
||||
- git push gitee HEAD:main
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
58
en/README.md
Normal file
58
en/README.md
Normal file
|
@ -0,0 +1,58 @@
|
|||
---
|
||||
slug: /
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Intro
|
||||
|
||||
BSP based on native OpenWrt 23.05(*bl-v2.0.y based on master*) integrated Spacemit Stone series chips, including supervisory program interface (OpenSBI), boot loader (U-Boot/UEFI), Linux kernel, root file system (including various middleware and libraries), and examples.Its goal is to provide customers with soft routing and NAS scheme support, and can develop drivers or applications.
|
||||
|
||||
## Main component
|
||||
|
||||
Here are the components of OpenWrt::
|
||||
|
||||
- OpenSBI
|
||||
- U-Boot
|
||||
- Linux Kernel
|
||||
- mpp: Media Process Platform
|
||||
- FFmpeg (with Hardware Accelerated)
|
||||
|
||||
More components are being adapted
|
||||
|
||||
- onnxruntime (with Hardware Accelerated)
|
||||
- ai-support: AI demo
|
||||
- k1x-vpu-firmware: Video Process Unit firmware
|
||||
- k1x-vpu-test: Video Process Unit test program
|
||||
- k1x-jpu: JPEG Process Unit API
|
||||
- GStreamer (with Hardware Accelerated)
|
||||
|
||||
## Quick guide
|
||||
|
||||
- [Download and compile](openwrt_quickstart.md)
|
||||
- [Device management](openwrt_device_management.md)
|
||||
- [Solution Management](openwrt_solution_management.md)
|
||||
|
||||
## Advanced Develope guide
|
||||
|
||||
[system develope guide](https://bianbu-linux.spacemit.com/development_guide)
|
||||
|
||||
## Precompile
|
||||
|
||||
[Spacemit OpenWrt source site](https://archive.spacemit.com/openwrt/releases/[branch])
|
||||
|
||||
[BPI-F3、MUSE-Pi image](https://archive.spacemit.com/openwrt/releases/23.05.2/targets/spacemit/DEVICE_debX/openwrt-spacemit-k1-sbc-debX-ext4-pack.zip)
|
||||
|
||||
[MUSE-N1 image](https://archive.spacemit.com/openwrt/releases/23.05.2/targets/spacemit/DEVICE_MUSE-N1/openwrt-spacemit-k1-nas-MUSE-N1-ext4-pack.zip)
|
||||
|
||||
## Supported device list
|
||||
|
||||
The following hardware devices are currently supported:
|
||||
|
||||
### SBC Solution
|
||||
|
||||
- BPI-F3
|
||||
- [MUSE Pi](supported_devices/muse_pi.md)
|
||||
|
||||
### NAS Solution
|
||||
|
||||
- [MUSE N1](supported_devices/muse_n1.md)
|
206
en/openwrt_device_management.md
Normal file
206
en/openwrt_device_management.md
Normal file
|
@ -0,0 +1,206 @@
|
|||
---
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
# Device Management
|
||||
|
||||
The following document introduces how to achieve adaptive devices (board types) via EEPROM, including how to add support for new board types and implement adaptive booting.
|
||||
|
||||
In subsequent documentation, the terms "device" and "board type" are used interchangeably.
|
||||
|
||||
## Adding a New Device
|
||||
|
||||
The following uses the addition of the k1-x_MUSE-Pi board type as an example.
|
||||
|
||||
### Kernel Device Tree
|
||||
|
||||
If you refer to the design of the deb1 hardware, copy `k1-x_deb1.dts` to the following file and modify the relevant content:
|
||||
|
||||
```sh
|
||||
target/linux/spacemit/dts/k1-x_MUSE-Pi.dts
|
||||
|
||||
```
|
||||
|
||||
For the newly added board type, the .dts files are stored in the above directory. They are packed into the bootfs partition during compilation and loaded by U-Boot before the kernel boots.
|
||||
|
||||
### U-Boot Device Tree
|
||||
|
||||
To add a new board type, you need to modify the U-Boot source code repository as follows:
|
||||
|
||||
1.Add the U-Boot device tree `u-boot-2022.10/arch/riscv/dts/k1-x_MUSE-Pi.dts`.
|
||||
2.Modify the Makefile to include k1-x_MUSE-Pi.dtb as follows: (Note that the suffix should be changed to .dtb).
|
||||
|
||||
```diff
|
||||
11 dtb-$(CONFIG_TARGET_SPACEMIT_K1X) += k1-x_evb.dtb k1-x_deb2.dtb k1-x_deb1.dtb k1-x_hs450.dtb \
|
||||
12 k1-x_kx312.dtb k1-x_MINI-PC.dtb k1-x_mingo.dtb k1-x_MUSE-N1.dtb \
|
||||
13 k1-x_MUSE-Pi.dtb k1-x_spl.dtb k1-x_milkv-jupiter.dtb \
|
||||
14 k1-x_MUSE-Book.dtb
|
||||
15
|
||||
```
|
||||
|
||||
3.modify `uboot-2022.10/board/spacemit/k1-x/configs/uboot_fdt.its`, add new node:
|
||||
|
||||
```diff
|
||||
@@ -46,15 +46,6 @@
|
||||
|
||||
algo = "crc32";
|
||||
};
|
||||
};
|
||||
+ fdt_4 {
|
||||
+ description = "k1-x_MUSE-Pi";
|
||||
+ type = "flat_dt";
|
||||
+ compression = "none";
|
||||
+ data = /incbin/("../dtb/1-x_MUSE-Pi.dtb");
|
||||
+ hash-1 {
|
||||
+ algo = "crc32";
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
configurations {
|
||||
@@ -74,10 +65,5 @@
|
||||
loadables = "uboot";
|
||||
fdt = "fdt_3";
|
||||
};
|
||||
+ conf_4 {
|
||||
+ description = "k1-x_MUSE-Pi";
|
||||
+ loadables = "uboot";
|
||||
+ fdt = "fdt_4";
|
||||
+ };
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
4.Modify `uboot-2022.10/include/configs/k1-x.h` and update `DEFAULT_PRODUCT_NAME`. FSBL and U-Boot will, by default, load the dtb based on `DEFAULT_PRODUCT_NAME`. If the board has an EEPROM that records information such as product_name, then this takes precedence, and FSBL and U-Boot will use the information from the EEPROM to achieve adaptive booting.
|
||||
|
||||
```diff
|
||||
@@ -25,7 +25,7 @@
|
||||
#define CONFIG_GATEWAYIP 10.0.92.1
|
||||
#define CONFIG_NETMASK 255.255.255.0
|
||||
|
||||
-#define DEFAULT_PRODUCT_NAME "k1_deb1"
|
||||
+#define DEFAULT_PRODUCT_NAME "k1-x_MUSE-Pi"
|
||||
|
||||
#define K1X_SPL_BOOT_LOAD_ADDR (0x20200000)
|
||||
#define DDR_TRAINING_DATA_BASE (0xc0829000)
|
||||
```
|
||||
|
||||
### Add Support for New Board
|
||||
|
||||
If it is a development board form factor, modify `openwrt/target/linux/spacemit/image/k1-sbc.mk` to add support for the `k1-x_MUSE-Pi` board type.
|
||||
|
||||
```sh
|
||||
DEVICE_DTS := k1-x_deb1 k1-x_MUSE-Pi
|
||||
|
||||
```
|
||||
|
||||
If you need to add a new configuration, please refer to[solution management](openwrt_solution_management.md)
|
||||
|
||||
## Support Single CS DDR
|
||||
|
||||
By default, FSBL supports dual CS DDR. To enable support for single CS DDR, modify uboot-2022.10/arch/riscv/dts/k1-x_spl.dts.
|
||||
|
||||
```diff
|
||||
@@ -79,7 +79,7 @@
|
||||
ddr@c0000000 {
|
||||
/* dram data rate, should be 1200, 1600, or 2400 */
|
||||
datarate = <2400>;
|
||||
- cs-num = <2>;
|
||||
+ cs-num = <1>;
|
||||
u-boot,dm-spl;
|
||||
};
|
||||
```
|
||||
|
||||
If the device has an EEPROM, adaptive support can be achieved through the EEPROM. The corresponding key name is `ddr_cs_num`, which can be programmed using the titantools utility. For details on the flashing tool, please refer to the documentation at [flash tools](https://developer.spacemit.com/documentation?token=O6wlwlXcoiBZUikVNh2cczhin5d)
|
||||
|
||||
## Adaptive Booting via EEPROM
|
||||
|
||||
Use the Titanflasher tool to program the EEPROM of the board, enabling adaptive booting, i.e., one firmware supports multiple boards.
|
||||
|
||||
During system startup, the information in the EEPROM is read and matched with the information in uboot_fdt.its, thereby supporting multiple board types.
|
||||
|
||||
Relevant Files:
|
||||
|
||||
```shell
|
||||
uboot-2022.10/arch/riscv/dts/k1-x_spl.dts
|
||||
uboot-2022.10/arch/riscv/dts/k1-x_*.dts
|
||||
```
|
||||
|
||||
### EEPROM Support List
|
||||
|
||||
- `atmel,24c02`
|
||||
|
||||
### Add New EEPROM
|
||||
|
||||
1.Modify `uboot-2022.10/arch/riscv/dts/k1-x_spl.dts`, Update the I2C address of the EEPROM, for example, the new address is `0xA0`.
|
||||
|
||||
```c
|
||||
@@ -121,7 +121,7 @@
|
||||
eeprom@50{
|
||||
compatible = "atmel,24c02";
|
||||
u-boot,dm-spl;
|
||||
reg = <0x50>;
|
||||
reg = <0xA0>;
|
||||
bus = <6>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
```
|
||||
|
||||
2.Modify `uboot-2022.10/arch/riscv/dts/k1-x_*.dts`, add new eeprom config:
|
||||
|
||||
```c
|
||||
@@ -60,9 +60,9 @@
|
||||
pinctrl-0 = <&pinctrl_i2c2_0>;
|
||||
status = "okay";
|
||||
|
||||
- eeprom@50{
|
||||
- compatible = "atmel,24c02";
|
||||
- reg = <0x50>;
|
||||
+ eeprom@A0{
|
||||
+ compatible = "atmel,24c04";
|
||||
+ reg = <0xA0>;
|
||||
vin-supply-names = "eeprom_1v8";
|
||||
status = "okay";
|
||||
};
|
||||
```
|
||||
|
||||
### Use tlv_eeprom command to write key
|
||||
|
||||
Writing to the EEPROM involves storing information such as `product_name`. Currently, the data in the EEPROM is encoded using TLV format, and you can use the `tlv_eeprom` command provided by u-boot to perform this operation.
|
||||
|
||||
1. Connect your PC to the device's debug serial port. During boot-up, press the `s` key on the PC terminal to enter the u-boot shell.
|
||||
|
||||
```shell
|
||||
Autoboot in 0 seconds
|
||||
=>
|
||||
```
|
||||
|
||||
2. write `product_name`,such as `k1-x_MUSE-Pi`。
|
||||
|
||||
```shell
|
||||
=> tlv_eeprom set 0x21 k1-x_MUSE-Pi
|
||||
=> tlv_eeprom write
|
||||
Programming passed.
|
||||
```
|
||||
|
||||
`Programming passed.` meaning write key success.
|
||||
|
||||
Use the name of the device’s DTS file (without the extension, e.g., k1-x_MUSE-Pi) to facilitate automatic loading of the DTB by u-boot.
|
||||
|
||||
3. reboot device and check if the `k1-x_MUSE-Pi` DTB can be loaded. If everything is normal, u-boot should print the following:
|
||||
|
||||
```shell
|
||||
Boot from fit configuration: k1-x_MUSE-Pi
|
||||
```
|
||||
|
||||
The SDK also supports reading the following information from the EEPROM:
|
||||
|
||||
- Serial Number:`0x23`
|
||||
- Base MAC Address:`0x24`
|
||||
- Manufacture Date:`0x25`
|
||||
- Device Version:`0x26`
|
||||
- MAC Addresses:`0x2A`
|
||||
- Manufacturer:`0x2B`
|
||||
- SDK Version:`0x40`
|
||||
|
||||
The MAC Address will be updated in the DTB and used as the network card’s physical address.
|
265
en/openwrt_quickstart.md
Normal file
265
en/openwrt_quickstart.md
Normal file
|
@ -0,0 +1,265 @@
|
|||
---
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
# Download and Build
|
||||
|
||||
The following document is based on Ubuntu 22.04.
|
||||
|
||||
## Environment Preparation
|
||||
|
||||
### Installing Dependencies
|
||||
|
||||
```sh
|
||||
sudo apt install build-essential clang flex bison g++ gawk \
|
||||
gcc-multilib g++-multilib gettext git libncurses-dev libssl-dev \
|
||||
python3-distutils rsync unzip zlib1g-dev file wget jq device-tree-compiler
|
||||
|
||||
```
|
||||
|
||||
## Download openwrt
|
||||
|
||||
The code repository has two branches:` bl-v1.0.y` and `bl-v2.0.y`, which correspond to `linux-6.1` and `linux-6.6`, respectively. The `bl-v2.0.y` branch will be primarily maintained going forward.
|
||||
|
||||
```sh
|
||||
git clone https://gitee.com/bianbu-linux/openwrt.git -b bl-v2.0.y
|
||||
|
||||
```
|
||||
|
||||
## 拉取feeds
|
||||
|
||||
Use the following commands to run or update packages. Package updates will be downloaded from the OpenWRT official website, so ensure that your network is accessible. If there are any failures in downloading certain packages, you can re-run the commands:
|
||||
|
||||
```sh
|
||||
cd openwrt
|
||||
./scripts/feeds update -a
|
||||
./scripts/feeds install -f -p spacemit_openwrt_feeds -a
|
||||
./scripts/feeds install -a
|
||||
```
|
||||
|
||||
## Firmware Compilation
|
||||
|
||||
The optional parameter `V=s` in the compilation command provides detailed logs. Currently, there are two options for initiating the compilation process.
|
||||
|
||||
### SBC Solution
|
||||
|
||||
```sh
|
||||
cp feeds/spacemit_openwrt_feeds/spacemit_k1_defconfig .config
|
||||
make -j12 V=s
|
||||
```
|
||||
|
||||
image would create at `bin/targets/spacemit/DEVICE_debX/*.zip`
|
||||
|
||||
### NAS Solution
|
||||
|
||||
```sh
|
||||
cp feeds/spacemit_openwrt_feeds/spacemit_k1_nas_defconfig .config
|
||||
make -j12 V=s
|
||||
```
|
||||
|
||||
image would create at `bin/targets/spacemit/DEVICE_MUSE-N1/*.zip`
|
||||
|
||||
### Cleaning
|
||||
|
||||
* The full cleanup command will delete directories such as `bin, build_dir, staging_dir, feeds, dl`, as well as the `.config` file, returning the code repository to its original state.
|
||||
|
||||
```sh
|
||||
make distclean
|
||||
```
|
||||
|
||||
* The partial cleanup command will delete the build output directories such as `bin, build_dir, staging_dir`, but it will not remove the dl directory, the `.config` file, or other similar files.
|
||||
|
||||
```sh
|
||||
make dirclean
|
||||
```
|
||||
|
||||
## single package compilation
|
||||
|
||||
### build uboot
|
||||
|
||||
* compile
|
||||
|
||||
```sh
|
||||
make package/boot/uboot-spacemit/compile V=s
|
||||
```
|
||||
|
||||
* clean
|
||||
|
||||
```sh
|
||||
make package/boot/uboot-spacemit/clean V=s
|
||||
```
|
||||
|
||||
### build opensbi
|
||||
|
||||
* compile
|
||||
|
||||
```sh
|
||||
make package/boot/opensbi-spacemit/compile V=s
|
||||
```
|
||||
|
||||
* clean
|
||||
|
||||
```sh
|
||||
make package/boot/opensbi-spacemit/clean V=s
|
||||
```
|
||||
|
||||
### build linux
|
||||
|
||||
* compile
|
||||
|
||||
```sh
|
||||
make target/linux/compile V=s
|
||||
```
|
||||
|
||||
* clean
|
||||
|
||||
```sh
|
||||
make target/linux/clean V=s
|
||||
```
|
||||
|
||||
### build adb package
|
||||
|
||||
The compilation process for other packages is similar to the following method.
|
||||
|
||||
* compile
|
||||
|
||||
```sh
|
||||
make package/utils/adb/compile V=s
|
||||
```
|
||||
|
||||
* clean
|
||||
|
||||
```sh
|
||||
make package/utils/adb/clean V=s
|
||||
```
|
||||
|
||||
## Flashing
|
||||
|
||||
Firmware `*.zip`: Use the Titan Flasher tool to flash it to the onboard storage of the device. For instructions on using the flashing tool, see [flash tools](https://developer.spacemit.com/documentation?token=O6wlwlXcoiBZUikVNh2cczhin5d)
|
||||
|
||||
Firmware `*sdcard.img`: Can be written to the card using the `dd` command. The device can boot from the card once it is inserted and powered on.
|
||||
|
||||
## Supported Devices List
|
||||
|
||||
### SBC Solutions
|
||||
|
||||
* BPI-F3
|
||||
* MUSE-Pi
|
||||
|
||||
### NAS Solutions
|
||||
|
||||
* MUSE-N1
|
||||
|
||||
## Soft Router Functionality
|
||||
|
||||
The soft router function is enabled by default on the board types in the supported devices list. When the system boots up, the WiFi AP mode is activated by default. Specifically:
|
||||
|
||||
For SBC solutions: The wired network card eth1 is the LAN port, and eth2 is the WAN port.
|
||||
|
||||
For NAS solutions: The 2.5G wired network card is the WAN port, and the other two Gigabit ports are LAN ports.
|
||||
|
||||
* Hotspot Name:openWRT-AP
|
||||
* Hotspot Password:12345678
|
||||
* WiFi Gateway:192.168.1.1
|
||||
|
||||
## FAQ
|
||||
|
||||
### Error with pthread_once during kernel compilation
|
||||
|
||||
When compiling OpenWRT based on Ubuntu 20.04, an error with "pthread_once" may occur. This can be resolved by modifying the `linux-*/certs/Makefile`.
|
||||
|
||||
```C
|
||||
//openwrt/build_dir/target-riscv64_riscv64_musl_*/linux-spacemit_*/linux-6.1.15/certs/Makefile
|
||||
# Change the last line to:
|
||||
HOSTLDLIBS_extract-cert = -lcrypto -pthread
|
||||
```
|
||||
|
||||
### How to Update U-Boot/OpenSBI/Linux Versions
|
||||
|
||||
1.OpenWRT tracks the versions of the U-Boot/OpenSBI/Linux repositories hosted on `https://gitee.com/bianbu-linux`. OpenWRT periodically updates these repository versions.
|
||||
|
||||
2.If you need to manually update to the latest versions of U-Boot/OpenSBI/Linux, follow these steps:
|
||||
|
||||
* Confirm that the latest version tarball has been uploaded to`https://archive.spacemit.com/openwrt/dl/`,such as `linux-6.1-v1.0.15.tar.xz`
|
||||
|
||||

|
||||
|
||||
* Changing the Version Number in the Makefile
|
||||
|
||||
```diff
|
||||
diff --git a/package/boot/opensbi-spacemit/Makefile b/package/boot/opensbi-spacemit/Makefile
|
||||
index d4572af253..208d2fae6d 100644
|
||||
--- a/package/boot/opensbi-spacemit/Makefile
|
||||
+++ b/package/boot/opensbi-spacemit/Makefile
|
||||
@@ -16,7 +16,7 @@ else
|
||||
PKG_NAME:=opensbi
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.3
|
||||
-PKG_SOURCE_VERSION:=1.0.5
|
||||
+PKG_SOURCE_VERSION:=v1.0.15
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://archive.spacemit.com/openwrt/dl/
|
||||
diff --git a/package/boot/uboot-spacemit/Makefile b/package/boot/uboot-spacemit/Makefile
|
||||
index 51e6e97fb7..c69173cfa8 100644
|
||||
--- a/package/boot/uboot-spacemit/Makefile
|
||||
+++ b/package/boot/uboot-spacemit/Makefile
|
||||
@@ -18,7 +18,7 @@ else
|
||||
PKG_NAME:=uboot
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=2022.10
|
||||
-PKG_SOURCE_VERSION:=1.0.5
|
||||
+PKG_SOURCE_VERSION:=v1.0.15
|
||||
|
||||
PKG_SOURCE:=uboot-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://archive.spacemit.com/openwrt/dl/
|
||||
|
||||
diff --git a/target/linux/spacemit/Makefile b/target/linux/spacemit/Makefile
|
||||
index ac230af366..148e5a79b8 100644
|
||||
--- a/target/linux/spacemit/Makefile
|
||||
+++ b/target/linux/spacemit/Makefile
|
||||
@@ -20,7 +20,7 @@ CONFIG_EXTERNAL_KERNEL_TREE=$(TOPDIR)/../bsp-src/linux-6.1
|
||||
CONFIG_KERNEL_GIT_CLONE_URI=""
|
||||
else
|
||||
## download tar.xz from url.
|
||||
-LINUX_VERSION_CUSTOM:=linux-6.1-1.0.5
|
||||
+LINUX_VERSION_CUSTOM:=linux-6.1-v1.0.15
|
||||
LINUX_SOURCE:=$(LINUX_VERSION_CUSTOM).tar.xz
|
||||
LINUX_KERNEL_HASH:=skip
|
||||
endif
|
||||
|
||||
```sh
|
||||
* update kernel config
|
||||
|
||||
```sh
|
||||
make kernel_menuconfig
|
||||
```
|
||||
|
||||
* compile
|
||||
|
||||
There might be failures. If the compilation encounters errors, please correct them based on the error messages.
|
||||
|
||||
```sh
|
||||
make -j12 V=s
|
||||
```
|
||||
|
||||
### Change the Download Source to Spacemit
|
||||
|
||||
Spacemit maintains a set of pre-compiled packages that can be downloaded and installed by changing the source.
|
||||
|
||||
* Modify the software source address (based on device modifications):
|
||||
|
||||
`bl-v2.0.y` is a specific version tag. Please modify it according to your needs.
|
||||
If using the SBC solution, change `DEVICE_MUSE-N1` to `DEVICE_debX`.
|
||||
|
||||
```sh
|
||||
//vim /etc/opkg/distfeeds.conf
|
||||
|
||||
src/gz openwrt_base https://archive.spacemit.com/openwrt/releases/bl-v2.0.y/packages/riscv64_riscv64/base
|
||||
src/gz openwrt_luci https://archive.spacemit.com/openwrt/releases/bl-v2.0.y/packages/riscv64_riscv64/luci
|
||||
src/gz openwrt_packages https://archive.spacemit.com/openwrt/releases/bl-v2.0.y/packages/riscv64_riscv64/packages
|
||||
src/gz openwrt_routing https://archive.spacemit.com/openwrt/releases/bl-v2.0.y/packages/riscv64_riscv64/routing
|
||||
src/gz openwrt_telephony https://archive.spacemit.com/openwrt/releases/bl-v2.0.y/packages/riscv64_riscv64/telephony
|
||||
src/gz openwrt_spacemit_packages https://archive.spacemit.com/openwrt/releases/bl-v2.0.y/targets/spacemit/DEVICE_MUSE-N1/packages
|
||||
|
||||
```
|
245
en/openwrt_solution_management.md
Normal file
245
en/openwrt_solution_management.md
Normal file
|
@ -0,0 +1,245 @@
|
|||
---
|
||||
sidebar_position: 4
|
||||
---
|
||||
|
||||
|
||||
|
||||
# Solution Management
|
||||
|
||||
This document introduces the management of solutions for the OpenWrt SDK. Currently, the released SDK defaults to supporting the k1-sbc and k1-nas solutions. Each solution supports multiple board types; for example, the k1-sbc solution supports the k1-x_MUSE-Pi and k1-x_deb1 board types. Future updates will continue to be released.
|
||||
|
||||
## Solution Overview
|
||||
|
||||
Using the development board solution k1-sbc as an example, it typically involves the following configuration files, which will be introduced in subsequent chapters.
|
||||
|
||||
```sh
|
||||
#Solution Configuration
|
||||
feeds/spacemit_openwrt_feeds/spacemit_k1_defconfig
|
||||
|
||||
#olution Compilation Entry Point
|
||||
openwrt/target/linux/spacemit/Makefile
|
||||
|
||||
#Solution Definition
|
||||
openwrt/target/linux/spacemit/k1-sbc/config-6.1
|
||||
openwrt/target/linux/spacemit/k1-sbc/target.mk
|
||||
openwrt/target/linux/spacemit/k1-sbc/base-files/
|
||||
|
||||
#Solution Device Tree Management
|
||||
openwrt/target/linux/spacemit/dts/
|
||||
|
||||
#Solution Boot Parameters
|
||||
openwrt/target/linux/spacemit/image/env_k1-x.txt
|
||||
|
||||
#Firmware Definition
|
||||
openwrt/target/linux/spacemit/image/k1-sbc.mk
|
||||
#Firmware Partitions for the Solution
|
||||
openwrt/target/linux/spacemit/image/partition_tables/partition_2M.json
|
||||
openwrt/target/linux/spacemit/image/partition_tables/partition_flash.json
|
||||
openwrt/target/linux/spacemit/image/partition_tables/partition_universal.json
|
||||
|
||||
#Initial Setup Configuration for the Solution
|
||||
openwrt/target/linux/spacemit/base-files/etc/uci-defaults/
|
||||
```
|
||||
|
||||
### Configuration for the Solution
|
||||
|
||||
`feeds/spacemit_openwrt_feeds/spacemit_k1_defconfig`
|
||||
|
||||
This is the build configuration for the k1-sbc solution, used to guide the compilation behavior of OpenWrt.
|
||||
|
||||
### Makefile for the Solution
|
||||
|
||||
`openwrt/target/linux/spacemit/Makefile`
|
||||
|
||||
Add the name of the solution to SUBTARGETS:
|
||||
|
||||
```c
|
||||
...
|
||||
12 SUBTARGETS:=k1-nas k1-sbc
|
||||
...
|
||||
```
|
||||
|
||||
### Directory for the Solution
|
||||
|
||||
`openwrt/target/linux/spacemit/k1-sbc`
|
||||
|
||||
Create a directory with the same name as the solution: k1-sbc, containing the following:
|
||||
|
||||
* openwrt/target/linux/spacemit/k1-sbc/config-6.1
|
||||
|
||||
`config-6.1` is the kernel configuration for this solution. When compiling the kernel, merge `openwrt/target/linux/generic/config-6.1` with this solution's `config-6.1`, giving priority to the options in this solution.
|
||||
|
||||
* openwrt/target/linux/spacemit/k1-sbc/target.mk
|
||||
|
||||
Defines general information for the solution, such as `DEVICE_TYPE:=router` (optional values include router, nas). This is defined by OpenWrt, where different device types include different default packages.
|
||||
|
||||
* openwrt/target/linux/spacemit/k1-sbc/base-files/
|
||||
|
||||
Contains configuration files to be packaged into the root file system, such as:
|
||||
|
||||
```sh
|
||||
openwrt/target/linux/spacemit/k1-sbc/base-files$ tree
|
||||
.
|
||||
├── etc
|
||||
│ ├── board.d
|
||||
│ │ ├── 01_leds
|
||||
│ │ └── 02_network
|
||||
│ ├── hostapd.conf
|
||||
│ ├── hosts
|
||||
│ ├── init.d
|
||||
│ │ └── custom_wifi_ap
|
||||
│ └── inittab
|
||||
├── lib
|
||||
│ ├── preinit
|
||||
│ │ └── 79_move_config
|
||||
│ └── upgrade
|
||||
│ └── platform.sh
|
||||
└── usr
|
||||
└── bin
|
||||
├── uas-gadget2-bot.sh
|
||||
├── uas-gadget2.sh
|
||||
└── uas-gadget3.sh
|
||||
|
||||
8 directories, 11 files
|
||||
```
|
||||
|
||||
### Device Tree for the Solution
|
||||
|
||||
`openwrt/target/linux/spacemit/dts/`
|
||||
|
||||
Kernel device trees for different board types. You can refer to[device management](openwrt_device_management.md)to add support for a new board type.
|
||||
|
||||
### Partition Table for the Solution
|
||||
|
||||
`openwrt/target/linux/spacemit/image/partition_tables/`
|
||||
|
||||
The partition tables here are shared among multiple solutions. They contain configurations for different storage media.
|
||||
|
||||
You can also add a partition table that matches the capacity of the onboard storage medium, which will be automatically matched when using the TitanFlasher tool to flash the firmware.
|
||||
|
||||
* partition_2M.json,Used for NOR flash booting, typically paired with eMMC/SSD block devices.
|
||||
* partition_universal.json,Used for booting from block devices.
|
||||
* partition_flash.json,Used for mass production with the spacemit Titanflasher tool.
|
||||
|
||||
Modifying the partition table may affect the normal boot process of the system. For detailed modification procedures, please refer to the documentation on [boot develepment docs](https://bianbu-linux.spacemit.com/development_guide/boot).
|
||||
|
||||
### Boot Parameters for the Solution
|
||||
|
||||
`openwrt/target/linux/spacemit/image/env_k1-x.txt`
|
||||
|
||||
U-Boot environment variables with the highest priority. Here you can set boot arguments (bootargs), log level, etc.
|
||||
|
||||
The default bootargs are:
|
||||
|
||||
```sh
|
||||
commonargs=setenv bootargs earlycon=${earlycon} earlyprintk console=tty1 console=${console} loglevel=${loglevel} clk_ignore_unused swiotlb=65536 rdinit=${init}
|
||||
```
|
||||
|
||||
You can redefine environment variables such as `earlycon, console, loglevel, and init` in `env_k1-x.txt`.
|
||||
|
||||
```sh
|
||||
# Common parameter
|
||||
earlycon=sbi
|
||||
console=ttyS0,115200
|
||||
init=/init
|
||||
bootdelay=0
|
||||
loglevel=8
|
||||
|
||||
```
|
||||
|
||||
Alternatively, you can redefine the entire bootargs.
|
||||
|
||||
```sh
|
||||
bootargs=earlycon=sbi console=ttyS0,115200 loglevel=4
|
||||
|
||||
```
|
||||
|
||||
### Firmware for the Solution
|
||||
|
||||
`openwrt/target/linux/spacemit/image/k1-sbc.mk`
|
||||
|
||||
This Makefile configures the firmware compilation for the solution, including supported board types, generating sdcard.img, and creating the spacemit.zip flashing package.
|
||||
|
||||
For example, if you do not want to generate sdcard.img, you can remove sdcard-img from `IMAGE/pack.zip`.
|
||||
|
||||
If you want to add support for the MUSE-Pi board type in this solution, then add the device tree name `k1-x_MUSE-Pi`to DEVICE_DTS.
|
||||
|
||||
Additionally, there should be a file named `k1-x_MUSE-Pi.dts` in `openwrt/target/linux/spacemit/dts/`.
|
||||
|
||||
```sh
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2024 Spacemit Ltd.
|
||||
|
||||
define Device/debX
|
||||
DEVICE_VENDOR := Spacemit
|
||||
DEVICE_MODEL :=k1-x deb board
|
||||
DEVICE_DTS_DIR:= ../dts
|
||||
DEVICE_DTS := k1-x_deb1 k1-x_MUSE-Pi
|
||||
SOC := KeyStone
|
||||
KERNEL_NAME := Image
|
||||
KERNEL_IMG := Image.itb
|
||||
KERNEL := kernel-bin | fit none
|
||||
IMAGES := pack.zip
|
||||
IMAGE/pack.zip := $(KERNEL_IMG) | boot-common | sdcard-img | archive-zip
|
||||
endef
|
||||
TARGET_DEVICES += debX
|
||||
|
||||
```
|
||||
|
||||
### Initial Setup for the Solution
|
||||
|
||||
`openwrt/target/linux/spacemit/base-files/etc/uci-defaults/`
|
||||
|
||||
UCI default settings provide a method to preconfigure your image using UCI. To set some system defaults during the first boot of the device, create a script in this directory.
|
||||
|
||||
## Adding a New Solution
|
||||
|
||||
Using the k1-sbc solution as an example, the following modifications need to be made:
|
||||
|
||||
1.Modify the SUBTARGETS in `openwrt/target/linux/spacemit/Makefile` to include the solution name, such as `k1-sbc`.
|
||||
2.Add a new solution directory, such as `openwrt/target/linux/spacemit/k1-sbc/`, and include the following files:
|
||||
|
||||
```sh
|
||||
openwrt/target/linux/spacemit/k1-sbc/config-6.1
|
||||
openwrt/target/linux/spacemit/k1-sbc/target.mk
|
||||
```
|
||||
|
||||
3.Add firmware compilation and compatible board configurations in `openwrt/target/linux/spacemit/image/k1-sbc.mk`.
|
||||
|
||||
4.In the `feeds/spacemit_openwrt_feeds/` directory, add new build configurations, such as `spacemit_k1_defconfig` for the `k1-sbc` solution.
|
||||
|
||||
### Adding Support for New Board Types
|
||||
|
||||
Each solution should have at least one or more board types. For adding support for new board types, refer to[device management](openwrt_device_management.md)
|
||||
|
||||
### U-Boot/OpenSBI Compilation Configurations
|
||||
|
||||
If it is necessary to add new compilation configurations for U-Boot/OpenSBI, refer to the following modifications:
|
||||
|
||||
#### uboot
|
||||
|
||||
1. Add new compilation configurations in the U-Boot source repository, such as `u-boot-2022.10/configs/k1_defconfig`.
|
||||
2. Modify `openwrt/package/boot/uboot-spacemit/Makefile`:
|
||||
|
||||
```sh
|
||||
50 define Build/Configure
|
||||
51 $(MAKE) -C $(LOCAL_SOURCE_DIR) k1_defconfig
|
||||
52 endef
|
||||
53
|
||||
```
|
||||
|
||||
#### opensbi
|
||||
|
||||
1. Add new compilation configurations in the OpenSBI source repository, such as `opensbi-1.3/platform/generic/configs/k1_defconfig`.
|
||||
2. Modify `openwrt/package/boot/opensbi-spacemit/Makefile`.
|
||||
|
||||
```sh
|
||||
59 define Build/Compile
|
||||
60 $(eval $(Package/opensbi_$(BUILD_VARIANT))) \
|
||||
61 +$(MAKE_VARS) $(MAKE) -C $(LOCAL_SOURCE_DIR) \
|
||||
62 PLATFORM=$(PLAT) PLATFORM_DEFCONFIG=k1_defconfig
|
||||
63 endef
|
||||
64
|
||||
|
||||
```
|
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 242 KiB |
8
en/supported_devices/_category_.json
Normal file
8
en/supported_devices/_category_.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"label": "support devices",
|
||||
"position": 5,
|
||||
"link": {
|
||||
"type": "generated-index",
|
||||
"description": "OpenWrt support devices list"
|
||||
}
|
||||
}
|
7
en/supported_devices/muse_n1.md
Normal file
7
en/supported_devices/muse_n1.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# MUSE N1
|
||||
|
||||
Refer to [MUSE N1](https://bianbu.spacemit.com/en/bianbu-nas/device_list/muse_n1/)
|
7
en/supported_devices/muse_pi.md
Normal file
7
en/supported_devices/muse_pi.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
# MUSE Pi
|
||||
|
||||
Refer to [MUSE N1](https://bianbu.spacemit.com/en/bianbu-nas/device_list/muse_pi)
|
BIN
zh/static/image.png
Normal file
BIN
zh/static/image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 242 KiB |
Loading…
Add table
Reference in a new issue