Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

$ sudo apt update
$ sudo apt install tvheadendFound muxes: 8
Found services: 172import network
if hasattr(network, "WLAN"):
# 该主板搭载了 WLAN 功能>>> import sys
>>> sys.implementation
(name='micropython', version=(1, 19, 1), _machine='Raspberry Pi Pico W with RP2040', _mpy=4102)$ sudo apt install openocd$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"$ brew install openocd$ sudo apt install gdb-multiarch$ brew install gdb$ sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "program blink.elf verify reset exit"$ cd ~/pico/pico-examples/
$ rm -rf build
$ mkdir build
$ cd build
$ export PICO_SDK_PATH=../../pico-sdk
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
$ cd blink
$ make -j4$ sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000"$ gdb blink.elf
> target remote localhost:3333
> monitor reset init
> continue$ sudo apt install minicom$ minicom -b 115200 -o -D /dev/ttyACM0$ cd pico-examples
$ mkdir build
$ cd build
$ export PICO_SDK_PATH=../../pico-sdk
$ cmake ..
$ cd hello_world/serial
$ make -j4
$ sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "program hello_serial.elf verify reset exit"
$ minicom -b 115200 -o -D /dev/ttyACM0$ sudo apt update && sudo apt full-upgrade$ sudo apt install sense-hat$ sudo reboot$ sudo apt update
$ sudo apt install octave -y
$ cd
$ cp /usr/share/librtimulib-utils/RTEllipsoidFit ./ -a
$ cd RTEllipsoidFit
$ RTIMULibCalOptions are:
m - calibrate magnetometer with min/max
e - calibrate magnetometer with ellipsoid (do min/max first)
a - calibrate accelerometers
x - exit
Enter option: Magnetometer min/max calibration
--------------------------------
Waggle the IMU chip around, ensuring that all six axes
(+x, -x, +y, -y and +z, -z) go through their extrema.
When all extrema have been achieved, enter 's' to save, 'r' to reset
or 'x' to abort and discard the data.
Press any key to start... Min x: 51.60 min y: 69.39 min z: 65.91
Max x: 53.15 max y: 70.97 max z: 67.97$ rm ~/.config/sense_hat/RTIMULib.ini
$ sudo cp RTIMULib.ini /etc dtparam=i2c_vc=on
dtparam=i2c_arm=on sudo systemctl reboot$ git clone https://github.com/raspberrypi/hats.git
$ cd hats/eepromutils
$ make$ sudo ./eepflash.sh -f=sense_read.eep -t=24c32 -r$ wget https://github.com/raspberrypi/rpi-sense/raw/master/eeprom/eeprom_settings.txt -O sense_eeprom.txt
./eepmake sense_eeprom.txt sense.eep /boot/firmware/overlays/rpi-sense-overlay.dtb$ i2cset -y -f 1 0x46 0xf3 1$ sudo ./eepflash.sh -f=sense.eep -t=24c32 -w i2cset -y -f 1 0x46 0xf3 0$ sudo apt install minicom
$ minicom -b 115200 -o -D /dev/ttyACM0$ sudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib$ git clone https://github.com/raspberrypi/pico-sdk.gitcmake_minimum_required(VERSION 3.13)
# 基于 PICO_SDK_PATH 初始化 SDK
# 注意:它必须位于 project() 之前
include(pico_sdk_import.cmake)
project(my_project)
# 初始化树莓派 Pico SDK
pico_sdk_init()
# 你的项目的其余部分#include <stdio.h>
#include "pico/stdlib.h"
int main() {
setup_default_uart();
printf("Hello, world!\n");
return 0;
}add_executable(hello_world
hello_world.c
)
# 添加 pico_stdlib 库,它聚合了常用功能
target_link_libraries(hello_world pico_stdlib)
# 除 ELF 外还创建 map/bin/hex/uf2 文件。
pico_add_extra_outputs(hello_world)$ mkdir build
$ cd build
$ cmake ..$ make hello_world$ sudo apt update && sudo apt full-upgrade$ sudo rpi-eeprom-update$ sudo raspi-config$ git clone --depth 1 https://github.com/raspberrypi/rpicam-apps.git ~/rpicam-apps$ rpicam-hello -t 0 --post-process-file ~/rpicam-apps/assets/hailo_yolov6_inference.json --lores-width 640 --lores-height 640$ rpicam-hello -t 0 --post-process-file ~/rpicam-apps/assets/hailo_yolov8_inference.json --lores-width 640 --lores-height 640$ rpicam-hello -t 0 --post-process-file ~/rpicam-apps/assets/hailo_yolox_inference.json --lores-width 640 --lores-height 640$ rpicam-hello -t 0 --post-process-file ~/rpicam-apps/assets/hailo_yolov5_personface.json --lores-width 640 --lores-height 640$ rpicam-hello -t 0 --post-process-file ~/rpicam-apps/assets/hailo_yolov5_segmentation.json --lores-width 640 --lores-height 640 --framerate 20$ rpicam-hello -t 0 --post-process-file ~/rpicam-apps/assets/hailo_yolov8_pose.json --lores-width 640 --lores-height 640$ sudo apt install wvkbdvideo=DSI-1:800x480@60,rotate=<旋转值>dtoverlay=vc4-kms-dsi-7inch,invx,invydisplay_auto_detect=1dtoverlay=vc4-kms-dsi-7inch,sizex=400,invx,invyignore_lcd=0$ sudo rpi-eeprom-update -a$ sudo apt install hailo-all$ hailortcli fw-control identifyExecuting on device: 0000:01:00.0
Identifying board
Control Protocol Version: 2
Firmware Version: 4.17.0 (release,app,extended context switch buffer)
Logger Version: 0
Board Name: Hailo-8
Device Architecture: HAILO8L
Serial Number: HLDDLBB234500054
Part Number: HM21LB1C2LAE
Product Name: HAILO-8L AI ACC M.2 B+M KEY MODULE EXT TMP[ 3.049657] hailo: Init module. driver version 4.17.0
[ 3.051983] hailo 0000:01:00.0: Probing on: 1e60:2864...
[ 3.051989] hailo 0000:01:00.0: Probing: Allocate memory for device extension, 11600
[ 3.052006] hailo 0000:01:00.0: enabling device (0000 -> 0002)
[ 3.052011] hailo 0000:01:00.0: Probing: Device enabled
[ 3.052028] hailo 0000:01:00.0: Probing: mapped bar 0 - 000000000d8baaf1 16384
[ 3.052034] hailo 0000:01:00.0: Probing: mapped bar 2 - 000000009eeaa33c 4096
[ 3.052039] hailo 0000:01:00.0: Probing: mapped bar 4 - 00000000b9b3d17d 16384
[ 3.052044] hailo 0000:01:00.0: Probing: Force setting max_desc_page_size to 4096 (recommended value is 16384)
[ 3.052052] hailo 0000:01:00.0: Probing: Enabled 64 bit dma
[ 3.052055] hailo 0000:01:00.0: Probing: Using userspace allocated vdma buffers
[ 3.052059] hailo 0000:01:00.0: Disabling ASPM L0s
[ 3.052070] hailo 0000:01:00.0: Successfully disabled ASPM L0s
[ 3.221043] hailo 0000:01:00.0: Firmware was loaded successfully
[ 3.231845] hailo 0000:01:00.0: Probing: Added board 1e60-2864, /dev/hailo0$ rpicam-hello -t 10s
























































$ sudo apt update
$ sudo apt full-upgrade$ sudo apt install rpi-connect$ sudo reboot$ sudo apt install rpi-connect-lite$ systemctl --user start rpi-connect$ rpi-connect signin通过访问 https://connect.raspberrypi.com/verify/XXXX-XXXX 完成登录$ rpi-connect vnc off$ rpi-connect vnc on$ rpi-connect shell off$ rpi-connect shell on$ loginctl enable-linger$ sudo apt update
$ sudo apt install --only-upgrade rpi-connect$ sudo reboot$ rpi-connect signout$ sudo apt remove --purge rpi-connect$ rpi-connect status$ systemctl --user edit rpi-connectExecStart=
ExecStart=/usr/bin/rpi-connectd -socket %t/rpi-connect-wayvnc.sock -v$ systemctl --user restart rpi-connect$ systemctl --user edit rpi-connect-wayvncExecStart=
ExecStart=/usr/bin/rpi-connect-env /usr/bin/wayvnc --config /etc/rpi-connect/wayvnc.config --render-cursor --unix-socket --socket=%t/rpi-connect-wayvnc-ctl.sock -Ldebug %t/rpi-connect-wayvnc.sock$ systemctl --user restart rpi-connect-wayvnc$ journalctl --user --follow --unit rpi-connect --unit rpi-connect-wayvnc






























raspi-config。
$ sudo apt update && sudo apt full-upgrade$ sudo rpi-eeprom-update$ sudo raspi-config$ sudo rpi-eeprom-update -a














sudo su
echo 2 > /sys/module/imx477/parameters/trigger_mode
exitsudo su
echo 1 > /sys/module/imx477/parameters/trigger_mode
exitrpicam-vid --frames 300 --qt-preview -o sink.h264rpicam-vid --frames 300 --qt-preview -o source.h264rpicam-vid --frames 300 -o sync.h264rpicam-vid --frames 299 -o sync.h264ffmpeg -i source.h264 -vf select="gte(n\, 1)" source.h264sudo su
echo 1 > /sys/module/imx296/parameters/trigger_mode
exitfrom machine import Pin, PWM
from time import sleep
pwm = PWM(Pin(28))
framerate = 30
shutter = 6000 # In microseconds
frame_length = 1000000 / framerate
pwm.freq(framerate)
pwm.duty_u16(int((1 - (shutter - 14) / frame_length) * 65535))rpicam-hello -t 0 --qt-preview --shutter 3000















