赞
踩
git clone https://github.com/linux-sunxi/sunxi-tools
cd sunxi-tools/
make
git clone https://github.com/ARM-software/arm-trusted-firmware.git
cd arm-trusted-firmware
make CROSS_COMPILE=aarch64-linux-gnu- PLAT=<platform> DEBUG=1 bl31
# platform = sun50i-h616
git clone git://git.denx.de/u-boot.git
cd u-boot
# 注释掉 DCDC4 的设置 axp313并没有这路输出 int axp_set_dcdc4(unsigned int mvolt) { int ret; u8 cfg; #if 0 if (mvolt >= 1600) cfg = AXP305_DCDC4_1600MV_OFFSET + axp305_mvolt_to_cfg(mvolt, 1600, 3300, 100); else cfg = axp305_mvolt_to_cfg(mvolt, 600, 1500, 20); if (mvolt == 0) return pmic_bus_clrbits(AXP305_OUTPUT_CTRL1, AXP305_OUTPUT_CTRL1_DCDCD_EN); ret = pmic_bus_write(AXP305_DCDCD_VOLTAGE, cfg); if (ret) return ret; return pmic_bus_setbits(AXP305_OUTPUT_CTRL1, AXP305_OUTPUT_CTRL1_DCDCD_EN); #endif return 0; } # 添加 DCDC3 的电压设置 #define AXP305_DCDC3_1200MV_OFFSET 71 int axp_set_dcdc3(unsigned int mvolt) { int ret; u8 cfg; if (mvolt >= 1220) { cfg = AXP305_DCDC3_1200MV_OFFSET + axp305_mvolt_to_cfg(mvolt, 1220, 1840, 20); } else cfg = axp305_mvolt_to_cfg(mvolt, 500, 1200, 10); if (mvolt == 0) return pmic_bus_clrbits(AXP305_OUTPUT_CTRL1, AXP305_OUTPUT_CTRL1_DCDCD_EN); ret = pmic_bus_write(AXP305_DCDCD_VOLTAGE, cfg); if (ret) return ret; return pmic_bus_setbits(AXP305_OUTPUT_CTRL1, 0x1f); } # 修改芯片版本的检测 以及 设置 DCDC3 的电压为1.5v int axp_init(void) { u8 axp_chip_id; int ret; ret = pmic_bus_init(); if (ret) return ret; ret = pmic_bus_read(AXP305_CHIP_VERSION, &axp_chip_id); if (ret) return ret; // if ((axp_chip_id & AXP305_CHIP_VERSION_MASK) != 0x40) // return -ENODEV; if ((axp_chip_id & AXP305_CHIP_VERSION_MASK) != 0x4b) return -ENODEV; printf("pmic id is 0x%x\n",axp_chip_id); axp_set_dcdc3(1500); return ret; }
make CROSS_COMPILE=aarch64-linux-gnu- BL31=../arm-trusted-firmware/build/sun50i_h616/debug/bl31.bin orangepi_zero2_defconfig
make CROSS_COMPILE=aarch64-linux-gnu- BL31=../arm-trusted-firmware/build/sun50i_h616/debug/bl31.bin
../sunxi-tools/sunxi-fel uboot u-boot-sunxi-with-spl.bin
U-Boot SPL 2022.10-rc3-00069-g67fe8cc001-dirty (Sep 03 2022 - 18:10:41 +0800) pmic id is 0x4b DRAM: 1024 MiB Trying to boot from FEL NOTICE: BL31: v2.7(debug):v2.7.0-312-g9a5dec669 NOTICE: BL31: Built : 17:14:37, Sep 3 2022 NOTICE: BL31: Detected Allwinner H616 SoC (1823) NOTICE: BL31: Found U-Boot DTB at 0x4a081ff0, model: OrangePi Zero2 INFO: ARM GICv2 driver initialized INFO: Configuring SPC Controller INFO: PMIC: Probing AXP305 on RSB ERROR: RSB: set run-time address: 0x10003 INFO: Could not init RSB: -65539 INFO: BL31: Platform setup done INFO: BL31: Initializing runtime services INFO: BL31: cortex_a53: CPU workaround for 855873 was applied INFO: BL31: cortex_a53: CPU workaround for 1530924 was applied INFO: PSCI: Suspend is unavailable INFO: BL31: Preparing for EL3 exit to normal world INFO: Entry point address = 0x4a000000 INFO: SPSR = 0x3c9 INFO: Changed devicetree. U-Boot 2022.10-rc3-00069-g67fe8cc001-dirty (Sep 03 2022 - 18:10:41 +0800) Allwinner Technology CPU: Allwinner H616 (SUN50I) Model: OrangePi Zero2 DRAM: 1 GiB Core: 49 devices, 17 uclasses, devicetree: separate WDT: Not starting watchdog@30090a0 MMC: mmc@4020000: 0 Loading Environment from FAT... MMC: no card present ** Bad device specification mmc 0 ** In: serial@5000000 Out: serial@5000000 Err: serial@5000000 Hit any key to stop autoboot: 0 MMC: no card present =>
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
# 速度较慢,直接去官网下载 mainline 内核:https://kernel.org
# 解压内核
tar -xvzf linux-6.0-rc3.tar.gz
/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts
# 因为 MQ-Quad 的 3.3v 是没接 pmic 来控制的,所以要添加固定 3.3v 的节点 # 在 reg_vcc5v 节点下面添加 reg_vcc3v3 节点 (否则无法初始化IO,导致串口无法初始化) reg_vcc3v3: vcc3v3 { compatible = "regulator-fixed"; regulator-name = "vcc-3v3"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-always-on; }; # 修改 pio 节点中的 reg_aldo1 为 reg_vcc3v3 &pio { vcc-pc-supply = <®_vcc3v3>; vcc-pf-supply = <®_vcc3v3>; vcc-pg-supply = <®_vcc3v3>; vcc-ph-supply = <®_vcc3v3>; vcc-pi-supply = <®_vcc3v3>; }; # 修改 mmc0 的 vmmc-supply 的 reg_dcdce 为 reg_vcc3v3(否则无法启动 sunxi-mmc 驱动) &mmc0 { vmmc-supply = <®_vcc3v3>; cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */ bus-width = <4>; status = "okay"; };
# 使用默认配置 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig # 编译内核镜像 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j8 Image # 编译设备树 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j8 dtbs # 编译模块(可选,后面做了文件系统后再使用) make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j8 modules make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=<any-path-you-like> modules modules_install 构建成功后,可以在提供的 INSTALL_MOD_PATH 目录中找到模块 # 安装头文件(可选,后面做了文件系统后再使用) make ARCH=arm64 INSTALL_HDR_PATH=<any-path-you-like> headers_install 将 INSTALL_HDR_PATH 更改为希望安装到的路径,例如/usr或<some_prefix>/usr 方便后期交叉编译
vi boot.cmd
# 复制以下内容
setenv bootargs console=ttyS0,115200
booti 0x40200000 - 0x4fa00000
mkimage -C none -A arm64 -T script -d boot.cmd boot.scr
sunxi-fel -v uboot u-boot-sunxi-with-spl.bin \
write 0x40200000 Image \
write 0x4fa00000 sun50i-a64-pine64-lts.dtb \
write 0x4fc00000 boot.scr \
write 0x4ff00000 rootfs.cpio.lzma.uboot
# 例如:
./sunxi-tools/sunxi-fel -v uboot u-boot/u-boot-sunxi-with-spl.bin \
write 0x40200000 linux-6.0-rc3/arch/arm64/boot/Image \
write 0x4fa00000 linux-6.0-rc3/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dtb \
write 0x4fc00000 boot.scr
# 进入磁盘管理 fdisk /dev/sdd # 多执行几次删除所有分区 d # 新建分区 (扇区为单位,前面空开20MB用于存放uboot,制作128MB的分区) n p 40960 303104 w # 进行 FAT 格式化 sudo mkfs.fat /dev/sdd1 # 写入 uboot 到 8KB 的位置 sudo dd if=./u-boot/u-boot-sunxi-with-spl.bin of=/dev/sdd bs=8K seek=1 # 挂载 FAT 文件系统 sudo mount /dev/sdd1 /mnt/boot/ # 复制内核以及设备树到FAT分区 sudo cp linux-6.0-rc3/arch/arm64/boot/Image /mnt/boot/ sudo cp linux-6.0-rc3/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dtb /mnt/boot/ # 卸载 FAT 文件系统 sudo umount /mnt/boot
# 手动装载内核以及设备树并启动
fatload mmc 0:1 0x40200000 Image
fatload mmc 0:1 0x4fa00000 sun50i-h616-orangepi-zero2.dtb
setenv bootargs 'console=ttyS0,115200 earlycon'
booti 0x40200000 - 0x4fa00000
# 使用如下设置变量并保存到FAT分区
setenv bootargs 'console=ttyS0,115200'
setenv bootcmd 'fatload mmc 0:1 0x40200000 Image;fatload mmc 0:1 0x4fa00000 sun50i-h616-orangepi-zero2.dtb;booti 0x40200000 - 0x4fa00000'
saveenv
# 使用 bootcmd 启动
boot
buildroot-2022.02.5
make menuconfig # 配置 Target options > Target options Target Architecture (AArch64 (little endian)) ---> Target Binary Format (ELF) ---> Target Architecture Variant (cortex-A53) ---> Floating point strategy (VFPv4) ---> # 配置 Toolchain > Toolchain Toolchain type (External toolchain) ---> Toolchain (Custom toolchain) ---> Toolchain origin (Pre-installed toolchain) ---> (/usr/local/arm64/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu$ /usr/local/arm64/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu) Toolchain path (aarch64-linux-gnu-) Toolchain prefix //需要按住shift才能删减 External toolchain gcc version (7.x) ---> External toolchain kernel headers series (4.10.x) ---> //查看补充 [*] Toolchain has SSP support? (NEW) [*] Toolchain has RPC support? (NEW) [*] Toolchain has C++ support? [*] Enable MMU support (NEW) # 配置 Filesystem images -> Filesystem images -> [*] ext2/3/4 root filesystem //如果是 EMMC 或 SD 卡的话就用 ext3/ext4 -> ext2/3/4 variant = ext4 //选择 ext4 格式 -> exact size =128M //ext4 格式根文件系统 1GB(根据实际情况修改) -> [*] ubi image containing an ubifs root filesystem //如果使用 NAND 的话就用 ubifs # 编译 make -j8
#define LINUX_VERSION_CODE 266002
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
# 266002 转十六进制为 40A03 则版本号为 4.10.3
# 新建第二分区 128MB 从 303106 扇区开始 sudo fdisk /dev/sdc n p 2 303106 +262144 w # 格式化文件系统为 ext4 sudo mkfs.ext4 /dev/sdc2 # 装载并复制文件系统 sudo mount /dev/sdc2 /mnt/rootfs/ sudo cp ./output/images/rootfs.tar /mnt/rootfs/ sudo tar -vxf /mnt/rootfs/rootfs.tar -C /mnt/rootfs sudo rm /mnt/rootfs/rootfs.tar sudo umount /mnt/rootfs
# 在进入 uboot 后检查文件是否存在
ext4ls mmc 0:2
# 设置启动命令
setenv bootcmd 'fatload mmc 0:1 0x40200000 Image;fatload mmc 0:1 0x4fa00000 sun50i-h616-orangepi-zero2.dtb;booti 0x40200000 - 0x4fa00000'
# 设置 bootargs 变量
setenv bootargs 'console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw init=/sbin/init debug panic=30'
# 启动内核以及根文件系统
boot
因为6.0的内核太新了,很多驱动没支持,所以使用稳定版内核进行驱动的移植
config RTL8723DS
tristate "Realtek 8723D SDIO or SPI WiFi"
help
Help message of RTL8723DS
# Kconfig 中添加新的驱动
source "drivers/net/wireless/realtek/rtl8723ds/Kconfig"
# Makefile 中添加新的驱动
obj-$(CONFIG_RTL8723DS) += rtl8723ds/
# make menuconfig
> Device Drivers
> > Network device support
> > Wireless LAN
> [*] Realtek devices
> <M> Realtek 8723D SDIO or SPI WiFi
# 编译内核模块(在此我已经将 ARCH 以及 CROSS_COMPILE 固定到Makefile中,所以不需要带参)
make modules -j8
# 在 reg_vcc3v3 后面添加 WiFi 的电源配置 reg_vcc33_wifi: vcc33-wifi { /* Always on 3.3V regulator for WiFi and BT */ compatible = "regulator-fixed"; regulator-name = "vcc33-wifi"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-always-on; vin-supply = <®_vcc5v>; }; reg_vcc_wifi_io: vcc-wifi-io { /* Always on 1.8V/300mA regulator for WiFi and BT IO */ compatible = "regulator-fixed"; regulator-name = "vcc-wifi-io"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; regulator-always-on; vin-supply = <®_vcc33_wifi>; }; wifi_pwrseq: wifi-pwrseq { compatible = "mmc-pwrseq-simple"; clocks = <&rtc 1>; clock-names = "osc32k-out"; reset-gpios = <&pio 6 18 GPIO_ACTIVE_LOW>; /* PG18 */ post-power-on-delay-ms = <200>; }; # 添加 WiFi 的 mmc1 配置 &mmc1 { vmmc-supply = <®_vcc33_wifi>; vqmmc-supply = <®_vcc_wifi_io>; mmc-pwrseq = <&wifi_pwrseq>; bus-width = <4>; non-removable; mmc-ddr-1_8v; status = "okay"; }; # 编译设备树 make dtbs
make menuconfig
# 使用 mdev 动态加载模块 > System configuration Init system (BusyBox) ---> /dev management (Dynamic using devtmpfs + mdev) ---> # 打开网络支持 > Target packages > Networking applications [*] iperf3 // 用于网速测试 [*] lftp // 用于网络文件传输 [*] SFTP protocol // 使能 SFTP 协议 [*] openssh // 使能远程 ssh [*] wpa_supplicant ---> // 使能 wpa 用于WiFi控制 [*] Install wpa_cli binary > System tools [*] htop
make -j8
# 在buildroot中执行 替换根文件系统
sudo mount /dev/sdd2 /mnt/rootfs
sudo rm -rf /mnt/rootfs/*
sudo cp output/images/rootfs.tar /mnt/rootfs/
sudo tar -xvf /mnt/rootfs/rootfs.tar -C /mnt/rootfs/
# 在内核中执行 安装模块到第二分区的rootfs中(因为内核没经过裁剪会有大量的模块安装到第二分区,可能需要调整下第二分区的大小)
make INSTALL_MOD_PATH=/mnt/rootfs/ modules modules_install
# 卸载rootfs
sync
sudo umount /mnt/rootfs/
# 检查WiFi是否自动挂载 # lsmod Module Size Used by ipv6 462848 18 8723ds 1466368 0 cfg80211 380928 1 8723ds rfkill 36864 2 cfg80211 sunxi_wdt 20480 0 dwmac_sun8i 28672 0 stmmac_platform 20480 1 dwmac_sun8i stmmac 221184 2 dwmac_sun8i,stmmac_platform pcs_xpcs 24576 1 stmmac crct10dif_ce 20480 1 # 配置 WiFi # vi /etc/wpa_supplicant.conf ctrl_interface=/var/run/wpa_supplicant ap_scan=1 network={ ssid="you wifi ssid" psk="you wifi password" } # 连接WiFi # ifconfig wlan0 up # wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf -B # udhcpc -i wlan0 # 配置开机自动连接 WiFi # vi /etc/init.d/S45wifi #!/bin/sh # # wlan0 Starts WiFi. # start() { printf "Starting WiFi: " ifconfig wlan0 up wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf -B udhcpc -i wlan0 echo "OK" } stop() { printf "Stopping WiFi: " killall udhcpc killall wpa_supplicant echo "OK" } restart() { stop start } case "$1" in start) start ;; stop) stop ;; restart|reload) restart ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit $? # chmod +x /etc/init.d/S45wifi # 网络测速 # iperf3 -c 192.168.10.164 Connecting to host 192.168.10.164, port 5201 [ 5] local 192.168.10.196 port 43126 connected to 192.168.10.164 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 1.75 MBytes 14.7 Mbits/sec 0 93.3 KBytes [ 5] 1.00-2.00 sec 2.17 MBytes 18.2 Mbits/sec 0 123 KBytes [ 5] 2.00-3.00 sec 2.42 MBytes 20.3 Mbits/sec 0 151 KBytes [ 5] 3.00-4.00 sec 2.92 MBytes 24.5 Mbits/sec 0 158 KBytes [ 5] 4.00-5.00 sec 2.61 MBytes 21.9 Mbits/sec 0 167 KBytes [ 5] 5.00-6.00 sec 2.61 MBytes 21.9 Mbits/sec 0 167 KBytes [ 5] 6.00-7.00 sec 2.61 MBytes 21.9 Mbits/sec 0 167 KBytes [ 5] 7.00-8.00 sec 2.61 MBytes 21.9 Mbits/sec 0 167 KBytes [ 5] 8.00-9.00 sec 2.61 MBytes 21.9 Mbits/sec 0 167 KBytes [ 5] 9.00-10.00 sec 2.61 MBytes 21.9 Mbits/sec 0 167 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 24.9 MBytes 20.9 Mbits/sec 0 sender [ 5] 0.00-10.00 sec 24.2 MBytes 20.3 Mbits/sec receiver iperf Done. # 远程连接 ssh 配置 sshd_config 文件 # vi /etc/ssh/sshd_config PermitRootLogin yes //修改 AllowUsers root //添加 # 重启 sshd 服务 # /etc/init.d/S50sshd restart # 设置 root 密码 # passwd root # 配置终端 # vi /etc/profile.d/myprofile.sh #!/bin/sh PS1='[\u@\h]:\w$ ' export PS1 # chmod +x /etc/profile.d/myprofile.sh # source /etc/profile.d/myprofile.sh
U-Boot SPL 2022.10-rc3-00069-g67fe8cc001-dirty (Sep 03 2022 - 18:10:41 +0800) pmic id is 0x4b DRAM: 1024 MiB Trying to boot from MMC1 NOTICE: BL31: v2.7(debug):v2.7.0-312-g9a5dec669 NOTICE: BL31: Built : 17:14:37, Sep 3 2022 NOTICE: BL31: Detected Allwinner H616 SoC (1823) NOTICE: BL31: Found U-Boot DTB at 0x4a081ff0, model: OrangePi Zero2 INFO: ARM GICv2 driver initialized INFO: Configuring SPC Controller INFO: PMIC: Probing AXP305 on RSB ERROR: RSB: set run-time address: 0x10003 INFO: Could not init RSB: -65539 INFO: BL31: Platform setup done INFO: BL31: Initializing runtime services INFO: BL31: cortex_a53: CPU workaround for 855873 was applied INFO: BL31: cortex_a53: CPU workaround for 1530924 was applied INFO: PSCI: Suspend is unavailable INFO: BL31: Preparing for EL3 exit to normal world INFO: Entry point address = 0x4a000000 INFO: SPSR = 0x3c9 INFO: Changed devicetree. U-Boot 2022.10-rc3-00069-g67fe8cc001-dirty (Sep 03 2022 - 18:10:41 +0800) Allwinner Technology CPU: Allwinner H616 (SUN50I) Model: OrangePi Zero2 DRAM: 1 GiB Core: 49 devices, 17 uclasses, devicetree: separate WDT: Not starting watchdog@30090a0 MMC: mmc@4020000: 0 Loading Environment from FAT... OK In: serial@5000000 Out: serial@5000000 Err: serial@5000000 Hit any key to stop autoboot: 0 35908096 bytes read in 1489 ms (23 MiB/s) 13222 bytes read in 2 ms (6.3 MiB/s) ## Flattened Device Tree blob at 4fa00000 Booting using the fdt blob at 0x4fa00000 Loading Device Tree to 0000000049ff9000, end 0000000049fff3a5 ... OK Starting kernel ... [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034] [ 0.000000] Linux version 5.19.0-rc1-609706-gc465e81f8859-dirty (evler@evler-Standard-PC-i440FX-PIIX-1996) (aarch64-linux-gnu-g2 [ 0.000000] Machine model: MQ-Quad_H616 [ 0.000000] efi: UEFI not found. []t[ 0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x000000007fffffff] [ 0.000000] NUMA: NODE_DATA [mem 0x7fdebb40-0x7fdedfff] [ 0.000000] Zone ranges: [ 0.000000] DMA [mem 0x0000000040000000-0x000000007fffffff] [ 0.000000] DMA32 empty [ 0.000000] Normal empty [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000040000000-0x000000004003ffff] [ 0.000000] node 0: [mem 0x0000000040040000-0x000000007fffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000007fffffff] [ 0.000000] cma: Reserved 32 MiB at 0x000000007cc00000 [ 0.000000] psci: probing for conduit method from DT. [ 0.000000] psci: PSCIv1.1 detected in firmware. [ 0.000000] psci: Using standard PSCI v0.2 function IDs [ 0.000000] psci: MIGRATE_INFO_TYPE not supported. [ 0.000000] psci: SMC Calling Convention v1.2 [ 0.000000] percpu: Embedded 19 pages/cpu s40808 r8192 d28824 u77824 [ 0.000000] pcpu-alloc: s40808 r8192 d28824 u77824 alloc=19*4096 [ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 [ 0.000000] Detected VIPT I-cache on CPU0 [ 0.000000] CPU features: detected: ARM erratum 845719 [ 0.000000] Fallback order for Node 0: 0 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 258048 [ 0.000000] Policy zone: DMA [ 0.000000] Kernel command line: console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw init=/sbin/init debug pa0 [ 0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes, linear) [ 0.000000] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes, linear) [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off [ 0.000000] Memory: 959476K/1048576K available (15680K kernel code, 3386K rwdata, 8928K rodata, 6912K init, 577K bss, 56332K re) [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1 [ 0.000000] rcu: Preemptible hierarchical RCU implementation. [ 0.000000] rcu: RCU event tracing is enabled. [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=4. [ 0.000000] Trampoline variant of Tasks RCU enabled. [ 0.000000] Tracing variant of Tasks RCU enabled. [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4 [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 [ 0.000000] Root IRQ handler: gic_handle_irq [ 0.000000] GIC: Using split EOI/Deactivate mode [ 0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention. [ 0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (phys). [ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns [ 0.000000] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns [ 0.000676] Console: colour dummy device 80x25 [ 0.000771] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=96000) [ 0.000786] pid_max: default: 32768 minimum: 301 [ 0.000858] LSM: Security Framework initializing [ 0.000989] Mount-cache hash table entries: 2048 (order: 2, 16384 bytes, linear) [ 0.001005] Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes, linear) [ 0.002687] cblist_init_generic: Setting adjustable number of callback queues. [ 0.002711] cblist_init_generic: Setting shift to 2 and lim to 1. [ 0.002794] cblist_init_generic: Setting shift to 2 and lim to 1. [ 0.002965] rcu: Hierarchical SRCU implementation. [ 0.004261] EFI services will not be available. [ 0.004620] smp: Bringing up secondary CPUs ... [ 0.005158] Detected VIPT I-cache on CPU1 [ 0.005243] CPU1: Booted secondary processor 0x0000000001 [0x410fd034] [ 0.005923] Detected VIPT I-cache on CPU2 [ 0.005995] CPU2: Booted secondary processor 0x0000000002 [0x410fd034] [ 0.006627] Detected VIPT I-cache on CPU3 [ 0.006696] CPU3: Booted secondary processor 0x0000000003 [0x410fd034] [ 0.006790] smp: Brought up 1 node, 4 CPUs [ 0.006798] SMP: Total of 4 processors activated. [ 0.006802] CPU features: detected: 32-bit EL0 Support [ 0.006806] CPU features: detected: CRC32 instructions [ 0.007163] CPU: All CPU(s) started at EL2 [ 0.007182] alternatives: patching kernel code [ 0.008730] devtmpfs: initialized [ 0.012355] KASLR disabled due to lack of seed [ 0.012584] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns [ 0.012605] futex hash table entries: 1024 (order: 4, 65536 bytes, linear) [ 0.014003] pinctrl core: initialized pinctrl subsystem [ 0.015167] DMI not present or invalid. [ 0.016034] NET: Registered PF_NETLINK/PF_ROUTE protocol family [ 0.017612] DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations [ 0.017939] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations [ 0.018106] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations [ 0.018212] audit: initializing netlink subsys (disabled) [ 0.018467] audit: type=2000 audit(0.016:1): state=initialized audit_enabled=0 res=1 [ 0.019563] thermal_sys: Registered thermal governor 'step_wise' [ 0.019574] thermal_sys: Registered thermal governor 'power_allocator' [ 0.019703] cpuidle: using governor menu [ 0.020054] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers. [ 0.020231] ASID allocator initialised with 65536 entries [ 0.020241] HugeTLB: can optimize 4095 vmemmap pages for hugepages-1048576kB [ 0.020247] HugeTLB: can optimize 127 vmemmap pages for hugepages-32768kB [ 0.020252] HugeTLB: can optimize 7 vmemmap pages for hugepages-2048kB [ 0.020256] HugeTLB: can optimize 0 vmemmap pages for hugepages-64kB [ 0.021930] Serial: AMBA PL011 UART driver [ 0.029582] platform 7000000.rtc: Fixing up cyclic dependency with 3001000.clock [ 0.030090] platform 7010000.clock: Fixing up cyclic dependency with 7000000.rtc [ 0.044690] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages [ 0.044705] HugeTLB registered 32.0 MiB page size, pre-allocated 0 pages [ 0.044711] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages [ 0.044716] HugeTLB registered 64.0 KiB page size, pre-allocated 0 pages [ 0.046360] ACPI: Interpreter disabled. [ 0.049195] iommu: Default domain type: Translated [ 0.049210] iommu: DMA domain TLB invalidation policy: strict mode [ 0.049572] SCSI subsystem initialized [ 0.049784] libata version 3.00 loaded. [ 0.050061] usbcore: registered new interface driver usbfs [ 0.050102] usbcore: registered new interface driver hub [ 0.050137] usbcore: registered new device driver usb [ 0.050867] pps_core: LinuxPPS API ver. 1 registered [ 0.050873] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it> [ 0.050892] PTP clock support registered [ 0.050996] EDAC MC: Ver: 3.0.0 [ 0.052387] FPGA manager framework [ 0.052558] Advanced Linux Sound Architecture Driver Initialized. [ 0.053492] vgaarb: loaded [ 0.054091] clocksource: Switched to clocksource arch_sys_counter [ 0.054373] VFS: Disk quotas dquot_6.6.0 [ 0.054422] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes) [ 0.054644] pnp: PnP ACPI: disabled [ 0.061916] NET: Registered PF_INET protocol family [ 0.062157] IP idents hash table entries: 16384 (order: 5, 131072 bytes, linear) [ 0.063320] tcp_listen_portaddr_hash hash table entries: 512 (order: 1, 8192 bytes, linear) [ 0.063366] TCP established hash table entries: 8192 (order: 4, 65536 bytes, linear) [ 0.063497] TCP bind bhash tables hash table entries: 8192 (order: 5, 196608 bytes, linear) [ 0.063743] TCP: Hash tables configured (established 8192 bind 8192) [ 0.063914] UDP hash table entries: 512 (order: 2, 16384 bytes, linear) [ 0.063951] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear) [ 0.064165] NET: Registered PF_UNIX/PF_LOCAL protocol family [ 0.064703] RPC: Registered named UNIX socket transport module. [ 0.064715] RPC: Registered udp transport module. [ 0.064718] RPC: Registered tcp transport module. [ 0.064721] RPC: Registered tcp NFSv4.1 backchannel transport module. Starting syslogd[ 0.064732] PCI: CLS 0 bytes, default 64 : [ 0.065880] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available [ 0.067407] Initialise system trusted keyrings [ 0.067740] workingset: timestamp_bits=42 max_order=18 bucket_order=0 OK[ 0.075263] squashfs: version 4.0 (2009/01/31) Phillip Lougher [ 0.076086] NFS: Registering the id_resolver key type [ 0.076137] Key type id_resolver registered [ 0.076141] Key type id_legacy registered Starting klogd: [ 0.076225] nfs4filelayout_init: NFSv4 File Layout Driver Registering... [ 0.076231] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering... OK [ 0.076456] 9p: Installing v9fs 9p2000 file system support [ 0.119607] Key type asymmetric registered [ 0.119618] Asymmetric key parser 'x509' registered Running sysctl: [ 0.119691] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 245) [ 0.119698] io scheduler mq-deadline registered [ 0.119702] io scheduler kyber registered [ 0.129824] EINJ: ACPI disabled. OK[ 0.149674] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled [ 0.153025] SuperH (H)SCI(F) driver initialized [ 0.153497] msm_serial: driver initialized Starting mdev...[ 0.155231] cacheinfo: Unable to detect cache hierarchy for CPU 0 [ 0.161996] loop: module loaded OK[ 0.163289] megasas: 07.719.03.00-rc1 [ 0.169894] tun: Universal TUN/TAP device driver, 1.6 [ 0.171057] thunder_xcv, ver 1.0 [ 0.171110] thunder_bgx, ver 1.0 [ 0.171163] nicpf, ver 1.0 [ 0.172488] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version [ 0.172496] hns3: Copyright (c) 2017 Huawei Corporation. [ 0.172585] hclge is initializing [ 0.172609] e1000: Intel(R) PRO/1000 Network Driver [ 0.172613] e1000: Copyright (c) 1999-2006 Intel Corporation. [ 0.172656] e1000e: Intel(R) PRO/1000 Network Driver [ 0.172659] e1000e: Copyright(c) 1999 - 2015 Intel Corporation. [ 0.172699] igb: Intel(R) Gigabit Ethernet Network Driver [ 0.172702] igb: Copyright (c) 2007-2014 Intel Corporation. [ 0.172737] igbvf: Intel(R) Gigabit Virtual Function Network Driver [ 0.172740] igbvf: Copyright (c) 2009 - 2012 Intel Corporation. [ 0.173131] sky2: driver version 1.30 [ 0.174339] VFIO - User Level meta-driver version: 0.3 [ 0.176796] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 0.176810] ehci-pci: EHCI PCI platform driver [ 0.176868] ehci-platform: EHCI generic platform driver [ 0.177001] ehci-orion: EHCI orion driver [ 0.177118] ehci-exynos: EHCI Exynos driver [ 0.177215] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [ 0.177252] ohci-pci: OHCI PCI platform driver [ 0.177309] ohci-platform: OHCI generic platform driver [ 0.177430] ohci-exynos: OHCI Exynos driver [ 0.177989] usbcore: registered new interface driver usb-storage [ 0.181279] i2c_dev: i2c /dev entries driver [ 0.189068] sdhci: Secure Digital Host Controller Interface driver [ 0.189082] sdhci: Copyright(c) Pierre Ossman [ 0.189877] Synopsys Designware Multimedia Card Interface Driver [ 0.191189] sdhci-pltfm: SDHCI platform and OF driver helper [ 0.193497] ledtrig-cpu: registered to indicate activity on CPUs [ 0.195785] SMCCC: SOC_ID: ID = jep106:091e:1823 Revision = 0x00000000 [ 0.196728] usbcore: registered new interface driver usbhid [ 0.196738] usbhid: USB HID core driver [ 0.204363] NET: Registered PF_PACKET protocol family [ 0.204548] 9pnet: Installing 9P2000 support [ 0.204622] Key type dns_resolver registered [ 0.205231] registered taskstats version 1 [ 0.205255] Loading compiled-in X.509 certificates [ 0.229952] sun6i-rtc 7000000.rtc: registered as rtc0 [ 0.229992] sun6i-rtc 7000000.rtc: setting system clock to 1970-01-02T01:00:55 UTC (90055) [ 0.230669] sun6i-rtc 7000000.rtc: RTC enabled [ 0.251225] sun50i-h616-pinctrl 300b000.pinctrl: initialized sunXi PIO driver [ 0.252741] sun50i-h616-r-pinctrl 7022000.pinctrl: initialized sunXi PIO driver [ 0.255230] printk: console [ttyS0] disabled [ 0.275633] 5000000.serial: ttyS0 at MMIO 0x5000000 (irq = 283, base_baud = 1500000) is a 16550A [ 0.275860] printk: console [ttyS0] printing thread started [ 0.275885] printk: console [ttyS0] enabled [ 0.278807] sun6i-spi 5010000.spi: Failed to request TX DMA channel [ 0.278825] sun6i-spi 5010000.spi: Failed to request RX DMA channel [ 0.279672] spi-nor spi0.0: unrecognized JEDEC id bytes: ff ff ff ff ff ff [ 0.289313] sunxi-mmc 4020000.mmc: Got CD GPIO [ 0.292181] sunxi-mmc 4021000.mmc: allocated mmc-pwrseq [ 0.292272] sun50i-h616-r-pinctrl 7022000.pinctrl: supply vcc-pl not found, using dummy regulator [ 0.292656] sunxi-rsb 7083000.rsb: RSB running at 3000000 Hz [ 0.292847] sunxi-rsb 7083000.rsb: /soc/rsb@7083000/pmic@745: set runtime address failed: -22 [ 0.293011] axp20x-rsb sunxi-rsb-745: AXP20x variant AXP806 found [ 0.293908] axp20x-regulator axp20x-regulator.1: Error setting dcdc frequency: -5 [ 0.294060] vdd-cpu: failed to get the current voltage: -EIO [ 0.294112] axp20x-regulator axp20x-regulator.1: Failed to register dcdca [ 0.294118] axp20x-regulator: probe of axp20x-regulator.1 failed with error -5 [ 0.294520] axp20x-rsb sunxi-rsb-745: AXP20X driver loaded [ 0.295500] ALSA device list: [ 0.295514] No soundcards found. [ 0.314372] sunxi-mmc 4020000.mmc: initialized, max. request size: 16384 KB, uses new timings mode [ 0.364732] mmc0: host does not support reading read-only switch, assuming write-enable [ 0.368126] mmc0: new high speed SDHC card at address aaaa [ 0.369015] mmcblk0: mmc0:aaaa SL32G 28.8 GiB [ 0.371681] mmcblk0: p1 p2 [ 0.522656] sunxi-mmc 4021000.mmc: initialized, max. request size: 16384 KB, uses new timings mode [ 0.528860] sunxi-mmc 4021000.mmc: card claims to support voltages below defined range [ 0.535716] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Quota mode: none. [ 0.535815] VFS: Mounted root (ext4 filesystem) on device 179:2. [ 0.537777] devtmpfs: mounted [ 0.539706] mmc1: new high speed SDIO card at address 0001 [ 0.540981] Freeing unused kernel memory: 6912K [ 0.642146] Run /sbin/init as init process [ 0.642157] with arguments: [ 0.642159] /sbin/init [ 0.642161] with environment: [ 0.642163] HOME=/ [ 0.642165] TERM=linux [ 0.991510] EXT4-fs (mmcblk0p2): re-mounted. Quota mode: none. [ 1.792288] dwmac-sun8i 5020000.ethernet: IRQ eth_wake_irq not found [ 1.792309] dwmac-sun8i 5020000.ethernet: IRQ eth_lpi not found [ 1.927520] sunxi-wdt 30090a0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0) [ 1.931104] dwmac-sun8i 5020000.ethernet: IRQ eth_wake_irq not found [ 1.931124] dwmac-sun8i 5020000.ethernet: IRQ eth_lpi not found [ 1.978799] cfg80211: Loading compiled-in X.509 certificates for regulatory database [ 1.993547] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7' [ 1.993783] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2 [ 1.993809] cfg80211: failed to load regulatory.db [ 2.332323] dwmac-sun8i 5020000.ethernet: IRQ eth_wake_irq not found [ 2.332347] dwmac-sun8i 5020000.ethernet: IRQ eth_lpi not found Initializing random number generator: OK Saving random seed: [ 3.998094] random: crng init done OK Starting system message bus: done Starting network: OK Starting WiFi: Successfully initialized wpa_supplicant udhcpc: started, v1.35.0 udhcpc: broadcasting discover udhcpc: broadcasting discover udhcpc: broadcasting select for 192.168.10.196, server 192.168.10.251 udhcpc: lease of 192.168.10.196 obtained from 192.168.10.251, lease time 43200 deleting routers adding dns 192.168.10.251 OK Starting sshd: [ 8.070171] NET: Registered PF_INET6 protocol family [ 8.071640] Segment Routing with IPv6 [ 8.071670] In-situ OAM (IOAM) with IPv6 OK Welcome to Buildroot buildroot login: root Password: [root@buildroot]:~$ lsmod Module Size Used by ipv6 462848 18 8723ds 1466368 0 cfg80211 380928 1 8723ds rfkill 36864 2 cfg80211 sunxi_wdt 20480 0 dwmac_sun8i 28672 0 stmmac_platform 20480 1 dwmac_sun8i stmmac 221184 2 dwmac_sun8i,stmmac_platform pcs_xpcs 24576 1 stmmac crct10dif_ce 20480 1 [root@buildroot]:~$ ifconfig lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) wlan0 Link encap:Ethernet HWaddr 94:A4:08:D8:1C:EC inet addr:192.168.10.196 Bcast:192.168.10.255 Mask:255.255.255.0 inet6 addr: fe80::96a4:8ff:fed8:1cec/64 Scope:Link inet6 addr: fd15:3be5:c6ac:0:96a4:8ff:fed8:1cec/64 Scope:Global UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:26 errors:0 dropped:9 overruns:0 frame:0 TX packets:14 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3949 (3.8 KiB) TX bytes:2116 (2.0 KiB) [root@buildroot]:~$ uname -a Linux buildroot 5.19.0-rc1-609706-gc465e81f8859-dirty #1 SMP PREEMPT Mon Sep 5 23:37:32 CST 2022 aarch64 GNU/Linux [root@buildroot]:~$ df -h Filesystem Size Used Available Use% Mounted on /dev/root 28.0G 93.7M 26.5G 0% / devtmpfs 468.5M 0 468.5M 0% /dev tmpfs 487.9M 0 487.9M 0% /dev/shm tmpfs 487.9M 36.0K 487.8M 0% /tmp tmpfs 487.9M 28.0K 487.8M 0% /run [root@buildroot]:~$ free total used free shared buff/cache available Mem: 999156 30656 936852 64 31648 918856 Swap: 0 0 0 [root@buildroot]:~$
# 创建 images 目录
mkdir images
cd images
# 收集需要用到的文件到 file 目录
mkdir file
cp ../u-boot/u-boot-sunxi-with-spl.bin ./file
cp ../linux-5.19.0/arch/arm64/boot/Image ./file
cp ../linux-5.19.0/arch/arm64/boot/dts/allwinner/mq-quad.dtb ./file // 这里我已经单独做了个设备树文件
cp ../buildroot-2022.02.5/output/images/rootfs.tar ./file
# 制作空的 img 文件
sudo dd if=/dev/zero of=./sdcard.img bs=1M count=512
sudo fdisk ./sdcard.img
n
p
1
40960
+131072 // 64MB
n
p
2
172033
1048575 // 默认
w
sudo losetup -f ./sdcard.img
#查看关联到哪个位置
sudo losetup -l
/dev/loop11 0 0 0 0 /home/evler/Allwinner/MangoPi/Quad/mainline/images/sdcard.img
sudo dd if=./file/u-boot-sunxi-with-spl.bin of=/dev/loop11 bs=8K seek=1
# 参考分区:
设备 启动 起点 末尾 扇区 大小 Id 类型
./sdcard.img1 40960 172032 131073 64M 83 Linux
./sdcard.img2 172033 1048575 876543 428M 83 Linux
# -o (起始扇区 * 扇区大小)--sizelimit (扇区数量 * 扇区大小) 字节
sudo losetup -f -o 20971520 --sizelimit 67109376 sdcard.img
sudo losetup -f -o 88080896 --sizelimit 448790016 sdcard.img
#查看关联到哪个位置
sudo losetup -l
/dev/loop30 67109376 20971520 0 0 /home/evler/Allwinner/MangoPi/Quad/mainline/images/sdcard.img
/dev/loop26 448790016 88080896 0 0 /home/evler/Allwinner/MangoPi/Quad/mainline/images/sdcard.img
sudo mkfs.fat /dev/loop30
sudo mkfs.ext4 /dev/loop26
sudo mount /dev/loop30 /mnt/boot/
sudo mount /dev/loop26 /mnt/rootfs/
# 创建 boot.cmd 文件
vi boot.cmd
# 复制以下内容
setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw
setenv bootcmd fatload mmc 0:1 0x4fc00000 boot.scr; fatload mmc 0:1 0x40200000 Image; fatload mmc 0:1 0x4fa00000 mq-quad.dtb; booti 0x40200000 - 0x4fa00000
# 生成 boot.scr 文件
mkimage -C none -A arm64 -T script -d boot.cmd boot.scr
sudo cp ./file/Image /mnt/boot/
sudo cp ./file/mq-quad.dtb /mnt/boot/
sudo cp ./file/boot.scr /mnt/boot/
# 解压 buildroot 制作出来的根文件系统压缩文件到 rootfs 分区
sudo tar -vxf ./file/rootfs.tar -C /mnt/rootfs/
# 安装内核模块到 rootfs 分区
cd ../linux-5.19.0/
sudo make INSTALL_MOD_PATH=/mnt/rootfs/ modules_install
sync
sudo umount /mnt/rootfs
sudo umount /mnt/boot
sudo losetup -d /dev/loop30
sudo losetup -d /dev/loop26
sudo losetup -d /dev/loop11
sudo dd if=./sdcard.img of=/dev/sdd
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。