最终我还是在21.04版本上编译的(18.04上可以正常编译uboot kernel rootfs以及full image,但是启动后wifi没法正常连接....),这样esp32环境也可用。
到 http://releases.ubuntu.com/21.04/ubuntu-21.04-desktop-amd64.iso 下载ubuntu21.04(21.04 还真不好找),完成后去 https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ 替换对应版本的软件源
1. 编译uboot
sudo ./build.sh , uboot , current
LD spl/u-boot-spl
OBJCOPY spl/u-boot-spl-nodtb.bin
COPY spl/u-boot-spl.bin
MKSUNXI spl/sunxi-spl.bin
CAT u-boot-sunxi-with-spl.bin
CFGCHK u-boot.cfg
[ o.k. ] Building deb [ linux-u-boot-current-orangepi3-lts_3.0.6_arm64.deb ]
[ o.k. ] U-boot build done [ @host ]
[ o.k. ] Target directory [ /home/fang/orangepi-build/output/debs/u-boot ]
[ o.k. ] File name [ linux-u-boot-current-orangepi3-lts_3.0.6_arm64.deb ]
[ o.k. ] Runtime [ 8 min ]
[ o.k. ] Repeat Build Options [ sudo ./build.sh BOARD=orangepi3-lts BRANCH=current BUILD_OPT=u-boot ]
或者将u-boot/v2020.04拷贝出来,手动编译 :(PATH=$PATH:/home/fang/orangepi-build/toolchains/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin)
make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- distclean
make ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- orangepi_3_lts_defconfig
make -j4 ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu-
将uboot更新到img,可以参看用户手册,或者直接
sudo dd if=./u-boot/v2020.04/u-boot-sunxi-with-spl.bin of=/dev/sdb bs=1k seek=8 conv=fsync > /dev/null 2>&1
2. 编译kernel
kernel , current
HDRINST usr/include/asm/resource.h
HDRINST usr/include/asm/types.h
HDRINST usr/include/asm/poll.h
HDRINST usr/include/asm/ipcbuf.h
INSTALL ./debian/headertmp/usr/include
CLEAN scripts/basic
CLEAN scripts/dtc
CLEAN scripts/kconfig
CLEAN scripts/mod
CLEAN scripts/selinux/genheaders
CLEAN scripts/selinux/mdp
CLEAN scripts
patching file tools/include/tools/be_byteshift.h
patching file tools/include/tools/le_byteshift.h
dpkg-deb: building package 'linux-headers-current-sun50iw6' in '../linux-headers-current-sun50iw6_3.0.6_arm64.deb'.
dpkg-deb: building package 'linux-dtb-current-sun50iw6' in '../linux-dtb-current-sun50iw6_3.0.6_arm64.deb'.
dpkg-deb: building package 'linux-image-current-sun50iw6' in '../linux-image-current-sun50iw6_3.0.6_arm64.deb'.
dpkg-buildpackage: info: binary-only upload (no source included)
[ o.k. ] Kernel build done [ @host ]
[ o.k. ] Target directory [ /home/fang/orangepi-build/output/debs/ ]
[ o.k. ] File name [ linux-image-current-sun50iw6_3.0.6_arm64.deb ]
[ o.k. ] Runtime [ 64 min ]
[ o.k. ] Repeat Build Options [ sudo ./build.sh BOARD=orangepi3-lts BRANCH=current BUILD_OPT=kernel KERNEL_CONFIGURE=yes ]
手动编译(PATH=$PATH:/home/fang/orangepi-build/toolchains/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin)
make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- orangepi_defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- menuconfig
make -j4 ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu-
./arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3-lts.dts
编译完成后生成的deb包,解压
cd output/debs
mkdir xx
dpkg -x linux-image-current-sun50iw6_3.0.6_arm64.deb ./xx
然后在xx目录下就有boot/ etc/ lib/ usr/四个文件夹,将其中的内容拷贝到sd卡:
sudo cp -ra boot/* /media/fang/849251f7-04e4-4b51-9820-3bc585b3becb/boot/
sudo cp -ra etc/* /media/fang/849251f7-04e4-4b51-9820-3bc585b3becb/etc/
sudo cp -ra lib/* /media/fang/849251f7-04e4-4b51-9820-3bc585b3becb/lib/
sudo cp -ra usr/* /media/fang/849251f7-04e4-4b51-9820-3bc585b3becb/usr/
或者将这些文件拷贝到待烧写到sd卡的img文件中:
sudo fdisk Orangepi3-lts_3.0.4_ubuntu_jammy_desktop_xfce_linux5.16.17.img
进入后按p显示格式化的分区情况,如下
Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk Orangepi3-lts_3.0.4_ubuntu_jammy_desktop_xfce_linux5.16.17.img: 3.68 GiB, 3951034368 bytes, 7716864 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xbf977d92
Device Boot Start End Sectors Size Id Type
Orangepi3-lts_3.0.4_ubuntu_jammy_desktop_xfce_linux5.16.17.img1 8192 7716863 7708672 3.7G 83 Linux
将分区mount过来(4194304 =8192*512 Bytes)(参看(22条消息) 分区格式化_ddddfang的博客-优快云博客)
sudo mount -o loop,offset=4194304 Orangepi3-lts_3.0.4_ubuntu_jammy_desktop_xfce_linux5.16.17.img /mnt/
最后将deb包中的那些文件拷贝到/mnt并umount即可(当然最终还是要烧写到sd卡)。上面这几步和下面进入目标系统后dpkg -i效果一样的(更新:不如dpkg安装稳定,这种方式貌似起来后会没有hdmi输出。。怀疑是一些软连接没有处理好,且dpkg安装时打印的 update-initramfs: Generating /boot/initrd.img-5.10.76-sun50iw6 、update-initramfs: Converting to u-boot format这些是直接拷贝没有的)
3. rootfs, 3d+media+programming
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
[ o.k. ] Free SD cache [ 22% ]
[ o.k. ] Mount point
[ o.k. ] Recreating Synaptic search index [ Please wait ]
[ o.k. ] Ending debootstrap process and preparing cache [ bullseye ]
[ o.k. ] Unmounting [ /home/fang/orangepi-build/.tmp/rootfs-7a0b2e55-f972-4212-8d94-2d08c0c0775c ]
bullseye-xfce-arm64.cf2...1a2.tar.lz4: 1.10GiB [58.2MiB/s] [=========================================================================================================================================] 107%
[ o.k. ] Rootfs build done [ @host ]
[ o.k. ] Target directory [ /home/fang/orangepi-build/external/cache/rootfs ]
[ o.k. ] File name [ bullseye-xfce-arm64.cf25905df87308f15e6a3c1843fb21a2.tar.lz4 ]
4. full image, 3d + media + programming
need change a .sh file !
- install_deb_chroot "$EXTER/cache/debs/arm64/usbmount_0.0.24_all.deb"
+ #install_deb_chroot "$EXTER/cache/debs/arm64/usbmount_0.0.24_all.deb"
+ dpkg_install_deb_chroot "$EXTER/cache/debs/arm64/usbmount_0.0.24_all.deb"
c8bf6806-7d78-440a-84b8-a2ad083881af ]
[ o.k. ] Preparing image file for rootfs [ orangepi3-lts bullseye ]
[ o.k. ] Current rootfs size [ 1588 MiB ]
[ o.k. ] Creating blank image for rootfs [ 2072 MiB ]
[ .... ] dd: 2.02GiB [ 150MiB/s] [==================================================================================================================================================================>] 100%
[ o.k. ] Creating partitions [ root: ext4 ]
[ .... ] Creating rootfs [ ext4 on /dev/loop3p1 ]
[ .... ] Copying files to [ / ]
[ .... ] Copying files to [ /boot ]
sent 27.38M bytes received 1.37K bytes 54.77M bytes/sec
total size is 27.37M speedup is 1.00
[ .... ] Updating initramfs... [ update-initramfs -uv -k 5.10.76-sun50iw6 ]
[ o.k. ] Updated initramfs. [ for details see: /home/fang/orangepi-build/output/debug/install.log ]
[ .... ] Re-enabling [ initramfs-tools hook for kernel ]
[ o.k. ] Unmounting [ /home/fang/orangepi-build/.tmp/mount-c8bf6806-7d78-440a-84b8-a2ad083881af/ ]
[ o.k. ] Free SD cache [ 30% ]
[ o.k. ] Mount point [ 90% ]
[ o.k. ] Writing U-boot bootloader [ /dev/loop3 ]
[ o.k. ] SHA256 calculating [ Orangepi3-lts_3.0.6_debian_bullseye_desktop_xfce_linux5.10.76.img ]
[ warn ] GPG signing skipped - no GPG_PASS [ Orangepi3-lts_3.0.6_debian_bullseye_desktop_xfce_linux5.10.76.img ]
[ o.k. ] Done building [ /home/fang/orangepi-build/output/images/Orangepi3-lts_3.0.6_debian_bullseye_desktop_xfce_linux5.10.76/Orangepi3-lts_3.0.6_debian_bullseye_desktop_xfce_linux5.10.76.img ]
[ o.k. ] Runtime [ 8 min ]
[ o.k. ] Repeat Build Options [ sudo ./build.sh BOARD=orangepi3-lts BRANCH=current BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=yes KERNEL_CONFIGURE=yes DESKTOP_ENVIRONMENT=xfce DESKTOP_ENVIRONMENT_CONFIG_NAME=config_base DESKTOP_APPGROUPS_SELECTED="3dsupport multimedia programming" COMPRESS_OUTPUTIMAGE=sha,gpg,img ]
最后编译完成修改 ignore update 为yes
但烧写到sd card,发现还是没法连接wifi,甚至桌面环境都进不去。。。只有命令行,还不如18.04上编译的legacy。。。。
能做的
1.出错的地方,该动脚本
2.尝试编译其他桌面版本
3.使用release的桌面版本,替换kernel+uboot的deb
最后我选择先用官方的image,使用img里带的rootfs,替换编译得到的 uboot 和 kernel
img用的是 Orangepi3-lts_3.0.4_ubuntu_jammy_desktop_xfce_linux5.16.17.img (或许用5.10 media的版本更好!去百度盘下载)
-----------------------------------------------------------------------------------------------------------
scp ./output/debs/linux-image-current-sun50iw6_3.0.6_arm64.deb root@192.168.1.9:/root
dpkg -l |grep linux
apt purge -y linux-image-xxx-sun50iw6 #dpkg -P xxx 也是一样的!
dpkg -i linux-image-current-sun50iw6_3.0.6_arm64.deb
reboot
若是更新了dtb文件,则需要卸载并安装 linux-dtb-current-sun50iw6_3.0.6_arm64.deb
Orange Pi - Orangepi
linux-sunxi.org
Allwinner H6 Datasheet and User Manual Released - CNX Software (cnx-software.com)
Allwinner_H6 V200_User_Manual_V1.1.pdf (pine64.org)
Allwinner_H6 V200_Datasheet_V1.1.pdf (pine64.org)Allwinner SoC based boards — Das U-Boot unknown version documentation
http://releases.ubuntu.com/21.04/ubuntu-21.04-desktop-amd64.iso
https://mirrors.huaweicloud.com/ubuntu-releases/18.04.6/
https://ftp.sjtu.edu.cn/ubuntu-cd/21.10/
博主详细描述了在Ubuntu 21.04环境下编译U-Boot、Linux内核和根文件系统的过程,包括遇到的问题如WiFi连接问题,以及后续尝试的解决方案,如更换桌面环境和使用官方镜像。
976

被折叠的 条评论
为什么被折叠?