$ sudo nano /boot/firmware/config.txt#dtparam=audio=on$ sudo reboot$ grep -a . /proc/device-tree/hat/*# Some magic to prevent the normal HAT overlay from being loaded
dtoverlay=
# And then choose one of the following, according to the model:
dtoverlay=rpi-codeczero
dtoverlay=rpi-dacplus
dtoverlay=rpi-dacpro
dtoverlay=rpi-digiampplus$ git clone https://github.com/raspberrypi/Pi-Codec.git$ sudo apt install git$ sudo alsactl restore -f /home/<username>/Pi-Codec/Codec_Zero_OnboardMIC_record_and_SPK_playback.state$ sudo nano /etc/rc.local#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sudo alsactl restore -f /home/<username>/Pi-Codec/Codec_Zero_OnboardMIC_record_and_SPK_playback.state
exit 0$ sudo reboot$ sudo nano .asoundrcpcm.!default {
type hw
card Zero
}$ sudo rebootdtoverlay=rpi-digiampplus,unmute_ampdtoverlay=iqaudio-digiampplus,unmute_ampdtoverlay=rpi-digiampplus,auto_mute_ampdtoverlay=iqaudio-digiampplus,auto_mute_amp$ sudo sh -c "echo 22 > /sys/class/gpio/export"
$ sudo sh -c "echo out >/sys/class/gpio/gpio22/direction"
$ sudo sh -c "echo 1 >/sys/class/gpio/gpio22/value"$ sudo sh -c "echo 0 >/sys/class/gpio/gpio22/value"$ sudo nano chatter_box.py#!/usr/bin/env python3
from gpiozero import Button
from signal import pause
import time
import random
import os
from datetime import datetime
# Print current date
date = datetime.now().strftime("%d_%m_%Y-%H:%M:%S")
print(f"{date}")
# Make sure that the 'sounds' folder exists, and if it does not, create it
path = '/home/<username>/sounds'
isExist = os.path.exists(path)
if not isExist:
os.makedirs(path)
print("The new directory is created!")
os.system('chmod 777 -R /home/<username>/sounds')
# Download a 'burp' sound if it does not already exist
burp = '/home/<username>/burp.wav'
isExist = os.path.exists(burp)
if not isExist:
os.system('wget http://rpf.io/burp -O burp.wav')
print("Burp sound downloaded!")
# Setup button functions - Pin 27 = Button hold time 10 seconds.
button = Button(27, hold_time=10)
def pressed():
global press_time
press_time = time.time()
print("Pressed at %s" % (press_time));
def released():
release_time = time.time()
pressed_for = release_time - press_time
print("Released at %s after %.2f seconds" % (release_time, pressed_for))
if pressed_for < button.hold_time:
print("This is a short press")
randomfile = random.choice(os.listdir("/home/<username>/sounds/"))
file = '/home/<username>/sounds/' + randomfile
os.system('aplay ' + file)
elif pressed_for > 20:
os.system('aplay ' + burp)
print("Erasing all recorded sounds")
os.system('rm /home/<username>/sounds/*');
def held():
print("This is a long press")
os.system('aplay ' + burp)
os.system('arecord --format S16_LE --duration=5 --rate 48000 -c2 /home/<username>/sounds/$(date +"%d_%m_%Y-%H_%M_%S")_voice.m4a');
button.when_pressed = pressed
button.when_released = released
button.when_held = held
pause()$ sudo chmod +x chatter_box.py$ crontab -e@reboot python /home/<username>/chatter_box.py$ sudo alsactl store$ sudo alsactl store -f /home/<username>/usecase.state$ sudo alsactl restore -f /home/<username>/usecase.stateaudio_output {
type "alsa"
name "ALSA Device"
mixer_control "Digital"
}$ sudo apt update
$ sudo apt install rpi-audio-utils
$ sudo rpi-audio-flash$ git clone --depth=1 --branch <分支> https://github.com/raspberrypi/linux$ make -j6 Image.gz modules dtbs$ make -j6 zImage modules dtbs$ sudo cp /boot/firmware/$KERNEL.img /boot/firmware/$KERNEL-backup.img
$ sudo cp arch/arm64/boot/Image.gz /boot/firmware/$KERNEL.img
$ sudo cp arch/arm64/boot/dts/broadcom/*.dtb /boot/firmware/
$ sudo cp arch/arm64/boot/dts/overlays/*.dtb* /boot/firmware/overlays/
$ sudo cp arch/arm64/boot/dts/overlays/README /boot/firmware/overlays/$ sudo cp /boot/firmware/$KERNEL.img /boot/firmware/$KERNEL-backup.img
$ sudo cp arch/arm/boot/zImage /boot/firmware/$KERNEL.img$ sudo cp arch/arm/boot/dts/*.dtb /boot/firmware/kernel=kernel-myconfig.img$ sudo apt install crossbuild-essential-arm64$ sudo apt install crossbuild-essential-armhf$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbs$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs$ sudo env PATH=$PATH make -j12 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=mnt/root modules_install$ sudo env PATH=$PATH make -j12 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=mnt/root modules_install$ sudo cp mnt/boot/$KERNEL.img mnt/boot/$KERNEL-backup.img
$ sudo cp arch/arm64/boot/Image mnt/boot/$KERNEL.img
$ sudo cp arch/arm64/boot/dts/broadcom/*.dtb mnt/boot/
$ sudo cp arch/arm64/boot/dts/overlays/*.dtb* mnt/boot/overlays/
$ sudo cp arch/arm64/boot/dts/overlays/README mnt/boot/overlays/
$ sudo umount mnt/boot
$ sudo umount mnt/root$ sudo cp mnt/boot/$KERNEL.img mnt/boot/$KERNEL-backup.img
$ sudo cp arch/arm/boot/zImage mnt/boot/$KERNEL.img$ sudo cp arch/arm/boot/dts/*.dtb mnt/boot/kernel=kernel-myconfig.img$ git config --global user.name "your name"
$ git config --global user.email "your email"$ sudo apt install git$ git clone --depth=1 https://github.com/raspberrypi/linux$ sudo apt install bc bison flex libssl-dev makeCONFIG_LOCALVERSION="-v7l-MY_CUSTOM_KERNEL"$ sudo make -j6 modules_install$ sudo reboot$ sudo apt install bc bison flex libssl-dev make libc6-dev libncurses5-devCONFIG_LOCALVERSION="-v7l-MY_CUSTOM_KERNEL"sdb
sdb1
sdb2$ mkdir mnt
$ mkdir mnt/boot
$ mkdir mnt/root
$ sudo mount /dev/sdb1 mnt/boot
$ sudo mount /dev/sdb2 mnt/root$ sudo apt install libncurses5-dev$ make menuconfig$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig$ uname -r$ head Makefile -n 4# SPDX-License-Identifier: GPL-2.0
VERSION = 6
PATCHLEVEL = 1
SUBLEVEL = 38$ wget https://www.kernel.org/pub/linux/kernel/projects/rt/6.1/patch-6.1.38-rt13-rc1.patch.gz
$ gunzip patch-6.1.38-rt13-rc1.patch.gz
$ cat patch-6.1.38-rt13-rc1.patch | patch -p1$ git am -3 /path/to/patches/*$ sudo apt install linux-headers-rpi-v8$ sudo apt install linux-headers-rpi-{v6,v7,v7l}








$ sudo cp arch/arm/boot/dts/broadcom/*.dtb /boot/firmware/$ sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/firmware/overlays/
$ sudo cp arch/arm/boot/dts/overlays/README /boot/firmware/overlays/$ sudo cp arch/arm/boot/dts/broadcom/*.dtb mnt/boot/$ sudo cp arch/arm/boot/dts/overlays/*.dtb* mnt/boot/overlays/
$ sudo cp arch/arm/boot/dts/overlays/README mnt/boot/overlays/
$ sudo umount mnt/boot
$ sudo umount mnt/root





$ sudo apt install --reinstall libraspberrypi0 libraspberrypi-{bin,dev,doc} raspberrypi-{kernel,bootloader}$ aplay -L | grep sysdefault$ kmsprint | grep Connector$ sudo apt update$ sudo apt full-upgrade$ apt-cache search <关键字>$ apt-cache search raspi
raspi3-firmware - Raspberry Pi 2 and 3 GPU firmware and bootloaders
libcamera-apps - libcamera-apps
libcamera-apps-lite - libcamera-apps-lite
python-picamera - Pure Python interface to the Raspberry Pi's camera module.
python-picamera-docs - Documentation for the Python interface to the RPi's camera module.
python3-picamera - Pure Python interface to the Raspberry Pi's camera module.
raspi-config - Raspberry Pi configuration tool
raspi-gpio - Dump the state of the BCM270x GPIOs
raspi-gpio-dbgsym - debug symbols for raspi-gpio
raspinfo - Dump information about the Pi
rc-gui - raspi-config GUI
raspi-copies-and-fills - ARM-accelerated versions of selected functions from string.h
raspi-copies-and-fills-dbgsym - debug symbols for raspi-copies-and-fills$ apt-cache show <软件包名>$ apt-cache show raspi-config
Package: raspi-config
Version: 20210212
Architecture: all
Maintainer: Serge Schneider <[email protected]>
Installed-Size: 121
Depends: whiptail, parted, lua5.1, alsa-utils, psmisc, initramfs-tools
Recommends: triggerhappy, iw
Priority: optional
Section: utils
Filename: pool/main/r/raspi-config/raspi-config_20210212_all.deb
Size: 27976
SHA256: 772d4fd3c6d8c9da47ac56012b74e7828b53c8521ff1c47266bb38ec71750c10
SHA1: 08254c976a8260bde914c2df72f92ffb9317fef6
MD5sum: 80aaac13be6a9b455c822edb91cf8ea2
Description: Raspberry Pi configuration tool
A simple configuration tool for common Raspberry Pi administrative tasks
Description-md5: 19630c04463bfe7193152448b53d85a0$ sudo apt install <软件包名>$ sudo apt remove <软件包名>$ df -h$ sudo apt clean$ sudo rpi-update
$ sudo reboot$ sudo apt-get update
$ sudo apt install --reinstall raspi-firmware$ wget --trust-server-names http://rptl.io/big-buck-bunny$ vlc big-buck-bunny-1080p.mp4$ vlc --play-and-exit big-buck-bunny-1080p.mp4$ vlc --play-and-exit --fullscreen big-buck-bunny-1080p.mp4$ cvlc --play-and-exit big-buck-bunny-1080p.mp4$ sudo apt install --no-install-recommends vlc-bin vlc-plugin-base$ wget --trust-server-names http://rptl.io/startup-music$ cvlc --play-and-exit computer-startup-music.mp3$ cvlc --play-and-exit -A alsa --alsa-audio-device <alsa-设备> computer-startup-music.mp3$ cvlc --play-and-exit --drm-vout-display <drm设备> big-buck-bunny-1080p.mp4$ cvlc --play-and-exit --fullscreen --drm-vout-display DSI-1 -A alsa --alsa-audio-device sysdefault:CARD=Headphones your_video.mp4$ ffmpeg -r 30 -i video.h264 -c:v copy video.mp4$ vcgencmd get_config total_mem$ sudo apt install python3-build-hat$ pip install buildhat
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
For more information visit http://rptl.io/venv
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.$ python -m venv <环境名>$ source <环境名>/bin/activate(<环境名>) $(<环境名>) $ pip list
Package Version
---------- -------
pip 23.0.1
setuptools 66.1.1(<环境名>) $ deactivate$ python -m venv env$ source env/bin/activate(env) $(env) $ deactivate$ python -m venv ~/.env$ source ~/.env/bin/activate(.env) $(.env) $ deactivatefrom gpiozero import LED
from time import sleep
led = LED(17)
while True:
led.on()
sleep(1)
led.off()
sleep(1)from gpiozero import Button
from time import sleep
button = Button(2)
while True:
if button.is_pressed:
print("Pressed")
else:
print("Released")
sleep(1)from gpiozero import LED, Button
led = LED(17)
button = Button(2)
while True:
if button.is_pressed:
led.on()
else:
led.off()from gpiozero import LED, Button
led = LED(17)
button = Button(2)
while True:
button.wait_for_press()
led.on()
button.wait_for_release()
led.off()from gpiozero import LED, Button
led = LED(17)
button = Button(2)
button.when_pressed = led.on
button.when_released = led.off
































dt-blob.binstart.elf 处理额外的系统设置并启动 Arm 处理器子系统。它包含 GPU 固件。GPU 固件首先读取 dt-blob.bin 以确定初始 GPIO 引脚状态和 GPU 特定接口和时钟,然后解析 config.txt。然后加载特定于模型的 Arm 设备树文件和在 config.txt 中指定的任意设备树叠加,然后启动 Arm 子系统并将设备树数据传递给正在引导的 Linux 内核。CD1_SDAdtparam=cam1_regdtoverlay=vc4-kms-dsi-7inchdtoverlay=vc4-kms-dsi-7inch$ sudo apt install rpiboot$ sudo rpiboot$ sudo ./rpiboot$ sudo dd if=raw_os_image.img of=/dev/sdX bs=4MiB/dev/sdX <- 设备
/dev/sdX1 <- 第一个分区(FAT)
/dev/sdX2 <- 第二个分区(Linux 文件系统)$ sudo parted /dev/<设备>
(parted) mkpart primary fat32 4MiB 64MiB
(parted) q
$ sudo mkfs.vfat -F32 /dev/<设备>
$ sudo cp -r <文件>/* <挂载点>$ ./rpiboot -d recovery$ sudo apt install device-tree-compiler$ dtc -I dts -O dtb -o dt-blob.bin minimal-cm-dt-blob.dts$ dtc -I fs -O dts -o proc-dt.dts /proc/device-tree$ sudo vclog --msg$ sudo nano /boot/firmware/minimal-cm-dt-blob.dtspin@p44 { function = "input"; termination = "pull_down"; }; // 默认状态为输入无拉取
pin@p45 { function = "input"; termination = "pull_down"; }; // 默认状态为输入无拉取pin@p44 { function = "i2c1"; termination = "pull_up"; }; // SDA1
pin@p45 { function = "i2c1"; termination = "pull_up"; }; // SCL1$ sudo dtc -I dts -O dtb -o /boot/firmware/dt-blob.bin /boot/firmware/minimal-cm-dt-blob.dts$ sudo dtc -@ -I dts -O dtb -o /boot/firmware/overlays/example1.dtbo /boot/firmware/example1-overlay.dtsdtoverlay=example1$ sudo hwclockdtoverlay=enc28j60$ sudo hwclock$ ping 8.8.8.8$ pinctrl$ sudo apt update
$ sudo apt full-upgradecamera_auto_detect=1dtparam=i2c_arm=ondtoverlay=cm-swap-i2c0$ rpicam-hello --listdtparam=cam0_reg$ rpicam-hello --list$ rpicam-still --datetime -e png$ rpicam-vid -t 10000 -o video.h264$ rpicam-hello --list-cameras
Available cameras
-----------------
0 : imx477 [4056x3040] (/base/soc/i2c0mux/i2c@1/imx477@1a)
Modes: 'SRGGB10_CSI2P' : 1332x990 [120.05 fps - (696, 528)/2664x1980 crop]
'SRGGB12_CSI2P' : 2028x1080 [50.03 fps - (0, 440)/4056x2160 crop]
2028x1520 [40.01 fps - (0, 0)/4056x3040 crop]
4056x3040 [10.00 fps - (0, 0)/4056x3040 crop]
1 : imx708 [4608x2592] (/base/soc/i2c0mux/i2c@0/imx708@1a)
Modes: 'SRGGB10_CSI2P' : 1536x864 [120.13 fps - (768, 432)/3072x1728 crop]
2304x1296 [56.03 fps - (0, 0)/4608x2592 crop]
4608x2592 [14.35 fps - (0, 0)/4608x2592 crop]$ rpicam-hello --camera 0$ rpicam-hello --camera 1dtoverlay=cm-swap-i2c0disable_touchscreen=1ignore_lcd=1
$ sudo apt install python3-build-hatfrom buildhat import Motor
motor_a = Motor('A')
motor_a.run_for_seconds(5)motor_a.run_for_seconds(5, speed=50)motor_a.run_for_seconds(5, speed=-50)from buildhat import Motor
motor_a = Motor('A')
while True:
print("Position: ", motor_a.get_aposition())from signal import pause
from buildhat import ForceSensor, ColorSensor
button = ForceSensor('C')
cs = ColorSensor('B')
def handle_pressed(force):
cs.on()
print(cs.get_color())
def handle_released(force):
cs.off()
button.when_pressed = handle_pressed
button.when_released = handle_released
pause()$ wget -O - https://raw.githubusercontent.com/pjgpetecodes/dotnet5pi/master/install.sh | sudo bash$ dotnet new console --name buildhat$ cd buildhat$ dotnet add package System.Device.Gpio --version 2.1.0
$ dotnet add package Iot.Device.Bindings --version 2.1.0$ dotnet run
Hello World!Brick brick = new("/dev/serial0");brick.Dispose();using Brick brick = new("/dev/serial0");var info = brick.BuildHatInformation;
Console.WriteLine($"version: {info.Version}, firmware date: {info.FirmwareDate}, signature:");
Console.WriteLine($"{BitConverter.ToString(info.Signature)}");
Console.WriteLine($"Vin = {brick.InputVoltage.Volts} V");SensorType sensor = brick.GetSensorType((SensorPort)i);
Console.Write($"Port: {i} {(Brick.IsMotor(sensor) ? "Sensor" : "Motor")} type: {sensor} Connected: ");if (Brick.IsActiveSensor(sensor))
{
ActiveSensor activeSensor = brick.GetActiveSensor((SensorPort)i);
}
else
{
var passive = (Sensor)brick.GetSensor((SensorPort)i);
Console.WriteLine(passive.IsConnected);
}Console.WriteLine("Move motor on Port A to more than position 100 to stop this test.");
brick.WaitForSensorToConnect(SensorPort.PortA);
var active = (ActiveMotor)brick.GetMotor(SensorPort.PortA);
bool continueToRun = true;
active.PropertyChanged += MotorPropertyEvent;
while (continueToRun)
{
Thread.Sleep(50);
}
active.PropertyChanged -= MotorPropertyEvent;
Console.WriteLine($"Current position: {active.Position}, eventing stopped.");
void MotorPropertyEvent(object? sender, PropertyChangedEventArgs e)
{
Console.WriteLine($"Property changed: {e.PropertyName}");
if (e.PropertyName == nameof(ActiveMotor.Position))
{
if (((ActiveMotor)brick.GetMotor(SensorPort.PortA)).Position > 100)
{
continueToRun = false;
}
}
}brick.WaitForSensorToConnect(SensorPort.PortB);train.SetPowerLimit(1.0);
train.SetBias(0.2);Console.WriteLine("This will run the motor for 20 secondes incrementing the PWM");
train.SetPowerLimit(1.0);
train.Start();
for (int i = 0; i < 100; i++)
{
train.SetSpeed(i);
Thread.Sleep(250);
}
Console.WriteLine("Stop the train for 2 seconds");
train.Stop();
Thread.Sleep(2000);
Console.WriteLine("Full speed backward for 2 seconds");
train.Start(-100);
Thread.Sleep(2000);
Console.WriteLine("Full speed forward for 2 seconds");
train.Start(100);
Thread.Sleep(2000);
Console.WriteLine("Stop the train");
train.Stop();brick.WaitForSensorToConnect(SensorPort.PortA);
brick.WaitForSensorToConnect(SensorPort.PortD);
var active = (ActiveMotor)brick.GetMotor(SensorPort.PortA);
var active2 = (ActiveMotor)brick.GetMotor(SensorPort.PortD);
active.Start(50);
active2.Start(50);
// Make sure you have an active motor plug in the port A and D
while (!Console.KeyAvailable)
{
Console.CursorTop = 1;
Console.CursorLeft = 0;
Console.WriteLine($"Absolute: {active.AbsolutePosition} ");
Console.WriteLine($"Position: {active.Position} ");
Console.WriteLine($"Speed: {active.Speed} ");
Console.WriteLine();
Console.WriteLine($"Absolute: {active2.AbsolutePosition} ");
Console.WriteLine($"Position: {active2.Position} ");
Console.WriteLine($"Speed: {active2.Speed} ");
}
active.Stop();
active2.Stop();// 根据前面的示例,这将使电机回到初始位置:
active.TargetSpeed = 100;
active2.TargetSpeed = 100;
// 首先是这台电机,将堵塞线程
active.MoveToPosition(0, true);
// 然后是这台电机,将阻塞该线程
active2.MoveToPosition(0, true);brick.WaitForSensorToConnect(SensorPort.PortA);
var active = (ActiveMotor)brick.GetMotor(SensorPort.PortA);
active.TargetSpeed = 70;
Console.WriteLine("Moving motor to position 0");
active.MoveToPosition(0, true);
Console.WriteLine("Moving motor to position 3600 (10 turns)");
active.MoveToPosition(3600, true);
Console.WriteLine("Moving motor to position -3600 (so 20 turns the other way");
active.MoveToPosition(-3600, true);
Console.WriteLine("Moving motor to absolute position 0, should rotate by 90°");
active.MoveToAbsolutePosition(0, PositionWay.Shortest, true);
Console.WriteLine("Moving motor to position 90");
active.MoveToAbsolutePosition(90, PositionWay.Shortest, true);
Console.WriteLine("Moving motor to position 179");
active.MoveToAbsolutePosition(179, PositionWay.Shortest, true);
Console.WriteLine("Moving motor to position -180");
active.MoveToAbsolutePosition(-180, PositionWay.Shortest, true);
active.Float();brick.WaitForSensorToConnect(SensorPort.PortA);
var button = (ButtonSensor)brick.GetSensor(SensorPort.PortA);
bool continueToRun = true;
button.PropertyChanged += ButtonPropertyEvent;
while (continueToRun)
{
// 你还可以在这里做很多其他事情
Thread.Sleep(50);
}
button.PropertyChanged -= ButtonPropertyEvent;
Console.WriteLine($"Button has been pressed, we're stopping the program.");
brick.Dispose();
void ButtonPropertyEvent(object? sender, PropertyChangedEventArgs e)
{
Console.WriteLine($"Property changed: {e.PropertyName}");
if (e.PropertyName == nameof(ButtonSensor.IsPressed))
{
continueToRun = false;
}
}brick.WaitForSensorToConnect(SensorPort.PortA);
var light = (PassiveLight)brick.GetSensor(SensorPort.PortA);
// 亮度 50%
light.On(50);
Thread.Sleep(2000);
// 亮度 70%
light.Brightness = 70;
Thread.Sleep(2000);
// 关灯
light.Off()brick.WaitForSensorToConnect(SensorPort.PortA);
var tilt = (WeDoTiltSensor)brick.GetSensor(SensorPort.PortA);
tilt.ContinuousMeasurement = true;
Point tiltValue;
while(!console.KeyAvailable)
{
tiltValue = tilt.Tilt;
console.WriteLine($"Tilt X: {tiltValue.X}, Tilt Y: {tiltValue.Y}");
Thread.Sleep(200);
}brick.WaitForSensorToConnect(SensorPort.PortA);
var distance = (WeDoDistanceSensor)brick.GetSensor(SensorPort.PortA);
distance.ContinuousMeasurement = true;
while(!console.KeyAvailable)
{
console.WriteLine($"Distance: {distance.Distance} mm");
Thread.Sleep(200);
}brick.WaitForSensorToConnect(SensorPort.PortA);
var force = (ForceSensor)brick.GetSensor(SensorPort.PortA);
force.ContinuousMeasurement = true;
while(!force.IsPressed)
{
console.WriteLine($"Force: {force.Force} N");
Thread.Sleep(200);
}brick.WaitForSensorToConnect(SensorPort.PortA);
var matrix = (ColorLightMatrix)brick.GetSensor(SensorPort.PortA);
for(byte i = 0; i < 10; i++)
{
// 会像进度条一样逐个点亮每个 LED 灯
matrix.DisplayProgressBar(i);
Thread.Sleep(1000);
}
for(byte i = 0; i < 11; i++)
{
// 将显示相同颜色的矩阵,并依次显示所有矩阵
matrix.DisplayColor((LedColor)i);
Thread.Sleep(1000);
}
Span<byte> brg = stackalloc byte[9] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
Span<LedColor> col = stackalloc LedColor[9] { LedColor.White, LedColor.White, LedColor.White,
LedColor.White, LedColor.White, LedColor.White, LedColor.White, LedColor.White, LedColor.White };
// 关灯
matrix.DisplayColorPerPixel(brg, col);brick.WaitForSensorToConnect(SensorPort.PortC);
var colorSensor = (ColorAndDistanceSensor)brick.GetActiveSensor(SensorPort.PortC);
while (!Console.KeyAvailable)
{
var colorRead = colorSensor.GetColor();
Console.WriteLine($"Color: {colorRead}");
var reflected = colorSensor.GetReflectedLight();
Console.WriteLine($"Reflected: {reflected}");
var ambiant = colorSensor.GetAmbiantLight();
Console.WriteLine($"Ambiant: {ambiant}");
var distance = colorSensor.GetDistance();
Console.WriteLine($"Distance: {distance}");
var counter = colorSensor.GetCounter();
Console.WriteLine($"Counter: {counter}");
Thread.Sleep(200);
}brick.WaitForSensorToConnect(SensorPort.PortA);
var distance = (UltrasonicDistanceSensor)brick.GetSensor(SensorPort.PortA);
distance.ContinuousMeasurement = true;
while(!console.KeyAvailable)
{
console.WriteLine($"Distance: {distance.Distance} mm");
Thread.Sleep(200);
}













config.txt 是什么?includeautoboot.txtboot_partition[tryboot]tryboot_a_bhdmi_enable_4kp60(仅适用于树莓派 4)camera_auto_detectdisplay_auto_detectdtoverlaydtparamarm_boost(仅适用于树莓派 4)power_force_3v3_pwm(仅适用于树莓派 5)audio_pwm_modedisable_audio_ditherenable_audio_ditherpwm_sample_bitsstart_file、fixup_filecmdlinekernelarm_64bitramfsfileramfsaddrinitramfsauto_initramfsdisable_poe_fandisable_splashenable_uartforce_eeprom_reados_prefixotg_mode(仅适用于树莓派 4)。overlay_prefixboot_ramdiskboot_load_flagspciex4_resetuart_2ndstageerase_eepromeeprom_write_protectos_checkbootloader_updateprogram_pubkeyrevoke_devkeyprogram_rpiboot_gpioprogram_jtag_lockgpioforce_turbo[all][none][tryboot][EDID=*]total_memdecode_MPG2decode_WVC1enable_tvoutignore_lcddisable_touchscreendisable_fw_kms_setupdisable_camera_ledawb_auto_is_greyworld
# 开启音频(加载 snd_bcm2835)
dtparam=audio=on
# 自动检测新加摄像头叠加层
camera_auto_detect=1
# 自动检测新加 DSI 显示器
display_auto_detect=1
# 开启 DRM VC4 V3D 驱动
dtoverlay=vc4-kms-v3d$ sudo reboot "0 tryboot"[all]
tryboot_a_b=1
boot_partition=2
[tryboot]
boot_partition=3[all]
tryboot_a_b=1
boot_partition=3
[tryboot]
boot_partition=2dtoverlay=vc4-kms-v3d,noaudio# 将 GPIO 引脚 0-27 配置成 Alt2 模式(用于 DPI24)
gpio=0-27=a2
# 将 GPIO12 设置为输出模式,并将其状态设为 1
gpio=12=op,dh
# 更改引脚 18、引脚 20 的上拉、下拉配置(引脚为输入)。
gpio=18,20=pu
# 将引脚 17-21 设置为输入。
gpio=17-21=ip$ cat /sys/class/thermal/thermal_zone0/temp$ vcgencmd pmic_read_adc EXT5V_V[pi1]
initramfs initrd.img-3.18.7+ followkernel
[pi2]
initramfs initrd.img-3.18.7-v7+ followkernel
[all]$ ls -1 /sys/class/drm/card?-HDMI-A-?/edid/sys/class/drm/card1-HDMI-A-1/edid
/sys/class/drm/card1-HDMI-A-2/edid$ edid-decode /sys/class/drm/card1-HDMI-A-1/edid....
Vendor & Product Identification:
Manufacturer: DEL
....
Display Product Name: 'DELL U2422H'
....[EDID=DEL-DELL_U2422H]
cmdline=cmdline_U2422H.txt
[all]$ cat /proc/cpuinfoSerial : 0000000012345678[0x12345678]
# 此处设置仅适用于符合该序列号的树莓派
[all]
# 此处设置用于所有硬件[gpio4=1]
# 此处设置在 GPIO 4 为高电平时生效
[gpio2=0]
# 此处设置在 GPIO 2 为低电平时生效
[all]
# 此处设置用于所有硬件# 此处设置用于所有硬件
[EDID=VSC-TD2220]
# 这些设置仅在接入 VSC-TD2220 显示器时生效
[pi2]
# 这些设置仅在树莓派 2 上接入了 VSC-TD2220 显示器时生效
[all]
# 此处设置用于所有硬件total_mem=1024dtoverlay=vc4-kms-v3d,compositevc4.tv_norm=<视频信号格式>$ sudo touch /boot/firmware/ssh$ sudo reboot$ sudo raspi-config$ scp "my file.txt" <用户名>@<树莓派IP地址>:$ mkdir <个人计算机文件夹名>$ rsync -avz -e ssh <树莓派用户名>@<树莓派IP地址>:<树莓派文件夹名>/ <个人计算机文件夹名>/$ hostname -I$ nmcli device showGENERAL.DEVICE: wlan0
GENERAL.TYPE: wifi
GENERAL.HWADDR: D0:3B:FF:41:AB:8A
GENERAL.MTU: 1500
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: exampleNetworkName
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2
IP4.ADDRESS[1]: 192.168.1.42/24
IP4.GATEWAY: 192.168.1.1
IP4.ROUTE[1]: dst = 192.168.1.0/24, nh = 0.0.0.0, mt = 600
IP4.ROUTE[2]: dst = 0.0.0.0/0, nh = 192.168.1.1, mt = 600
IP4.DNS[1]: 192.168.1.3
IP6.ADDRESS[1]: ab80::11ab:b1fc:bb7e:a8a5/64
IP6.GATEWAY: --
IP6.ROUTE[1]: dst = ab80::/64, nh = ::, mt = 1024
GENERAL.DEVICE: lo
GENERAL.TYPE: loopback
GENERAL.HWADDR: 00:00:00:00:00:00
GENERAL.MTU: 65536
GENERAL.STATE: 100 (connected (externally))
GENERAL.CONNECTION: lo
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/1
IP4.ADDRESS[1]: 127.0.0.1/8
IP4.GATEWAY: --
IP6.ADDRESS[1]: ::1/128
IP6.GATEWAY: --
GENERAL.DEVICE: p2p-dev-wlan0
GENERAL.TYPE: wifi-p2p
GENERAL.HWADDR: (unknown)
GENERAL.MTU: 0
GENERAL.STATE: 30 (disconnected)
GENERAL.CONNECTION: --
GENERAL.CON-PATH: --
GENERAL.DEVICE: eth0
GENERAL.TYPE: ethernet
GENERAL.HWADDR: D0:3B:FF:41:AB:89
GENERAL.MTU: 1500
GENERAL.STATE: 20 (unavailable)
GENERAL.CONNECTION: --
GENERAL.CON-PATH: --
WIRED-PROPERTIES.CARRIER: off
IP4.GATEWAY: --
IP6.GATEWAY: --$ ping raspberrypi.localPING raspberrypi.local (192.168.1.131): 56 data bytes
64 bytes from 192.168.1.131: icmp_seq=0 ttl=255 time=2.618 ms$ sudo nmap -sn 192.168.1.0/24Starting Nmap 6.40 ( http://nmap.org ) at 2014-03-10 12:46 GMT
Nmap scan report for hpprinter (192.168.1.2)
Host is up (0.00044s latency).
Nmap scan report for Gordons-MBP (192.168.1.4)
Host is up (0.0010s latency).
Nmap scan report for ubuntu (192.168.1.5)
Host is up (0.0010s latency).
Nmap scan report for raspberrypi (192.168.1.8)
Host is up (0.0030s latency).
Nmap done: 256 IP addresses (4 hosts up) scanned in 2.41 seconds$ ssh <用户名>@<ip 地址><用户名>@<主机名> ~ $$ ssh -Y <用户名>@<ip 地址>$ geany &$ ls ~/.ssh$ ssh-keygen$ ls ~/.sshauthorized_keys id_rsa id_rsa.pub known_hosts$ eval "$(ssh-agent -s)"$ ssh-add ~/.ssh/id_rsa$ ssh-copy-id <用户名>@<ip 地址>$ mkdir .ssh$ chmod 700 .ssh$ scp .ssh/id_rsa.pub <用户名>@<ip 地址>:.ssh/authorized_keys$ chmod 644 .ssh/authorized_keys$ scp myfile.txt <用户名>@<树莓派IP地址>:$ scp myfile.txt <用户名>@<树莓派IP地址>:project/$ scp <用户名>@<树莓派IP地址>:myfile.txt .$ scp myfile.txt myfile2.txt <用户名>@<树莓派IP地址>:$ scp *.txt <用户名>@<树莓派IP地址>:$ scp m* <用户名>@<树莓派IP地址>:$ scp m*.txt <用户名>@<树莓派IP地址>:$ scp -r project/ <用户名>@<树莓派IP地址>:$ sudo apt install nfs-kernel-server$ sudo mkdir -p /export/users$ chmod -R 777 /export$ sudo mount --bind /home/users /export/users/home/users /export/users none bind 0 0[Mapping]
Nobody-User = nobody
Nobody-Group = nogroup$ cat /etc/passwd
$ cat /etc/group[Translation]
Method = nsswitch/export 192.168.1.0/24(rw,fsid=0,insecure,no_subtree_check,async)
/export/users 192.168.1.0/24(rw,nohide,insecure,no_subtree_check,async)rpcbind mountd nfsd statd lockd rquotad : ALLrpcbind mountd nfsd statd lockd rquotad : <IPv4地址列表>$ sudo systemctl restart nfs-kernel-server$ sudo apt install nfs-common$ mount -t nfs -o proto=tcp,port=2049 <nfs服务器IP>:/ /mnt$ mount -t nfs -o proto=tcp,port=2049 <nfs服务器IP>:/users /home/users<nfs服务器IP>:/ /mnt nfs auto 0 0rpcbind : ALLrpcbind : <NFS服务器IP>myclients (client1,,) (client2,,) ...$ sudo make -C /var/yprpcbind mountd nfsd statd lockd rquotad : ALLrpcbind mountd nfsd statd lockd rquotad : <IP地址列>$ sudo apt install rpcbind nfs-kernel-server/home @myclients(rw,sync,no_subtree_check)
/usr/local @myclients(rw,sync,no_subtree_check)/home 192.168.0.10(rw,sync,no_subtree_check) 192.168.0.11(rw,sync,no_subtree_check)
/usr/local 192.168.0.10(rw,sync,no_subtree_check) 192.168.0.11(rw,sync,no_subtree_check)/home 192.168.0.0/255.255.255.0(rw,sync,no_subtree_check)
/usr/local 192.168.0.0/255.255.255.0(rw,sync,no_subtree_check)$ sudo exportfs -ra$ sudo systemctl restart rpcbind
$ sudo systemctl restart nfs-kernel-server$ sudo mkdir /nfs
$ sudo mkdir /nfs/musicnfsServer:music /nfs/music nfs auto 0 0$ rmdir /home/user/Music
$ ln -s /nfs/music/ /home/user/Music$ sudo apt update
$ sudo apt install samba samba-common-bin smbclient cifs-utils$ mkdir windowshare$ sudo mount.cifs //<主机名或IP地址>/<Windows 共享文件夹> /home/<用户名>/windowshare -o user=<用户名>$ ls windowshare/$ sudo mount.cifs //IP/share /mnt/挂载点 -o user=<用户名>,vers=1.0$ cd ~
$ mkdir shared
$ chmod 0740 shared$ sudo smbpasswd -a <用户名>sudo nano /etc/samba/smb.conf[share]
path = /home/<用户名>/shared
read only = no
public = yes
writable = yesworkgroup = <你的workgroup工作组名称>sudo apt updatesudo apt install apache2 -ycd /var/www/html
ls -altotal 12
drwxr-xr-x 2 root root 4096 Jan 8 01:29 .
drwxr-xr-x 12 root root 4096 Jan 8 01:28 ..
-rw-r--r-- 1 root root 177 Jan 8 01:29 index.html$ sudo chown <用户名>: index.htmlsudo apt install php libapache2-mod-php -ysudo rm index.htmlsudo nano index.php<?php echo "hello world"; ?><?php echo date('Y-m-d H:i:s'); ?><?php phpinfo(); ?>$ echo program_usb_boot_mode=1 | sudo tee -a /boot/firmware/config.txt$ vcgencmd otp_dump | grep 17:
17:3020000a$ sudo nano /boot/firmware/config.txt$ sudo raspi-config$ vcgencmd bootloader_config$ ethtool -P eth0$ grep Serial /proc/cpuinfo | cut -d ' ' -f 2 | cut -c 9-16$ sudo mkdir -p /nfs/client1
$ sudo apt install rsync
$ sudo rsync -xa --progress --exclude /nfs / /nfs/client1$ cd /nfs/client1
$ sudo mount --bind /dev dev
$ sudo mount --bind /sys sys
$ sudo mount --bind /proc proc
$ sudo chroot .
$ rm /etc/ssh/ssh_host_*
$ dpkg-reconfigure openssh-server
$ exit
$ sudo umount dev sys proc$ ip route | awk '/default/ {print $3}'$ ip -4 addr show dev eth0 | grep inetinet 10.42.0.211/24 brd 10.42.0.255 scope global eth0$ cat /etc/resolv.conf$ sudo nano /etc/systemd/network/10-eth0.netdev[Match]
Name=eth0
[Network]
DHCP=no$ sudo nano /etc/systemd/network/11-eth0.network[Match]
Name=eth0
[Network]
Address=10.42.0.211/24
DNS=10.42.0.1
[Route]
Gateway=10.42.0.1$ sudo nano /etc/systemd/resolved.conf[Resolve]
DNS=10.42.0.1
#FallbackDNS=$ sudo systemctl enable systemd-networkd
$ sudo reboot$ sudo apt install tcpdump dnsmasq
$ sudo systemctl enable dnsmasq
$ sudo tcpdump -i eth0 port bootpcIP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from b8:27:eb...$ echo | sudo tee /etc/dnsmasq.conf
$ sudo nano /etc/dnsmasq.conf# 注意:如果你希望网络上的系统使用 DNS 服务,请注释掉端口。
port=0
dhcp-range=10.42.0.255,proxy
log-dhcp
enable-tftp
tftp-root=/tftpboot
pxe-service=0,"Raspberry Pi Boot"$ sudo mkdir /tftpboot
$ sudo chmod 777 /tftpboot
$ sudo systemctl enable dnsmasq.service
$ sudo systemctl restart dnsmasq.service$ journalctl -fraspberrypi dnsmasq-tftp[1903]: file /tftpboot/bootcode.bin not found$ cp -r /boot/firmware/* /tftpboot$ sudo systemctl restart dnsmasq$ sudo apt install nfs-kernel-server
$ echo "/nfs/client1 *(rw,sync,no_subtree_check,no_root_squash)" | sudo tee -a /etc/exports
$ echo "/tftpboot *(rw,sync,no_subtree_check,no_root_squash)" | sudo tee -a /etc/exports$ sudo systemctl enable rpcbind
$ sudo systemctl restart rpcbind
$ sudo systemctl enable nfs-kernel-server
$ sudo systemctl restart nfs-kernel-serverroot=/dev/nfs nfsroot=10.42.0.211:/nfs/client1,vers=3 rw ip=dhcp rootwait$ echo "10.42.0.211:/tftpboot /boot/firmware/ nfs defaults,vers=3 0 0" | sudo tee -a /nfs/client1/etc/fstab$ sudo apt-get install tftpd-hpa
$ sudo systemctl start tftpd-hpa$ sudo apt-get install isc-dhcp-serverDHCPDv6_CONF=/etc/dhcp/dhcpd6.conf
INTERFACESv6="eth0"not authoritative;
# 检查客户端是否像个树莓派
if option dhcp6.client-arch-type = 00:29 {
option dhcp6.bootfile-url "tftp://[fd49:869:6f93::1]/";
}
subnet6 fd49:869:6f93::/64 {
host test-rpi4 {
host-identifier option dhcp6.client-id 00:03:00:01:e4:5f:01:20:24:0b;
fixed-address6 fd49:869:6f93::1000;
}
}interface eth0
static ip6_address=fd49:869:6f93::1/64$ sudo systemctl restart isc-dhcp-server.serviceBOOT_ORDER=0xf21 # 2=网络启动
USE_IPV6=1 # 启用 IPv6 网络启动
BOOT_UART=1 # 调试sudo apt-get install ndisc6
rdisc6 -1 eth0Soliciting ff02::2 (ff02::2) on eth0...
Hop limit : 64 ( 0x40)
Stateful address conf. : No
Stateful other conf. : Yes
Mobile home agent : No
Router preference : medium
Neighbor discovery proxy : No
Router lifetime : 180 (0x000000b4) seconds
Reachable time : unspecified (0x00000000)
Retransmit time : unspecified (0x00000000)Hop limit : 64 ( 0x40)
Stateful address conf. : Yes
Stateful other conf. : Yes
Mobile home agent : No
Router preference : medium
Neighbor discovery proxy : No
Router lifetime : 180 (0x000000b4) seconds
Reachable time : unspecified (0x00000000)
Retransmit time : unspecified (0x00000000)Boot mode: NETWORK (02) order f
GENET: RESET_PHY
PHY ID 600d 84a2
NET_BOOT: e4:5f:01:20:24:0b wait for link TFTP6: (null)
LINK STATUS: speed: 100 full duplex
Link ready
GENET START: 64 16 32
GENET: UMAC_START 0xe45f0120 0x240b0000
RX6: 12 IP: 1 MAC: 1 ICMP: 1/1 UDP: 0/0 ICMP_CSUM_ERR: 0 UDP_CSUM_ERR: 0
NET fd49:869:6f93::1000 tftp fd49:869:6f93::1
RX6: 17 IP: 4 MAC: 4 ICMP: 2/2 UDP: 2/2 ICMP_CSUM_ERR: 0 UDP_CSUM_ERR: 0
TFTP_GET: dc:a6:32:6f:73:f4 fd49:869:6f93::1 ab5a4158/start4.elf
RX6: 17 IP: 4 MAC: 4 ICMP: 2/2 UDP: 2/2 ICMP_CSUM_ERR: 0 UDP_CSUM_ERR: 0
RX6: 18 IP: 5 MAC: 5 ICMP: 2/2 UDP: 3/3 ICMP_CSUM_ERR: 0 UDP_CSUM_ERR: 0
TFTP_GET: dc:a6:32:6f:73:f4 fd49:869:6f93::1 ab5a4158/config.txt$ sudo tcpdump -i eth0 -e ip6 -XX -l -v -vv12:23:35.387046 e4:5f:01:20:24:0b (oui Unknown) > 33:33:00:00:00:02 (oui Unknown), ethertype IPv6 (0x86dd), length 70: (hlim 255, next-header ICMPv6 (58) payload length: 16) fe80::e65f:1ff:fe20:240b > ip6-allrouters: [icmp6 sum ok] ICMP6, router solicitation, length 16
source link-address option (1), length 8 (1): e4:5f:01:20:24:0b
0x0000: e45f 0120 240b12:23:35.498902 60:8d:26:a7:c1:88 (oui Unknown) > 33:33:00:00:00:01 (oui Unknown), ethertype IPv6 (0x86dd), length 110: (hlim 255, next-header ICMPv6 (58) payload length: 56) bthub.home > ip6-allnodes: [icmp6 sum ok] ICMP6, router advertisement, length 56
hop limit 64, Flags [managed, other stateful], pref medium, router lifetime 180s, reachable time 0ms, retrans timer 0ms
rdnss option (25), length 24 (3): lifetime 60s, addr: bthub.home
0x0000: 0000 0000 003c fe80 0000 0000 0000 628d
0x0010: 26ff fea7 c188
mtu option (5), length 8 (1): 1492
0x0000: 0000 0000 05d4
source link-address option (1), length 8 (1): 60:8d:26:a7:c1:88
0x0000: 608d 26a7 c18812:23:35.502517 e4:5f:01:20:24:0b (oui Unknown) > 33:33:00:01:00:02 (oui Unknown), ethertype IPv6 (0x86dd), length 114: (hlim 255, next-header UDP (17) payload length: 60) fe80::e65f:1ff:fe20:240b.dhcpv6-client > ff02::1:2.dhcpv6-server: [udp sum ok] dhcp6 solicit (xid=8cdd56 (client-ID hwaddr type 1 e45f0120240b) (IA_NA IAID:0 T1:0 T2:0) (option-request opt_59) (opt_61) (elapsed-time 0))12:23:35.510478 dc:a6:32:6f:73:f4 (oui Unknown) > e4:5f:01:20:24:0b (oui Unknown), ethertype IPv6 (0x86dd), length 172: (flowlabel 0xad54d, hlim 64, next-header UDP (17) payload length: 118) fe80::537a:52c:c647:b184.dhcpv6-server > fe80::e65f:1ff:fe20:240b.dhcpv6-client: [bad udp cksum 0xd886 -> 0x6d26!] dhcp6 advertise (xid=8cdd56 (IA_NA IAID:0 T1:3600 T2:7200 (IA_ADDR fd49:869:6f93::1000 pltime:604800 vltime:2592000)) (client-ID hwaddr type 1 e45f0120240b) (server-ID hwaddr/time type 1 time 671211709 dca6326f73f4) (opt_59))12:23:35.510763 e4:5f:01:20:24:0b (oui Unknown) > 33:33:00:01:00:02 (oui Unknown), ethertype IPv6 (0x86dd), length 132: (hlim 255, next-header UDP (17) payload length: 78) fe80::e65f:1ff:fe20:240b.dhcpv6-client > ff02::1:2.dhcpv6-server: [udp sum ok] dhcp6 request (xid=8cdd56 (client-ID hwaddr type 1 e45f0120240b) (server-ID hwaddr/time type 1 time 671211709 dca6326f73f4) (IA_NA IAID:0 T1:0 T2:0) (option-request opt_59) (opt_61) (elapsed-time 1))12:23:35.512122 dc:a6:32:6f:73:f4 (oui Unknown) > e4:5f:01:20:24:0b (oui Unknown), ethertype IPv6 (0x86dd), length 172: (flowlabel 0xad54d, hlim 64, next-header UDP (17) payload length: 118) fe80::537a:52c:c647:b184.dhcpv6-server > fe80::e65f:1ff:fe20:240b.dhcpv6-client: [bad udp cksum 0xd886 -> 0x6826!] dhcp6 reply (xid=8cdd56 (IA_NA IAID:0 T1:3600 T2:7200 (IA_ADDR fd49:869:6f93::1000 pltime:604800 vltime:2592000)) (client-ID hwaddr type 1 e45f0120240b) (server-ID hwaddr/time type 1 time 671211709 dca6326f73f4) (opt_59))12:23:36.510768 e4:5f:01:20:24:0b (oui Unknown) > 33:33:ff:00:00:01 (oui Unknown), ethertype IPv6 (0x86dd), length 86: (hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::e65f:1ff:fe20:240b > ff02::1:ff00:1: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has fd49:869:6f93::1
source link-address option (1), length 8 (1): e4:5f:01:20:24:0b
0x0000: e45f 0120 240b12:23:36.510854 dc:a6:32:6f:73:f4 (oui Unknown) > e4:5f:01:20:24:0b (oui Unknown), ethertype IPv6 (0x86dd), length 86: (hlim 255, next-header ICMPv6 (58) payload length: 32) fd49:869:6f93::1 > fe80::e65f:1ff:fe20:240b: [icmp6 sum ok] ICMP6, neighbor advertisement, length 32, tgt is fd49:869:6f93::1, Flags [solicited, override]
destination link-address option (2), length 8 (1): dc:a6:32:6f:73:f4
0x0000: dca6 326f 73f412:23:36.530820 e4:5f:01:20:24:0b (oui Unknown) > dc:a6:32:6f:73:f4 (oui Unknown), ethertype IPv6 (0x86dd), length 111: (hlim 255, next-header UDP (17) payload length: 57) fd49:869:6f93::1000.61785 > fd49:869:6f93::1.tftp: [udp sum ok] 49 RRQ "ab5a4158/start4.elf" octet tsize 0 blksize 102412:55:27.541909 e4:5f:01:20:24:0b (oui Unknown) > 33:33:00:00:00:02 (oui Unknown), ethertype IPv6 (0x86dd), length 70: (hlim 255, next-header ICMPv6 (58) payload length: 16) fe80::e65f:1ff:fe20:240b > ip6-allrouters: [icmp6 sum ok] ICMP6, router solicitation, length 16
source link-address option (1), length 8 (1): e4:5f:01:20:24:0b
0x0000: e45f 0120 240b12:55:27.834684 60:8d:26:a7:c1:88 (oui Unknown) > 33:33:00:00:00:01 (oui Unknown), ethertype IPv6 (0x86dd), length 174: (hlim 255, next-header ICMPv6 (58) payload length: 120) bthub.home > ip6-allnodes: [icmp6 sum ok] ICMP6, router advertisement, length 120
hop limit 64, Flags [other stateful], pref medium, router lifetime 180s, reachable time 0ms, retrans timer 0ms
prefix info option (3), length 32 (4): 2a00:23c5:ee00:5001::/64, Flags [onlink, auto, router], valid time 300s, pref. time 120s
0x0000: 40e0 0000 012c 0000 0078 0000 0000 2a00
0x0010: 23c5 ee00 5001 0000 0000 0000 0000
prefix info option (3), length 32 (4): fd4d:869:6f93::/64, Flags [onlink, auto, router], valid time 10080s, pref. time 2880s
0x0000: 40e0 0000 2760 0000 0b40 0000 0000 fd4d
0x0010: 0869 6f93 0000 0000 0000 0000 0000
rdnss option (25), length 24 (3): lifetime 60s, addr: bthub.home
0x0000: 0000 0000 003c fe80 0000 0000 0000 628d
0x0010: 26ff fea7 c188
mtu option (5), length 8 (1): 1492
0x0000: 0000 0000 05d4
source link-address option (1), length 8 (1): 60:8d:26:a7:c1:88
0x0000: 608d 26a7 c18812:55:27.838300 e4:5f:01:20:24:0b (oui Unknown) > 33:33:00:01:00:02 (oui Unknown), ethertype IPv6 (0x86dd), length 98: (hlim 255, next-header UDP (17) payload length: 44) fe80::e65f:1ff:fe20:240b.dhcpv6-client > ff02::1:2.dhcpv6-server: [udp sum ok] dhcp6 inf-req (xid=e5e0a4 (client-ID hwaddr type 1 e45f0120240b) (option-request opt_59) (opt_61) (elapsed-time 0))12:55:27.838898 dc:a6:32:6f:73:f4 (oui Unknown) > e4:5f:01:20:24:0b (oui Unknown), ethertype IPv6 (0x86dd), length 150: (flowlabel 0xd1248, hlim 64, next-header UDP (17) payload length: 96) fe80::537a:52c:c647:b184.dhcpv6-server > fe80::e65f:1ff:fe20:240b.dhcpv6-client: [bad udp cksum 0xd870 -> 0x78bb!] dhcp6 reply (xid=e5e0a4 (client-ID hwaddr type 1 e45f0120240b) (server-ID hwaddr/time type 1 time 671211709 dca6326f73f4) (opt_59))12:55:28.834796 e4:5f:01:20:24:0b (oui Unknown) > 33:33:ff:1d:fe:2a (oui Unknown), ethertype IPv6 (0x86dd), length 86: (hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::e65f:1ff:fe20:240b > ff02::1:ff1d:fe2a: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2a00:23c5:ee00:5001:57f1:7523:2f1d:fe2a
source link-address option (1), length 8 (1): e4:5f:01:20:24:0b
0x0000: e45f 0120 240b12:55:28.834875 dc:a6:32:6f:73:f4 (oui Unknown) > e4:5f:01:20:24:0b (oui Unknown), ethertype IPv6 (0x86dd), length 86: (hlim 255, next-header ICMPv6 (58) payload length: 32) 2a00:23c5:ee00:5001:57f1:7523:2f1d:fe2a > fe80::e65f:1ff:fe20:240b: [icmp6 sum ok] ICMP6, neighbor advertisement, length 32, tgt is 2a00:23c5:ee00:5001:57f1:7523:2f1d:fe2a, Flags [solicited, override]
destination link-address option (2), length 8 (1): dc:a6:32:6f:73:f4
0x0000: dca6 326f 73f412:55:28.861097 e4:5f:01:20:24:0b (oui Unknown) > dc:a6:32:6f:73:f4 (oui Unknown), ethertype IPv6 (0x86dd), length 111: (hlim 255, next-header UDP (17) payload length: 57) 2a00:23c5:ee00:5001:e65f:1ff:fe20:240b.46930 > 2a00:23c5:ee00:5001:57f1:7523:2f1d:fe2a.tftp: [udp sum ok] 49 RRQ "ab5a4158/start4.elf" octet tsize 0 blksize 1024
































start_x、start_debugdisable_commandline_tagsarm_controlarmstubarm_peri_highkernel_addresskernel_oldinit_uart_baudinit_uart_clockbootcode_delayboot_delayboot_delay_msenable_gic(仅适用于树莓派 4)sha256uart_2ndstageupstream_kernelenable_jtag_gpionever_over_voltagedisable_auto_turbo[HDMI:*]gpu_memgpu_mem_256gpu_mem_512gpu_mem_1024disable_l2cachehdmi_safehdmi_ignore_edidhdmi_edid_filehdmi_edid_filenamehdmi_force_edid_audiohdmi_ignore_edid_audiohdmi_force_edid_3dhdmi_ignore_cec_inithdmi_ignore_ceccec_osd_namehdmi_pixel_encodinghdmi_max_pixel_freqhdmi_blankinghdmi_driveconfig_hdmi_boosthdmi_grouphdmi_modehdmi_timingshdmi_force_modeedid_content_typesdtv_modesdtv_aspectsdtv_disable_colourburstdisplay_default_lcdlcd_frameratelcd_rotateenable_dpi_lcddpi_group, dpi_mode, dpi_output_formatdpi_timingshdmi_force_hotplughdmi_ignore_hotplugdisable_overscanoverscan_leftoverscan_rightoverscan_topoverscan_bottomoverscan_scaleframebuffer_widthframebuffer_heightmax_framebuffer_height、max_framebuffer_widthframebuffer_depthframebuffer_ignore_alphaframebuffer_prioritymax_framebufferstest_modedisplay_hdmi_rotatedisplay_lcd_rotatedisplay_rotatedispmanx_offlineavoid_warningslogging_level start_file=start_x.elf
fixup_file=fixup_x.dat start_file=start_db.elf
fixup_file=fixup_db.dat [HDMI:0]
hdmi_group=2
hdmi_mode=45
[HDMI:1]
hdmi_group=2
hdmi_mode=67 hdmi_group:0=2
hdmi_mode:0=45
hdmi_group:1=2
hdmi_mode:1=67hdmi_force_hotplug=1
hdmi_ignore_edid=0xa5000080
config_hdmi_boost=4
hdmi_group=2
hdmi_mode=4
disable_overscan=0
overscan_left=24
overscan_right=24
overscan_top=24
overscan_bottom=24hdmi_edid_file=1
hdmi_edid_filename:0=FileForPortZero.edid
hdmi_edid_filename:1=FileForPortOne.edidhdmi_timings=<水平有效像素> <水平同步极性> <水平前沿填充> <水平同步脉冲> <水平后沿填充> <垂直有效行数> <垂直同步极性> <垂直前沿填充> <垂直同步脉冲> <垂直后沿填充> <垂直同步偏移量A> <垂直同步偏移量B> <像素复制> <帧率> <隔行> <像素频率> <宽高比><水平有效像素> = 水平像素(宽度)
<水平同步极性> = 反转水平同步信号极性
<水平上沿填充> = 从数据使能(DE)信号激活后的水平上沿填充
<水平同步脉冲> = 水平同步信号脉冲宽度(以像素时钟为单位)
<水平下沿填充> = 从数据使能(DE)信号激活后的水平下沿填充
<垂直有效行数> = 垂直像素高度(行数)
<垂直同步极性> = 反转垂直同步信号极性
<垂直上沿填充> = 从数据使能(DE)信号激活后的垂直上沿填充
<垂直同步脉冲> = 垂直同步信号脉冲宽度(以像素时钟为单位)
<垂直下沿填充> = 从数据使能(DE)信号激活后的垂直下沿填充
<垂直同步偏移量 A> = 保持为零
<垂直同步偏移量 B> = 保持为零
<像素复制> = 保持为零
<帧率> = 屏幕刷新率(以赫兹为单位)
<隔行> = 保持为零
<像素频率> = 时钟频率(水平有效像素 + 水平前沿填充 + 水平同步脉冲 + 水平后沿填充)
*(垂直有效行数 + 垂直前沿填充 + 垂直同步脉冲 + 垂直后沿填充)
* 刷新率
<宽高比> = [参见脚注]hdmi_cvt=<宽> <高> <帧率> <宽高比> <边距> <交错> <降低清屏时间>hdmi_cvt=800 480 60 6
hdmi_group=2
hdmi_mode=87
hdmi_drive=2dpi_timings=<水平有效像素> <水平同步极性> <水平前沿填充> <水平同步脉冲> <水平后沿填充> <垂直有效行数> <垂直同步极性> <垂直前沿填充> <垂直同步脉冲> <垂直后沿填充> <垂直同步偏移量 A> <垂直同步偏移量 B> <像素复制> <帧率> <隔行> <像素频率> <宽高比><水平有效像素> = 水平像素(宽度)
<水平同步极性> = 反转水平同步信号极性
<水平上沿填充> = 从数据使能(DE)信号激活后的水平上沿填充
<水平同步脉冲> = 水平同步信号脉冲宽度(以像素时钟为单位)
<水平下沿填充> = 从数据使能(DE)信号激活后的水平下沿填充
<垂直有效行数> = 垂直像素高度(行数)
<垂直同步极性> = 反转垂直同步信号极性
<垂直上沿填充> = 从数据使能(DE)信号激活后的垂直上沿填充
<垂直同步脉冲> = 垂直同步信号脉冲宽度(以像素时钟为单位)
<垂直下沿填充> = 从数据使能(DE)信号激活后的垂直下沿填充
<垂直同步偏移量 A> = 保持为零
<垂直同步偏移量 B> = 保持为零
<像素复制> = 保持为零
<帧率> = 屏幕刷新率(Hz)
<隔行> = 保持为零
<像素频率> = 时钟频率(水平有效像素 + 水平前沿填充 + 水平同步脉冲 + 水平后沿填充)
*(垂直有效行数 + 垂直前沿填充 + 垂直同步脉冲 + 垂直后沿填充)
* 刷新率
<宽高比> = [参见脚注]hdmi_group=2
hdmi_mode=87
hdmi_cvt=1360 768 60rpicam-appslibcamerarpicam-hellorpicam-jpegrpicam-stillrpicam-vidrpicam-vid 与 libav 的集成rpicam-rawrpicam-detectrpicam-apps 在网络上进行视频流传输libavhelpversionlist-camerascameraconfigtimeoutpreviewfullscreenqt-previewnopreviewinfo-textwidth 和 heightviewfinder-width 和 viewfinder-heightmodeviewfinder-modelores-width 和 lores-heighthflipvfliprotationroihdrsharpnesscontrastbrightnesssaturationevshuttergainmeteringexposureawbawbgainsdenoisetuning-fileautofocus-modeautofocus-windowautofocus-speedautofocus-rangelens-positionverboseoutputwrapflushpost-process-filequalityexiftimelapseframestartdatetimetimestamprestartimmediatekeypresssignalthumbencodingrawlatestautofocus-on-capturequalitybitrateintraprofilelevelcodecsave-ptskeypresssignalinitialsplitsegmentcircularinlinelistenframesframeratelibav 参数libav-formatlibav-audioaudio-codecaudio-bitrateaudio-samplerateaudio-deviceav-syncobjectgaprpicam-apps 进行后处理motion_detect 阶段annotate_cv 阶段object_classify_tf 阶段pose_estimation_tf 阶段object_detect_tf 阶段segmentation_tf 阶段rpicam-appslibcamera 和 rpicam-appsrpicam-apps 而不构建 libcamera。rpicam-appslibepoxyrpicam-hellorpicam-vidrpicam-rawrpicam-jpeglibcamera 与 Qtrpicam 和 raspicam 之间的差异-inopreview 禁用显示窗口,以释放一些额外的 CPU 循环。| 全局色调映射应用强度 | || 一个分段线性函数,定义了添加回色调映射 LP 图像时应用于局部对比度的增益,用于正(亮)细节 | || 定义将应用于局部对比度的增益的分段线性函数,当添加回色调映射的 LP 图像时,用于负(暗)细节 | || 应用于所有局部对比度的整体增益,然后添加回去 | |rpicam-apps 派生的应用程序。slots:Q_EMITemitQ_FOREACHforeachraspicamdtoverlay=vc4-kms-v3d/boot/config.txtsudo reboot

















#undef signals
#undef slots
#undef emit
#undef foreach$ sudo echo 0 > /sys/module/imx477/parameters/dpc_enable$ rpicam-hello$ rpicam-hello --timeout 0$ rpicam-hello -n$ rpicam-hello --info-text "red gain %rg, blue gain %bg"$ rpicam-jpeg --output test.jpg$ rpicam-jpeg --output test.jpg --timeout 2000 --width 640 --height 480$ rpicam-still --output test.jpg$ rpicam-still --encoding png --output test.png$ rpicam-still --raw --output test.jpgFile Name : test.dng
Directory : .
File Size : 24 MB
File Modification Date/Time : 2021:08:17 16:36:18+01:00
File Access Date/Time : 2021:08:17 16:36:18+01:00
File Inode Change Date/Time : 2021:08:17 16:36:18+01:00
File Permissions : rw-r--r--
File Type : DNG
File Type Extension : dng
MIME Type : image/x-adobe-dng
Exif Byte Order : Little-endian (Intel, II)
Make : Raspberry Pi
Camera Model Name : /base/soc/i2c0mux/i2c@1/imx477@1a
Orientation : Horizontal (normal)
Software : rpicam-still
Subfile Type : Full-resolution Image
Image Width : 4056
Image Height : 3040
Bits Per Sample : 16
Compression : Uncompressed
Photometric Interpretation : Color Filter Array
Samples Per Pixel : 1
Planar Configuration : Chunky
CFA Repeat Pattern Dim : 2 2
CFA Pattern 2 : 2 1 1 0
Black Level Repeat Dim : 2 2
Black Level : 256 256 256 256
White Level : 4095
DNG Version : 1.1.0.0
DNG Backward Version : 1.0.0.0
Unique Camera Model : /base/soc/i2c0mux/i2c@1/imx477@1a
Color Matrix 1 : 0.8545269369 -0.2382823821 -0.09044229197 -0.1890484985 1.063961506 0.1062747385 -0.01334283455 0.1440163847 0.2593136724
As Shot Neutral : 0.4754476844 1 0.413686484
Calibration Illuminant 1 : D65
Strip Offsets : 0
Strip Byte Counts : 0
Exposure Time : 1/20
ISO : 400
CFA Pattern : [Blue,Green][Green,Red]
Image Size : 4056x3040
Megapixels : 12.3
Shutter Speed : 1/20$ rpicam-still -o long_exposure.jpg --shutter 100000000 --gain 1 --awbgains 1,1 --immediate$ mkdir timelapse$ rpicam-still --timeout 30000 --timelapse 2000 -o timelapse/image%04d.jpg#!/bin/bash
DATE=$(date +"%Y-%m-%d_%H%M")
rpicam-still -o /home/<用户名>/timelapse/$DATE.jpg$ chmod +x timelapse.sh$ mkdir timelapse$ crontab -e* * * * * /home/<用户名>/timelapse.sh 2>&1crontab: installing new crontab$ sudo apt install ffmpeg$ ffmpeg -r 10 -f image2 -pattern_type glob -i 'timelapse/*.jpg' -s 1280x720 -vcodec libx264 timelapse.mp4$ rpicam-vid -t 10s -o test.h264$ vlc test.h264$ rpicam-vid -t 10s -o test.mp4$ rpicam-vid -t 10000 --codec mjpeg -o test.mjpeg$ rpicam-vid -t 10000 --codec yuv420 -o test.data$ rpicam-vid -t 10000 --codec mjpeg --segment 1 -o test%05d.jpeg$ rpicam-vid --level 4.2 --framerate 120 --width 1280 --height 720 --save-pts timestamp.pts -o video.264 -t 10000 --denoise cdn_off -n$ rpicam-vid --codec libav --libav-format avi --libav-audio --output example.avi$ rpicam-raw -t 2000 -o test.raw$ rpicam-raw -t 2000 --segment 1 -o test%05d.raw$ rpicam-raw -t 5000 --width 4056 --height 3040 -o test.raw --framerate 8$ rpicam-detect -t 0 -o cat%04d.jpg --lores-width 400 --lores-height 300 --post-process-file object_detect_tf.json --object cat$ rpicam-hello --tuning-file /usr/share/libcamera/ipa/rpi/pisp/imx219_noir.json$ rpicam-vid -t 0 --inline -o udp://<IP地址>:<端口>$ vlc udp://@:<端口> :demux=h264$ ffplay udp://<服务器IP>:<端口> -fflags nobuffer -flags low_delay -framedrop$ rpicam-vid -t 0 --inline --listen -o tcp://0.0.0.0:<端口>$ vlc tcp/h264://<服务器IP>:<端口>$ ffplay tcp://<服务器IP>:<端口> -vf "setpts=N/30" -fflags nobuffer -flags low_delay -framedrop$ rpicam-vid -t 0 --inline -o - | cvlc stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/stream1}' :demux=h264$ ffplay rtsp://<服务器IP>:8554/stream1 -vf "setpts=N/30" -fflags nobuffer -flags low_delay -framedrop$ vlc rtsp://<服务器IP>:8554/stream1$ rpicam-vid -t 0 --codec libav --libav-format mpegts --libav-audio -o "tcp://<IP地址>:<端口>?listen=1"$ rpicam-vid -t 0 --codec libav --libav-format mpegts --libav-audio -o "udp://<IP地址>:<端口>"$ rpicam-vid -t 0 -n --inline -o - | gst-launch-1.0 fdsrc fd=0 ! udpsink host=<IP地址> port=<端口>$ gst-launch-1.0 udpsrc address=<IP地址> port=<端口> ! h264parse ! v4l2h264dec ! autovideosink$ rpicam-vid -t 0 -n --inline -o - | gst-launch-1.0 fdsrc fd=0 ! h264parse ! rtph264pay ! udpsink host=<IP地址> port=<端口>$ gst-launch-1.0 udpsrc address=<IP地址> port=<端口> caps=application/x-rtp ! rtph264depay ! h264parse ! v4l2h264dec ! autovideosink$ gst-launch-1.0 udpsrc address=<IP地址> port=<端口> caps=application/x-rtp ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink$ gst-launch-1.0 libcamerasrc ! capsfilter caps=video/x-raw,width=1280,height=720,format=NV12 ! v4l2convert ! v4l2h264enc extra-controls="controls,repeat_sequence_header=1" ! 'video/x-h264,level=(string)4.1' ! h264parse ! rtph264pay ! udpsink host=<IP地址> port=<端口>rpicam-apps build: ca559f46a97a 27-09-2021 (14:10:24)
libcamera build: v0.0.0+3058-c29143f7Available cameras
-----------------
0 : imx219 [3280x2464] (/base/soc/i2c0mux/i2c@1/imx219@10)
Modes: 'SRGGB10_CSI2P' : 640x480 [206.65 fps - (1000, 752)/1280x960 crop]
1640x1232 [41.85 fps - (0, 0)/3280x2464 crop]
1920x1080 [47.57 fps - (680, 692)/1920x1080 crop]
3280x2464 [21.19 fps - (0, 0)/3280x2464 crop]
'SRGGB8' : 640x480 [206.65 fps - (1000, 752)/1280x960 crop]
1640x1232 [41.85 fps - (0, 0)/3280x2464 crop]
1920x1080 [47.57 fps - (680, 692)/1920x1080 crop]
3280x2464 [21.19 fps - (0, 0)/3280x2464 crop]
1 : imx477 [4056x3040] (/base/soc/i2c0mux/i2c@1/imx477@1a)
Modes: 'SRGGB10_CSI2P' : 1332x990 [120.05 fps - (696, 528)/2664x1980 crop]
'SRGGB12_CSI2P' : 2028x1080 [50.03 fps - (0, 440)/4056x2160 crop]
2028x1520 [40.01 fps - (0, 0)/4056x3040 crop]
4056x3040 [10.00 fps - (0, 0)/4056x3040 crop]timeout=99000
verbose=$ rpicam-hello --config example_configuration.txt$ mkvmerge -o test.mkv --timecodes 0:timestamps.txt test.h264$ pactl list | grep -A2 'Source #' | grep 'Name: 'Name: alsa_output.platform-bcm2835_audio.analog-stereo.monitor
Name: alsa_output.platform-fef00700.hdmi.hdmi-stereo.monitor
Name: alsa_output.usb-GN_Netcom_A_S_Jabra_EVOLVE_LINK_000736B1214E0A-00.analog-stereo.monitor
Name: alsa_input.usb-GN_Netcom_A_S_Jabra_EVOLVE_LINK_000736B1214E0A-00.mono-fallback{
"negate": {}
}$ rpicam-hello --post-process-file negate.json{
"sobel_cv":
{
"ksize": 5
},
"negate": {}
}{
"negate" : {}
}$ rpicam-hello --post-process-file negate.json{
"hdr" : {
"num_frames" : 1,
"lp_filter_strength" : 0.2,
"lp_filter_threshold" : [ 0, 10.0 , 2048, 205.0, 4095, 205.0 ],
"global_tonemap_points" :
[
{ "q": 0.1, "width": 0.05, "target": 0.15, "max_up": 1.5, "max_down": 0.7 },
{ "q": 0.5, "width": 0.05, "target": 0.5, "max_up": 1.5, "max_down": 0.7 },
{ "q": 0.8, "width": 0.05, "target": 0.8, "max_up": 1.5, "max_down": 0.7 }
],
"global_tonemap_strength" : 1.0,
"local_pos_strength" : [ 0, 6.0, 1024, 2.0, 4095, 2.0 ],
"local_neg_strength" : [ 0, 4.0, 1024, 1.5, 4095, 1.5 ],
"local_tonemap_strength" : 1.0,
"local_colour_scale" : 0.9
}
}$ rpicam-still -o test.jpg --post-process-file drc.json{
"hdr" : {
"num_frames" : 8,
"lp_filter_strength" : 0.2,
"lp_filter_threshold" : [ 0, 10.0 , 2048, 205.0, 4095, 205.0 ],
"global_tonemap_points" :
[
{ "q": 0.1, "width": 0.05, "target": 0.15, "max_up": 5.0, "max_down": 0.5 },
{ "q": 0.5, "width": 0.05, "target": 0.45, "max_up": 5.0, "max_down": 0.5 },
{ "q": 0.8, "width": 0.05, "target": 0.7, "max_up": 5.0, "max_down": 0.5 }
],
"global_tonemap_strength" : 1.0,
"local_pos_strength" : [ 0, 6.0, 1024, 2.0, 4095, 2.0 ],
"local_neg_strength" : [ 0, 4.0, 1024, 1.5, 4095, 1.5 ],
"local_tonemap_strength" : 1.0,
"local_colour_scale" : 0.8
}
}$ rpicam-still -o test.jpg --ev -2 --denoise cdn_off --post-process-file hdr.json{
"motion_detect" : {
"roi_x" : 0.1,
"roi_y" : 0.1,
"roi_width" : 0.8,
"roi_height" : 0.8,
"difference_m" : 0.1,
"difference_c" : 10,
"region_threshold" : 0.005,
"frame_period" : 5,
"hskip" : 2,
"vskip" : 2,
"verbose" : 0
}
}$ rpicam-hello --lores-width 128 --lores-height 96 --post-process-file motion_detect.json{
"sobel_cv" : {
"ksize": 5
}
}{
"face_detect_cv" : {
"cascade_name" : "/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml",
"scaling_factor" : 1.1,
"min_neighbors" : 2,
"min_size" : 32,
"max_size" : 256,
"refresh_rate" : 1,
"draw_features" : 1
}
}{
"annotate_cv" : {
"text" : "Frame %frame exp %exp ag %ag dg %dg",
"fg" : 255,
"bg" : 0,
"scale" : 1.0,
"thickness" : 2,
"alpha" : 0.3
}
}{
"object_classify_tf" : {
"top_n_results" : 2,
"refresh_rate" : 30,
"threshold_high" : 0.6,
"threshold_low" : 0.4,
"model_file" : "/home/<用户名>/models/mobilenet_v1_1.0_224_quant.tflite",
"labels_file" : "/home/<用户名>/models/labels.txt",
"display_labels" : 1
},
"annotate_cv" : {
"text" : "",
"fg" : 255,
"bg" : 0,
"scale" : 1.0,
"thickness" : 2,
"alpha" : 0.3
}
}$ rpicam-hello --post-process-file object_classify_tf.json --lores-width 224 --lores-height 224{
"pose_estimation_tf" : {
"refresh_rate" : 5,
"model_file" : "posenet_mobilenet_v1_100_257x257_multi_kpt_stripped.tflite"
},
"plot_pose_cv" : {
"confidence_threshold" : -0.5
}
}$ rpicam-hello --post-process-file pose_estimation_tf.json --lores-width 258 --lores-height 258{
"object_detect_tf" : {
"number_of_threads" : 2,
"refresh_rate" : 10,
"confidence_threshold" : 0.5,
"overlap_threshold" : 0.5,
"model_file" : "/home/<用户名>/models/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29/detect.tflite",
"labels_file" : "/home/<用户名>/models/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29/labelmap.txt",
"verbose" : 1
},
"object_detect_draw_cv" : {
"line_thickness" : 2
}
}$ rpicam-hello --post-process-file object_detect_tf.json --lores-width 400 --lores-height 300{
"segmentation_tf" : {
"number_of_threads" : 2,
"refresh_rate" : 10,
"model_file" : "/home/<用户名>/models/lite-model_deeplabv3_1_metadata_2.tflite",
"labels_file" : "/home/<用户名>/models/segmentation_labels.txt",
"draw" : 1,
"verbose" : 1
}
}$ rpicam-hello --post-process-file segmentation_tf.json --lores-width 258 --lores-height 258 --viewfinder-width 1024 --viewfinder-height 1024$ sudo apt install -y libcamera-dev libepoxy-dev libjpeg-dev libtiff5-dev libpng-dev$ sudo apt install -y qtbase5-dev libqt5core5a libqt5gui5 libqt5widgets5$ sudo apt install libavcodec-dev libavdevice-dev libavformat-dev libswresample-dev$ sudo apt install -y git$ sudo apt install -y python3-pip git python3-jinja2$ sudo apt install -y libboost-dev
$ sudo apt install -y libgnutls28-dev openssl libtiff5-dev pybind11-dev
$ sudo apt install -y qtbase5-dev libqt5core5a libqt5gui5 libqt5widgets5
$ sudo apt install -y meson cmake
$ sudo apt install -y python3-yaml python3-ply
$ sudo apt install -y libglib2.0-dev libgstreamer-plugins-base1.0-dev$ git clone https://github.com/raspberrypi/libcamera.git$ cd libcamera$ meson setup build --buildtype=release -Dpipelines=rpi/vc4,rpi/pisp -Dipas=rpi/vc4,rpi/pisp -Dv4l2=true -Dgstreamer=enabled -Dtest=false -Dlc-compliance=disabled -Dcam=disabled -Dqcam=disabled -Ddocumentation=disabled -Dpycamera=enabled$ ninja -C build$ sudo ninja -C build install$ sudo apt install -y cmake libboost-program-options-dev libdrm-dev libexif-dev
$ sudo apt install -y meson ninja-build$ git clone https://github.com/raspberrypi/rpicam-apps.git$ cd rpicam-apps$ meson setup build -Denable_libav=enabled -Denable_drm=enabled -Denable_egl=enabled -Denable_qt=enabled -Denable_opencv=disabled -Denable_tflite=disabled$ meson setup build -Denable_libav=disabled -Denable_drm=enabled -Denable_egl=disabled -Denable_qt=disabled -Denable_opencv=disabled -Denable_tflite=disabled$ meson compile -C build$ sudo meson install -C build$ sudo apt install -y libegl1-mesa-dev$ git clone https://github.com/anholt/libepoxy.git$ cd libepoxy$ mkdir _build
$ cd _build$ meson$ ninja$ sudo ninja installCompletedRequestPtr &completed_request = std::get<CompletedRequestPtr>(msg.payload);
app.ShowPreview(completed_request, app.ViewfinderStream());app.SetEncodeOutputReadyCallback(std::bind(&Output::OutputReady, output.get(), _1, _2, _3, _4));app.StopCamera();
app.Teardown();
app.ConfigureStill();
app.StartCamera();$ sudo apt install -y python3-picamera2$ sudo apt install -y python3-picamera2 --no-install-recommends$ sudo apt install fswebcam$ sudo usermod -a -G video <用户名>$ fswebcam image.jpg--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
Adjusting resolution from 384x288 to 352x288.
--- Capturing frame...
Corrupt JPEG data: 2 extraneous bytes before marker 0xd4
Captured frame in 0.00 seconds.
--- Processing captured image...
Writing JPEG image to 'image.jpg'.$ fswebcam -r 1280x720 image2.jpg--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
--- Capturing frame...
Corrupt JPEG data: 1 extraneous bytes before marker 0xd5
Captured frame in 0.00 seconds.
--- Processing captured image...
Writing JPEG image to 'image2.jpg'.$ fswebcam --no-banner image3.jpg--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
--- Capturing frame...
Corrupt JPEG data: 2 extraneous bytes before marker 0xd6
Captured frame in 0.00 seconds.
--- Processing captured image...
Disabling banner.
Writing JPEG image to 'image3.jpg'.#!/bin/bash
DATE=$(date +"%Y-%m-%d_%H-%M-%S")
fswebcam -r 1280x720 --no-banner $DATE.jpg$ chmod +x webcam.sh$ ./webcam.sh--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
--- Capturing frame...
Corrupt JPEG data: 2 extraneous bytes before marker 0xd6
Captured frame in 0.00 seconds.
--- Processing captured image...
Disabling banner.
Writing JPEG image to '2024-05-10_12-06-33.jpg'.$ crontab -e* * * * * /home/<用户名>/webcam.sh 2>&1crontab: installing new crontab|------------------------|
| bcm2835-unicam |
|------------------------|
^ |
| |-------------|
img | | Subdevice |
| |-------------|
v -SW/HW- |
|---------| |-----------|
| Unicam | | I²C 或 SPI|
|---------| |-----------|
csi2/ ^ |
ccp2 | |
|-----------------|
| sensor |
|-----------------|dtoverlay=adv728x-m,adv7280m=1raspi-configraspi-configraspi-config 控制音频cmdline.txt)sudo 命令要求密码fail2ban 阻挡可疑活动sudoers 文件boot 的内容bootcode.binstart*.elffixup*.datcmdline.txtconfig.txtissue.txtinitramfs*ssh(ssh.txt)*.dtb)*.img)overlays(叠加层)/include/ 的补充说明config.txt/chosen/bootloader/chosen/power/chosen/bootloader/chosen/bootloader/usbdtmerge、dtdiff 和 ovmerge 测试叠加层。config.txt 中可用的其他设备树命令dt-blob 的各个部分videocorepins_*pin_configpin@pinnamepin_definesmyssid,密码为 my passphrase:Would you like a login shell to be accessible over serial?(您是否想要通过串口访问登录 shell?)处,回答“No”alsastartdtoverlay-predtoverlay-postdt-blob.bin 设置(当前位置)












$ sudo raspi-config$ sudo raspi-config nonint <命令> <参数> [可选参数]$ sudo raspi-config nonint do_wifi_ssid_passphrase <网络名称> <密码> [隐藏的网络] [明文]$ sudo raspi-config nonint do_wifi_ssid_passphrase myssid mypassphrase$ sudo raspi-config nonint do_wifi_ssid_passphrase myssid mypassphrase 1$ sudo raspi-config nonint do_audio <数字>$ sudo raspi-config nonint do_change_pass$ sudo raspi-config nonint do_hostname <主机名>$ sudo raspi-config nonint do_boot_behaviour <B1/B2/B3/B4>$ sudo raspi-config nonint do_boot_wait <0/1>$ sudo raspi-config nonint do_boot_splash <0/1>$ sudo raspi-config nonint do_leds <0/1>$ sudo raspi-config nonint do_browser <chromium-browser/firefox>$ sudo raspi-config nonint do_overscan_kms <device> <enabled>$ sudo raspi-config nonint do_blanking <0/1>$ sudo raspi-config nonint do_vnc_resolution <宽>x<高>$ sudo raspi-config nonint do_pi4video <V1或V2或V3>$ sudo raspi-config nonint do_composite <0或1>$ sudo raspi-config nonint do_ssh <0或1>$ sudo raspi-config nonint do_vnc <0或1>$ sudo raspi-config nonint do_spi <0或1>$ sudo raspi-config nonint do_i2c <0或1>$ sudo raspi-config nonint do_serial_hw <0或1>$ sudo raspi-config nonint do_serial_cons <0或1>$ sudo raspi-config nonint do_onewire <0或1>$ sudo raspi-config nonint do_rgpio <0或1>$ sudo raspi-config nonint do_overclock <设置>$ sudo raspi-config nonint do_memory_split <megabytes>$ sudo raspi-config nonint do_overlayfs <0或1>$ sudo raspi-config nonint do_fan <0/1> [gpio] [onTemp]$ sudo raspi-config nonint do_change_locale <语言环境>$ sudo raspi-config nonint do_change_timezone <时区>$ sudo raspi-config nonint do_configure_keyboard <键盘布局>$ sudo raspi-config nonint do_wifi_country <区域码>$ sudo raspi-config nonint do_expand_rootfs$ sudo raspi-config nonint do_net_names <0或1>$ sudo raspi-config nonint do_proxy <代理服务器的协议类型> <代理服务器的地址>$ sudo raspi-config nonint do_boot_order <B1或B2或B3>$ sudo raspi-config nonint do_boot_rom <E1或E2>$ sudo raspi-config nonint do_wayland <W1或W2>$ sudo raspi-config nonint do_audioconf <1或2>$ sudo raspi-config nonint do_update$ arandr$ kmsprint | grep Connector[output:HDMI-A-1]
mode = 1920x1080@60$ wlr-randr --output HDMI-A-1 --transform normal
$ wlr-randr --output HDMI-A-1 --transform 90
$ wlr-randr --output HDMI-A-1 --transform 180
$ wlr-randr --output HDMI-A-1 --transform 270[output:HDMI-A-1]
mode = 1920x1080@60
transform = 270$ sudo raspi-config$ sudo raspi-config$ nmcli radio wifi$ nmcli radio wifi on$ nmcli dev wifi listIN-USE BSSID SSID MODE CHAN RATE SIGNAL BARS SECURITY
90:72:40:1B:42:05 myNetwork Infra 132 405 Mbit/s 89 **** WPA2
90:72:42:1B:78:04 myNetwork5G Infra 11 195 Mbit/s 79 *** WPA2
9C:AB:F8:88:EB:0D Pi Towers Infra 1 260 Mbit/s 75 *** WPA2 802.1X
B4:2A:0E:64:BD:BE Example Infra 6 195 Mbit/s 37 ** WPA1 WPA2$ sudo nmcli --ask dev wifi connect <网络名称>$ nmcli dev wifi listIN-USE BSSID SSID MODE CHAN RATE SIGNAL BARS SECURITY
* 90:72:40:1B:42:05 myNetwork Infra 132 405 Mbit/s 89 **** WPA2
90:72:42:1B:78:04 myNetwork5G Infra 11 195 Mbit/s 79 *** WPA2
9C:AB:F8:88:EB:0D Pi Towers Infra 1 260 Mbit/s 75 *** WPA2 802.1X
B4:2A:0E:64:BD:BE Example Infra 6 195 Mbit/s 37 ** WPA1 WPA2$ sudo nmcli dev wifi connect <网络名称>$ sudo nmcli --ask dev wifi connect <网络名称> hidden yes$ nmcli --fields autoconnect-priority,name connectionAUTOCONNECT-PRIORITY NAME
0 myNetwork
0 lo
0 Pi Towers
0 Example
-999 Wired connection 1$ nmcli connection modify "Pi Towers" connection.autoconnect-priority 10AUTOCONNECT-PRIORITY NAME
-1 snake
0 rabbit
1 cat
1000 dog$ sudo raspi-config[idle]
dpms_timeout=600$ sudo nano /boot/firmware/cmdline.txt$ sudo reboot$ cat /sys/module/kernel/parameters/consoleblank$ sudo raspi-config$ passwd$ sudo adduser <用户名>$ sudo usermod -a -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi <用户名>$ sudo su - <用户名>$ sudo deluser -remove-home <用户名>$ sudo raspi-config$ sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL$ sudo apt update
$ sudo apt install exfat-fuse$ sudo apt update
$ sudo apt install ntfs-3g$ sudo blkid$ sudo mkdir /mnt/mydisk$ sudo mount /dev/sda1 /mnt/mydisk$ ls /mnt/mydisk$ sudo blkid$ sudo nano /etc/fstabUUID=5C24-1453 /mnt/mydisk fstype defaults,auto,users,rw,nofail 0 0$ sudo umount /mnt/mydisk$ sudo apt update
$ sudo apt install lsof$ lsof /mnt/mydisk$ sudo nano /boot/firmware/cmdline.txt$ cat /proc/cmdlinevideo=HDMI-A-1:1920x1080M@60video=HDMI-A-1:1920x1080M@60,rotate=90,reflect_x$ sudo visudo /etc/sudoers.d/010_<用户名>-nopasswd<用户名> ALL=(ALL) PASSWD: ALL$ apt install openssh-server$ sudo nano /etc/ssh/sshd_configAllowUsers alice bobDenyUsers jane john$ sudo systemctl restart ssh$ sudo apt install ufw$ sudo ufw enable$ sudo ufw disable$ sudo ufw allow 22$ sudo ufw deny 22$ sudo ufw deny 22/tcp$ sudo ufw allow ssh$ sudo ufw status$ sudo ufw limit ssh/tcp$ sudo ufw deny from 192.168.2.1 port 30$ sudo apt install fail2ban$ sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local$ sudo nano /etc/fail2ban/jail.local[ssh]
enabled = true
port = ssh
filter = sshd
backend = systemd
maxretry = 6# 默认禁止操作(例如:iptables、iptables-new、
# iptables-multiport、shorewall 等)。用于定义
# 变量 action_*,可以全局/部分覆盖
# 文件 jail.local
banaction = iptables-multiport[ssh]
enabled = true
port = ssh
filter = sshd
backend = systemd
maxretry = 3
bantime = -1$ openssl passwd -6$ sudo nmcli device wifi hotspot ssid <网络名称> password <密码>$ sudo nmcli device disconnect wlan0$ sudo nmcli device up wlan0$ sudo nmcli connection add type bridge con-name 'Bridge' ifname bridge0$ sudo nmcli connection add type ethernet slave-type bridge \
con-name 'Ethernet' ifname eth0 master bridge0$ sudo nmcli connection modify 'Hotspot' master bridge0$ sudo nmcli connection add con-name 'Hotspot' \
ifname wlan0 type wifi slave-type bridge master bridge0 \
wifi.mode ap wifi.ssid Hotspot wifi-sec.key-mgmt wpa-psk \
wifi-sec.proto rsn wifi-sec.pairwise ccmp \
wifi-sec.psk <热点密码>$ sudo nmcli connection up Bridge$ sudo nmcli connection up Hotspot$ sudo nano /etc/environmentexport http_proxy="http://<代理IP地址>:<代理端口>"export http_proxy="http://<用户名>:<密码>@代理IP地址:代理端口"export https_proxy="http://<用户名>:<密码>@代理IP地址:代理端口"export no_proxy="localhost, 127.0.0.1"export http_proxy="http://<用户名>:<密码>@代理IP地址:代理端口"
export https_proxy="http://<用户名>:<密码>@代理IP地址:代理端口"
export no_proxy="localhost, 127.0.0.1"$ sudo visudoDefaults env_keep+="http_proxy https_proxy no_proxy"dtoverlay=uart1,txd1_pin=32,rxd1_pin=33dtparam=krnbt=offearlycon=pl011,0x107d001000,115200n8earlycon=uart8250,mmio32,0xfe215040
earlycon=pl011,mmio32,0xfe201000earlycon=uart8250,mmio32,0x3f215040
earlycon=pl011,mmio32,0x3f201000earlycon=uart8250,mmio32,0x20215040
earlycon=pl011,mmio32,0x20201000dtoverlay=disable-bt/dts-v1/;
/include/ "common.dtsi";
/ {
node1 {
a-string-property = "A string";
a-string-list-property = "first string", "second string";
a-byte-data-property = [0x01 0x23 0x34 0x56];
cousin: child-node1 {
first-child-property;
second-child-property = <1>;
a-string-property = "Hello, world";
};
child-node2 {
};
};
node2 {
an-empty-property;
a-cell-property = <1 2 3 4>; /* 每个数字(cell)都是 uint32。*/
child-node1 {
my-cousin = <&cousin>;
};
};
};
/node2 {
another-property-for-node2;
};string-property = "a string";cell-property = <0xbeef 123 0xabcd1234>;binary-property = [01 23 45 67 89 ab cd ef];mixed-property = "a string", [01 23 45 67], <0x12345678>;string-list = "red fish", "blue fish";/node2 {
an-empty-property;
a-cell-property = <1 2 3 4>; /* 每个数字(cell)都是 uint32 */
another-property-for-node2;
child-node1 {
my-cousin = <&cousin>;
};
};// 开启 i2s 接口
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835";
fragment@0 {
target = <&i2s>;
__overlay__ {
status = "okay";
test_ref = <&test_label>;
test_label: test_subnode {
dummy;
};
};
};
};/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835";
};
&i2s {
status = "okay";
test_ref = <&test_label>;
test_label: test_subnode {
dummy;
};
};$ dtc -I dts -O dtb -o 2nd.dtbo 2nd-overlay.dtsLabel or path i2s not found$ dtc -@ -Hepapr -I dts -O dtb -o 1st.dtbo 1st-overlay.dts$ make ARCH=arm dtbs$ fdtdump 1st.dtbo/dts-v1/;
// magic: 0xd00dfeed
// totalsize: 0x207 (519)
// off_dt_struct: 0x38
// off_dt_strings: 0x1c8
// off_mem_rsvmap: 0x28
// version: 17
// last_comp_version: 16
// boot_cpuid_phys: 0x0
// size_dt_strings: 0x3f
// size_dt_struct: 0x190
/ {
compatible = "brcm,bcm2835";
fragment@0 {
target = <0xffffffff>;
__overlay__ {
status = "okay";
test_ref = <0x00000001>;
test_subnode {
dummy;
phandle = <0x00000001>;
};
};
};
__symbols__ {
test_label = "/fragment@0/__overlay__/test_subnode";
};
__fixups__ {
i2s = "/fragment@0:target:0";
};
__local_fixups__ {
fragment@0 {
__overlay__ {
test_ref = <0x00000000>;
};
};
};
};name = <&label>,"property";name = <&label>,"property.offset"; // 8-bit
name = <&label>,"property;offset"; // 16-bit
name = <&label>,"property:offset"; // 32-bit
name = <&label>,"property#offset"; // 64-bitboolean_property; // 设置 “boolean_property” 为 truename = <&标签>,"属性?";name = <&标签>,"<属性>!";mac_address = <ðernet0>,"local_mac_address[";local_mac_address = [aa bb cc dd ee ff];__overrides__ {
gpiopin = <&w1>,"gpios:4",
<&w1_pins>,"brcm,pins:0";
...
};str_val = <&target>,"strprop=value"; // 1
int_val = <&target>,"intprop:0=42" // 2
int_val2 = <&target>,"intprop:0=",<42>; // 3
bytes = <&target>,"bytestr[=b8:27:eb:01:23:45"; // 4// 强制 LED 使用内置 GPIO 控制器上的 GPIO。
exp_led = <&led1>,"gpios:0=",<&gpio>,
<&led1>,"gpios:4";phonetic = <&node>,"letter{a=alpha,b=bravo,c=charlie,d,e,='tango uniform'}";
bus = <&fragment>,"target:0{0=",<&i2c0>,"1=",<&i2c1>,"}";+<n> // 启用片段 <n>
-<n> // 禁用片段 <n>
=<n> // 如果指定的参数值为 true,则启用片段 <n>,否则禁用片段 <n>。
!<n> // 如果指定的参数值为 false,则启用片段 <n>,否则禁用片段 <n>。just_one = <0>,"+1-2"; // 开启 1,禁用 2
conditional = <0>,"=3!4"; // 如果值为 true,则启用 3,禁用 4。
// 如果值为 false,则禁用 3,启用 4。bmp280@76 {
reg = <0x77>;
...
};/ {
disable-bt {
bcm2835;
bcm2711;
bcm2712 = "disable-bt-pi5";
};
disable-bt-pi5 {
bcm2712;
};
uart5 {
bcm2711;
};
pi3-disable-bt {
renamed = "disable-bt";
};
lirc-rpi {
deprecated = "use gpio-ir";
};
};/ {
fragment@0 {
target-path = "/";
__overlay__ {
test: test_node {
string = "hello";
status = "disabled";
bytes = /bits/ 8 <0x67 0x89>;
u16s = /bits/ 16 <0xabcd 0xef01>;
u32s = /bits/ 32 <0xfedcba98 0x76543210>;
u64s = /bits/ 64 < 0xaaaaa5a55a5a5555 0x0000111122223333>;
bool1; // 默认为 true
// bool2 默认为 false
mac = [01 23 45 67 89 ab];
spi = <&spi0>;
};
};
};
fragment@1 {
target-path = "/";
__overlay__ {
frag1;
};
};
fragment@2 {
target-path = "/";
__dormant__ {
frag2;
};
};
__overrides__ {
string = <&test>,"string";
enable = <&test>,"status";
byte_0 = <&test>,"bytes.0";
byte_1 = <&test>,"bytes.1";
u16_0 = <&test>,"u16s;0";
u16_1 = <&test>,"u16s;2";
u32_0 = <&test>,"u32s:0";
u32_1 = <&test>,"u32s:4";
u64_0 = <&test>,"u64s#0";
u64_1 = <&test>,"u64s#8";
bool1 = <&test>,"bool1!";
bool2 = <&test>,"bool2?";
entofr = <&test>,"english",
<&test>,"french{hello=bonjour,goodbye='au revoir',weekend}";
pi_mac = <&test>,"mac[{1=b8273bfedcba,2=b8273b987654}";
spibus = <&test>,"spi:0[0=",<&spi0>,"1=",<&spi1>,"2=",<&spi2>;
only1 = <0>,"+1-2";
only2 = <0>,"-1+2";
enable1 = <0>,"=1";
disable2 = <0>,"!2";
};
}; ...
public: ...
__exports__ {
public; // 将标签“public”导出到基本设备树 (DT)
};
};dtoverlay=acme-board
dtparam=foo=bar,level=42dtparam=audio=on,i2c_arm=on,i2c_arm_baudrate=400000,spi=ondtoverlay=lirc-rpi
dtparam=gpio_out_pin=16
dtparam=gpio_in_pin=17
dtparam=gpio_in_pull=downdtoverlay=lirc-rpi,gpio_out_pin=16,gpio_in_pin=17,gpio_in_pull=downdtoverlay=i2c/i2c_arm
i2c_vc
i2c_baudrate/i2c_arm_baudrate
i2c_vc_baudratefragment@0 {
target = <&i2c_arm>;
__overlay__ {
status = "okay";
};
};Usage:
dtoverlay <overlay> [<param>=<val>...]
Add an overlay (with parameters)
dtoverlay -D [<idx>] Dry-run (prepare overlay, but don't apply -
save it as dry-run.dtbo)
dtoverlay -r [<overlay>] Remove an overlay (by name, index or the last)
dtoverlay -R [<overlay>] Remove from an overlay (by name, index or all)
dtoverlay -l List active overlays/params
dtoverlay -a List all overlays (marking the active)
dtoverlay -h Show this usage message
dtoverlay -h <overlay> Display help on an overlay
dtoverlay -h <overlay> <param>.. Or its parameters
where <overlay> is the name of an overlay or 'dtparam' for dtparams
Options applicable to most variants:
-d <dir> Specify an alternate location for the overlays
(defaults to /boot/firmware/overlays or /flash/overlays)
-v Verbose operationblconfig_alias="/sys/firmware/devicetree/base/aliases/blconfig"
blconfig_nvmem_path=""
if [ -f "${blconfig_alias}" ]; then
blconfig_ofnode_path="/sys/firmware/devicetree/base"$(strings "${blconfig_alias}")""
blconfig_ofnode_link=$(find -L /sys/bus/nvmem -samefile "${blconfig_ofnode_path}" 2>/dev/null)
if [ -e "${blconfig_ofnode_link}" ]; then
blconfig_nvmem_path=$(dirname "${blconfig_ofnode_link}")
fi
fi
fi$ sudo vclog --msg$ dtc -I fs /proc/device-tree.of_match_table = xxx_of_match,MODULE_DEVICE_TABLE(of, xxx_of_match);$ dtc -I fs -O dtb -o base.dtb /proc/device-tree$ dtmerge /boot/firmware/bcm2710-rpi-3-b.dtb base.dtb -$ dtmerge base.dtb merged.dtb - sd_overclock=62
$ dtdiff base.dtb merged.dtb--- /dev/fd/63 2016-05-16 14:48:26.396024813 +0100
+++ /dev/fd/62 2016-05-16 14:48:26.396024813 +0100
@@ -594,7 +594,7 @@
};
sdhost@7e202000 {
- brcm,overclock-50 = <0x0>;
+ brcm,overclock-50 = <0x3e>;
brcm,pio-limit = <0x1>;
bus-width = <0x4>;
clocks = <0x8>;$ dtmerge base.dtb merged1.dtb /boot/firmware/overlays/spi1-1cs.dtbo
$ dtmerge base.dtb merged2.dtb /boot/firmware/overlays/spi1-2cs.dtbo
$ dtdiff merged1.dtb merged2.dtb--- /dev/fd/63 2016-05-16 14:18:56.189634286 +0100
+++ /dev/fd/62 2016-05-16 14:18:56.189634286 +0100
@@ -453,7 +453,7 @@
spi1_cs_pins {
brcm,function = <0x1>;
- brcm,pins = <0x12>;
+ brcm,pins = <0x12 0x11>;
phandle = <0x3e>;
};
@@ -725,7 +725,7 @@
#size-cells = <0x0>;
clocks = <0x13 0x1>;
compatible = "brcm,bcm2835-aux-spi";
- cs-gpios = <0xc 0x12 0x1>;
+ cs-gpios = <0xc 0x12 0x1 0xc 0x11 0x1>;
interrupts = <0x1 0x1d>;
linux,phandle = <0x30>;
phandle = <0x30>;
@@ -743,6 +743,16 @@
spi-max-frequency = <0x7a120>;
status = "okay";
};
+
+ spidev@1 {
+ #address-cells = <0x1>;
+ #size-cells = <0x0>;
+ compatible = "spidev";
+ phandle = <0x41>;
+ reg = <0x1>;
+ spi-max-frequency = <0x7a120>;
+ status = "okay";
+ };
};
spi@7e2150C0 {device_tree=my-pi.dtbdevice_tree=dtparam=i2c_arm=on
dtparam=i2s=ondtparam=i2c,i2s$ sudo dtc -I dts -O dtb -o /boot/firmware/dt-blob.bin dt-blob.dts$ dtc -I dtb -O dts -o dt-blob.dts /boot/firmware/dt-blob.binclock_routing {
vco@PLLA { freq = <1966080000>; };
chan@APER { div = <4>; };
clock@GPCLK0 { pll = "PLLA"; chan = "APER"; };
};
clock_setup {
clock@PWM { freq = <2400000>; };
clock@GPCLK0 { freq = <12288000>; };
clock@GPCLK1 { freq = <25000000>; };
};$ sudo raspi-config nonint do_wifi_ssid_passphrase myssid "my passphrase" 0 0

raspi-config 来更新引导加载程序rpi-eeprom-updaterecovery.binbootcode.bin 专用启动模式bootcode.bin 串口bootcode.bin——仅引导模式BOOT_ORDERtryboot_a_b 模式BOOT_UARTUART_BAUDWAKE_ON_GPIOPOWER_OFF_ON_HALTBOOT_ORDERMAX_RESTARTSSD_BOOT_MAX_RETRIESNET_BOOT_MAX_RETRIESDHCP_TIMEOUTDHCP_REQ_TIMEOUTTFTP_FILE_TIMEOUTTFTP_IPTFTP_PREFIXTFTP_PREFIX_STRPXE_OPTION43DHCP_OPTION97MAC_ADDRESSMAC_ADDRESS_OTPDISABLE_HDMIHDMI_DELAYENABLE_SELF_UPDATEFREEZE_VERSIONHTTP_HOSTHTTP_PORTHTTP_PATHIMAGER_REPO_URLNET_INSTALL_ENABLEDNET_INSTALL_KEYBOARD_WAITNETCONSOLE - 高级日志记录PARTITIONPSU_MAX_CURRENTUSB_MSD_EXCLUDE_VID_PIDUSB_MSD_DISCOVER_TIMEOUTUSB_MSD_LUN_TIMEOUTUSB_MSD_PWR_OFF_TIMEUSB_MSD_STARTUP_DELAYVL805XHCI_DEBUG[config.txt] 部分rpi-otp-private-key 将密钥编程到 OTP 中。config.txtraspi-configprogram_usb_boot_timeout=1 已设置,则为 5 秒)<哈希值>usb_max_current_enable=1usb_max_current_enable




$ sudo apt install cpufrequtils
$ sudo cpufreq-set -g powersave$ vcgencmd measure_temp$ sudo raspi-config$ sudo apt update*** UPDATE AVAILABLE ***
BOOTLOADER: update available
CURRENT: Thu 18 Jan 13:59:23 UTC 2024 (1705586363)
LATEST: Mon 22 Jan 10:41:21 UTC 2024 (1705920081)
RELEASE: latest (/lib/firmware/raspberrypi/bootloader-2711/latest)
Use raspi-config to change the release.
VL805_FW: Using bootloader EEPROM
VL805: up to date
CURRENT: 000138c0
LATEST: 000138c0$ sudo rpi-eeprom-update -a
$ sudo rebootBOOTLOADER: up to date
CURRENT: Mon 22 Jan 10:41:21 UTC 2024 (1705920081)
LATEST: Mon 22 Jan 10:41:21 UTC 2024 (1705920081)
RELEASE: latest (/lib/firmware/raspberrypi/bootloader-2711/latest)
Use raspi-config to change the release.
VL805_FW: Using bootloader EEPROM
VL805: up to date
CURRENT: 000138c0
LATEST: 000138c0$ rpi-eeprom-config$ rpi-eeprom-config pieeprom.bin$ sudo -E rpi-eeprom-config --edit
$ sudo reboot$ sudo rpi-eeprom-config --apply boot.conf
$ sudo reboot$ sudo systemctl mask rpi-eeprom-update$ sudo systemctl unmask rpi-eeprom-update$ vcgencmd bootloader_version$ sudo rpi-eeprom-update$ sudo rpi-eeprom-update -a
$ sudo reboot$ sudo rpi-eeprom-update -r$ sudo rpi-eeprom-update -d -f pieeprom.bin$ rpi-eeprom-update -h$ rpi-eeprom-config --config boot.conf --out new.bin pieeprom.bin$ strings bootcode.bin | grep BOOT_UART$ sed -i -e "s/BOOT_UART=0/BOOT_UART=1/" bootcode.binprogram_usb_boot_mode=1$ vcgencmd otp_dump | grep 17:
17:3020000a$ vcgencmd otp_dump | grep 17:$ sudo tcpdump -i eth0 -w dump.pcap6:44:38.717115 IP (tos 0x0, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 348)
0.0.0.0.68 > 255.255.255.255.67: [no cksum] BOOTP/DHCP, Request from b8:27:eb:28:f6:6d, length 320, xid 0x26f30339, Flags [none] (0x0000)
Client-Ethernet-Address b8:27:eb:28:f6:6d
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Discover
Parameter-Request Option 55, length 12:
Vendor-Option, Vendor-Class, BF, Option 128
Option 129, Option 130, Option 131, Option 132
Option 133, Option 134, Option 135, TFTP
ARCH Option 93, length 2: 0
NDI Option 94, length 3: 1.2.1
GUID Option 97, length 17: 0.68.68.68.68.68.68.68.68.68.68.68.68.68.68.68.68
Vendor-Class Option 60, length 32: "PXEClient:Arch:00000:UNDI:002001"
END Option 255, length 0
16:44:41.224619 IP (tos 0x0, ttl 64, id 57713, offset 0, flags [none], proto UDP (17), length 372)
192.168.1.1.67 > 192.168.1.139.68: [udp sum ok] BOOTP/DHCP, Reply, length 344, xid 0x26f30339, Flags [none] (0x0000)
Your-IP 192.168.1.139
Server-IP 192.168.1.1
Client-Ethernet-Address b8:27:eb:28:f6:6d
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Offer
Server-ID Option 54, length 4: 192.168.1.1
Lease-Time Option 51, length 4: 43200
RN Option 58, length 4: 21600
RB Option 59, length 4: 37800
Subnet-Mask Option 1, length 4: 255.255.255.0
BR Option 28, length 4: 192.168.1.255
Vendor-Class Option 60, length 9: "PXEClient"
GUID Option 97, length 17: 0.68.68.68.68.68.68.68.68.68.68.68.68.68.68.68.68
Vendor-Option Option 43, length 32: 6.1.3.10.4.0.80.88.69.9.20.0.0.17.82.97.115.112.98.101.114.114.121.32.80.105.32.66.111.111.116.255
END Option 255, length 016:44:41.224964 IP (tos 0x0, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 49)
192.168.1.139.49152 > 192.168.1.1.69: [no cksum] 21 RRQ "bootcode.bin" octet
16:44:41.227223 IP (tos 0x0, ttl 64, id 57714, offset 0, flags [none], proto UDP (17), length 544)
192.168.1.1.55985 > 192.168.1.139.49152: [udp sum ok] UDP, length 516
16:44:41.227418 IP (tos 0x0, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 32)
192.168.1.139.49152 > 192.168.1.1.55985: [no cksum] UDP, length 4program_gpio_bootmode=ncrw------- 1 root root 245, 0 Mar 9 14:58 /dev/nvme0
brw-rw---- 1 root disk 259, 0 Mar 9 14:58 /dev/nvme0n1$ sudo rpi-eeprom-update$ sudo raspi-config$ sudo rpi-eeprom-update -aBoot mode: SD (01) order f64
Boot mode: USB-MSD (04) order f6
Boot mode: NVME (06) order f
VID 0x144d MN Samsung SSD 970 EVO Plus 250GB
NVME onRead start4.elf bytes 2937840 hnd 0x00050287 hash ''MESS:00:00:07.096119:0: brfs: File read: /mfs/sd/kernel8.img
MESS:00:00:07.098682:0: Loading 'kernel8.img' to 0x80000 size 0x1441a00
MESS:00:00:07.146055:0:[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd083]NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:0 0 232.9G 0 disk
├─nvme0n1p1 259:1 0 256M 0 part /boot/firmware
└─nvme0n1p2 259:2 0 232.6G 0 part /[gpio8=0]
BOOT_ORDER=0xf7
HTTP_HOST=downloads.raspberrypi.org
NET_INSTALL_ENABLED=0$ rpi-eeprom-config -c boot.conf -p mypubkey.pem -o pieeprom.upd pieeprom.original.bin$ rpi-eeprom-digest -i pieeprom.upd -o pieeprom.sig$ rpi-eeprom-digest -i boot.img -o boot.sig -k myprivkey.pem$ openssl x509 -in your_ca_root_cert.pem -out cert.der -outform DER$ sha256sum cert.der701bd97f67b0f5483a9734e6e5cf72f9a123407b346088638f597878563193fc cert.der$ sudo rpi-eeprom-config --edit[all]
BOOT_UART=1
POWER_OFF_ON_HALT=0
BOOT_ORDER=0xf461
[gpio8=0]
BOOT_ORDER=0xf7
NET_INSTALL_ENABLED=0
HTTP_HOST=<你的网站>
HTTP_PATH=<文件路径>
HTTP_CACERT_HASH=<哈希值>$ rpi-eeprom-config -c boot.conf -p mypubkey.pem -o pieeprom.bin --cacertder cert.der pieeprom.original.bin
$ rpi-eeprom-digest -k myprivkey.pem -i pieeprom.bin -o pieeprom.sigLoading boot.img ...
HTTP: GET request for https://yourserver.org:443/path/to/files/boot.sig
HTTP: GET request for https://yourserver.org:443/path/to/files/boot.img$ sudo reboot '0 tryboot'$ rpi-eeprom-config$ sudo -E rpi-eeprom-config --editMAC_ADDRESS_OTP=0,136:247e0000
37:e45f0120src_port@src_ip/dev_name,dst_port@dst_ip/dst_mac
E.g. [email protected]/,6666@/# Enable debug if GPIO 7 is pulled low
[gpio7=0]
[email protected]/,6666@/# Boot from partition 2 if GPIO 7 is pulled low
[gpio7=0]
PARTITION=2# Enable mass storage and USB descriptor logging
XHCI_DEBUG=0x3dtparam=i2c_arm=off
dtparam=spi=offdisplay_auto_detect=1dtoverlay=vc4-kms-kippah-7inch-overlaydtoverlay=vc4-kms-v3d
dtoverlay=vc4-kms-dpi-generic,hactive=480,hfp=26,hsync=16,hbp=10
dtparam=vactive=640,vfp=25,vsync=10,vbp=16
dtparam=clock-frequency=32000000,rgb666-padhi$ sudo usermod -a -G gpio <username>$ vcgencmd otp_dump$ vcmailbox 0x00010004 8 8 0 00x00000020 0x80000000 0x00010004 0x00000008 0x800000008 0xnnnnnnnn 0x00000000 0x00000000$ vcmailbox 0x00038021 [8 + number * 4] [8 + number * 4] [start_num] [number] [value] [value] [value] ...$ vcmailbox 0x00038021 20 20 4 3 0x11111111 0x22222222 0x33333333$ vcmailbox 0x00030021 20 20 4 3 0 0 00x0000002c 0x80000000 0x00030021 0x00000014 0x80000014 0x00000000 0x00000003 0x11111111 0x22222222 0x33333333$ vcmailbox 0x00038021 8 8 0xffffffff 0xaffe0000$ vcmailbox 0x00030086 4 4 0$ vcmailbox 0x00038021 8 8 0xffffffff 0xaffebabe$ vcmailbox 0x00030083 6 6 0 0
0x00000020 0x80000000 0x00030083 0x00000006 0x80000006 0xddccbbaa 0x0000ffee 0x00000000$ vcmailbox 0x00030085 6 6 0x44332211 0x6655$ sudo vclog -m
1057826.701: read mac address 11:22:33:44:55:66$ vcmailbox 0x00038082 6 6 0x44332211 0x6655$ cd usbboot/tools
$ rpi-otp-private-keyf8dbc7b0a4fcfb1d706e298ac9d0485c2226ce8df7f7596ac77337bd09fbe160$ rpi-otp-private-key -w $(openssl rand -hex 32)$ vcmailbox 0x00030081 40 40 0 8 0 0 0 0 0 0 0 00x00000040 0x80000000 0x00030081 0x00000028 0x80000028 0x00000000 0x00000008 0xf8dbc7b0 0xa4fcfb1d 0x706e298a 0xc9d0485c 0x2226ce8d 0xf7f7596a 0xc77337bd 0x09fbe160 0x00000000$ vcmailbox 0x00038081 40 40 0 8 0 0 0 0 0 0 0 0$ vcmailbox 0x38081 40 40 0 8 0xf8dbc7b0 0xa4fcfb1d 0x706e298a 0xc9d0485c 0x2226ce8d 0xf7f7596a 0xc77337bd 0x09fbe160$ vcgencmd otp_dumpdtparam=pciex1$ sudo rpi-eeprom-config --editBOOT_ORDER=0xf416PCIE_PROBE=1dtparam=pciex1_gen=3$ sudo raspi-config$ vcgencmd get_config usb_max_current_enableBOOT_UART=1
POWER_OFF_ON_HALT=1
BOOT_ORDER=0xf416$ vcgencmd pmic_read_adc$ sudo -E rpi-eeprom-config --editPOWER_OFF_ON_HALT=1
WAKE_ON_GPIO=0$ echo +600 | sudo tee /sys/class/rtc/rtc0/wakealarm
$ sudo halt[ 1.295799] rpi-rtc soc:rpi_rtc: setting system clock to 2023-08-16T15:58:50 UTC (1692201530)/sys/devices/platform/soc/soc:rpi_rtc/rtc/rtc0/charging_voltage:0
/sys/devices/platform/soc/soc:rpi_rtc/rtc/rtc0/charging_voltage_max:4400000
/sys/devices/platform/soc/soc:rpi_rtc/rtc/rtc0/charging_voltage_min:1300000dtparam=rtc_bbat_vchg=3000000#1 芯片选择
dtoverlay=spi1-1cs
#2 芯片选择
dtoverlay=spi1-2cs
#3 芯片选择
dtoverlay=spi1-3cs$ echo -ne "\x01\x02\x03" > /dev/spidev0.0$ wget https://raw.githubusercontent.com/raspberrypi/linux/rpi-6.1.y/tools/spi/spidev_test.c
$ gcc -o spidev_test spidev_test.c
$ ./spidev_test -D /dev/spidev0.0
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
FF FF FF FF FF FF
40 00 00 00 00 95
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
DE AD BE EF BA AD
F0 0D$ cat /proc/cpuinfoHardware : BCM2835
Revision : a02082
Serial : 00000000765fc593NOQuuuWuFMMMCCCCPPPPTTTTTTTTRRRR$ cat /proc/cpuinfo | grep Revision
Revision : c03111#include <stdio.h>
#include <stdlib.h>
int main( int argc, char *argv[] )
{
FILE *fp;
char revcode[32];
fp = popen("cat /proc/cpuinfo | awk '/Revision/ {print $3}'", "r");
if (fp == NULL)
exit(1);
fgets(revcode, sizeof(revcode), fp);
pclose(fp);
int code = strtol(revcode, NULL, 16);
int new = (code >> 23) & 0x1;
int model = (code >> 4) & 0xff;
int mem = (code >> 20) & 0x7;
if (new && model == 0x11 && mem >= 3) // 请注意,mem 字段中的 3 代表 2GB
printf("我们是 4B 机型,内存至少为 2GB !\n" );
return 0;
}import subprocess
cmd = "cat /proc/cpuinfo | awk '/Revision/ {print $3}'"
revcode = subprocess.check_output(cmd, shell=True)
code = int(revcode, 16)
new = (code >> 23) & 0x1
model = (code >> 4) & 0xff
mem = (code >> 20) & 0x7
if new and model == 0x11 and mem >= 3 : # 请注意, mem 字段中的 3 代表 2GB
print("我们是 4B 机型,内存至少为 2GB !")$ cat /proc/device-tree/compatible | tr '\0' '\n'
raspberrypi,5-model-b
brcm,bcm2712































