• qemu搭建arm嵌入式linux开发环境


    一、基本概念

    1、交叉编译

    交叉编译(Cross_Compile)是指编译源代码的平台和执行源代码编译后程序的平台是两个不同的平台。

    2、bootloader

    BootLoader是在操作系统内核运行之前运行。可以初始化硬件设备、建立内存空间映射图,从而将系统的软硬件环境带到一个合适状态,以便为最终调用操作系统内核准备好正确的环境。

    Bootloader是嵌入式系统在加电后执行的第一段代码,在它完成CPU和相关硬件的初始化之后,再将操作系统映像或固化的嵌入式应用程序装载到内存中然后跳转到操作系统所在的空间,启动操作系统运行。

    3、Linux

    Linux,全称GNU/Linux,是一种免费使用和自由传播的类UNIX操作系统,其内核由[林纳斯·本纳第克特·托瓦兹于1991年10月5日首次发布,它主要受到Minix和Unix思想的启发,是一个基于POSIX的多用户、多任务、支持多线程和多CPU的操作系统。它能运行主要的Unix工具软件、应用程序和网络协议。它支持32位和64位硬件。Linux继承了Unix以网络为核心的设计思想,是一个性能稳定的多用户网络操作系统。

    4、根文件系统

    根文件系统首先是内核启动时所mount的第一个文件系统,内核代码映像文件保存在根文件系统中,而系统引导启动程序会在根文件系统挂载之后从中把一些基本的初始化脚本和服务等加载到内存中去运行。

    5、测试环境

    组件版本
    交叉编译工具链gcc-linaro-6.5.0-2018.12-x86_64_arm-linux-gnueabihf
    bootloaderu-boot-2018.03
    linuxlinux-4.15
    根文件系统busybox-1.35.0

    二、安装交叉编译工具链

    1、下载交叉编译工具链

    Builds & Downloads | Linaro

    Linaro Releases

    2、解压交叉工具链

    onlylove@ubuntu:~/my/gcc$ pwd
    /home/onlylove/my/gcc
    onlylove@ubuntu:~/my/gcc$ ls
    gcc-linaro-6.5.0-2018.12-x86_64_arm-linux-gnueabihf.tar.xz
    onlylove@ubuntu:~/my/gcc$ xz -d gcc-linaro-6.5.0-2018.12-x86_64_arm-linux-gnueabihf.tar.xz 
    onlylove@ubuntu:~/my/gcc$ ls
    gcc-linaro-6.5.0-2018.12-x86_64_arm-linux-gnueabihf.tar
    onlylove@ubuntu:~/my/gcc$ tar -xf gcc-linaro-6.5.0-2018.12-x86_64_arm-linux-gnueabihf.tar 
    onlylove@ubuntu:~/my/gcc$ ls
    gcc-linaro-6.5.0-2018.12-x86_64_arm-linux-gnueabihf  gcc-linaro-6.5.0-2018.12-x86_64_arm-linux-gnueabihf.tar
    onlylove@ubuntu:~/my/gcc$ mv gcc-linaro-6.5.0-2018.12-x86_64_arm-linux-gnueabihf/ gcc-linaro-6.5.0
    onlylove@ubuntu:~/my/gcc$ ls
    gcc-linaro-6.5.0  gcc-linaro-6.5.0-2018.12-x86_64_arm-linux-gnueabihf.tar
    onlylove@ubuntu:~/my/gcc$ cd gcc-linaro-6.5.0/
    onlylove@ubuntu:~/my/gcc/gcc-linaro-6.5.0$ ls
    arm-linux-gnueabihf  bin  gcc-linaro-6.5.0-2018.12-linux-manifest.txt  include  lib  libexec  share
    onlylove@ubuntu:~/my/gcc/gcc-linaro-6.5.0$
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    三、uboot编译

    1、解压uboot

    onlylove@ubuntu:~/my/kernel/uboot$ pwd
    /home/onlylove/my/kernel/uboot
    onlylove@ubuntu:~/my/kernel/uboot$ ls
    u-boot-2018.03.tar.bz2
    onlylove@ubuntu:~/my/kernel/uboot$ tar -xjf u-boot-2018.03.tar.bz2 
    onlylove@ubuntu:~/my/kernel/uboot$ ls
    u-boot-2018.03  u-boot-2018.03.tar.bz2
    onlylove@ubuntu:~/my/kernel/uboot$
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    2、设置编译工具链

    # 注释
    # set default to nothing for native builds
    #ifeq ($(HOSTARCH),$(ARCH))
    #CROSS_COMPILE ?=
    #endif
    
    # 添加
    ARCH ?= arm
    CROSS_COMPILE ?= /home/onlylove/my/gcc/gcc-linaro-6.5.0/bin/arm-linux-gnueabihf-
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    3、配置uboot

    1、查看可用配置文件

    onlylove@ubuntu:~/my/kernel/uboot/u-boot-2018.03/configs$ pwd
    /home/onlylove/my/kernel/uboot/u-boot-2018.03/configs
    onlylove@ubuntu:~/my/kernel/uboot/u-boot-2018.03/configs$ ls vexpress* -l
    -rw-rw-r-- 1 onlylove onlylove 1044 Mar 13  2018 vexpress_aemv8a_dram_defconfig
    -rw-rw-r-- 1 onlylove onlylove 1134 Mar 13  2018 vexpress_aemv8a_juno_defconfig
    -rw-rw-r-- 1 onlylove onlylove  983 Mar 13  2018 vexpress_aemv8a_semi_defconfig
    -rw-rw-r-- 1 onlylove onlylove  792 Mar 13  2018 vexpress_ca15_tc2_defconfig
    -rw-rw-r-- 1 onlylove onlylove  765 Mar 13  2018 vexpress_ca5x2_defconfig
    -rw-rw-r-- 1 onlylove onlylove  765 Mar 13  2018 vexpress_ca9x4_defconfig
    onlylove@ubuntu:~/my/kernel/uboot/u-boot-2018.03/configs$
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    2、配置

    onlylove@ubuntu:~/my/kernel/uboot/u-boot-2018.03$ pwd
    /home/onlylove/my/kernel/uboot/u-boot-2018.03
    onlylove@ubuntu:~/my/kernel/uboot/u-boot-2018.03$ make distclean
      CLEAN   u-boot.cfg
      CLEAN   scripts/basic
      CLEAN   scripts/kconfig
      CLEAN   include/config include/generated
      CLEAN   .config include/autoconf.mk include/autoconf.mk.dep include/config.h
    onlylove@ubuntu:~/my/kernel/uboot/u-boot-2018.03$ make vexpress_ca9x4_defconfig
      HOSTCC  scripts/basic/fixdep
      HOSTCC  scripts/kconfig/conf.o
      SHIPPED scripts/kconfig/zconf.tab.c
      SHIPPED scripts/kconfig/zconf.lex.c
      SHIPPED scripts/kconfig/zconf.hash.c
      HOSTCC  scripts/kconfig/zconf.tab.o
    In file included from scripts/kconfig/zconf.tab.c:2468:
    scripts/kconfig/confdata.c: In function ‘conf_write’:
    scripts/kconfig/confdata.c:771:19: warning: ‘%s’ directive writing likely 7 or more bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
      771 |  sprintf(newname, "%s%s", dirname, basename);
          |                   ^~~~~~
    scripts/kconfig/confdata.c:771:19: note: assuming directive output of 7 bytes
    In file included from /usr/include/stdio.h:867,
                     from scripts/kconfig/zconf.tab.c:82:
    /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output 1 or more bytes (assuming 4104) into a destination of size 4097
       36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       37 |       __bos (__s), __fmt, __va_arg_pack ());
          |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from scripts/kconfig/zconf.tab.c:2468:
    scripts/kconfig/confdata.c:774:20: warning: ‘.tmpconfig.’ directive writing 11 bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
      774 |   sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
          |                    ^~~~~~~~~~~~~~~~~
    In file included from /usr/include/stdio.h:867,
                     from scripts/kconfig/zconf.tab.c:82:
    /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 13 and 4119 bytes into a destination of size 4097
       36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       37 |       __bos (__s), __fmt, __va_arg_pack ());
          |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      HOSTLD  scripts/kconfig/conf
    #
    # configuration written to .config
    #
    onlylove@ubuntu:~/my/kernel/uboot/u-boot-2018.03$
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44

    4、编译

    make -j4
    
    • 1

    5、测试

    ./qemu-system-arm -M vexpress-a9 -m 256 -kernel u-boot -nographic
    
    • 1
    onlylove@ubuntu:~/my/qemu-lq$ ls
    qemu-system-arm  u-boot
    onlylove@ubuntu:~/my/qemu-lq$ ./qemu-system-arm -M vexpress-a9 -m 256 -kernel u-boot -nographic
    
    
    U-Boot 2018.03 (Jun 25 2022 - 17:53:48 +0800)
    
    DRAM:  256 MiB
    WARNING: Caches not enabled
    Flash: 128 MiB
    MMC:   MMC: 0
    *** Warning - bad CRC, using default environment
    
    In:    serial
    Out:   serial
    Err:   serial
    Net:   smc911x-0
    Hit any key to stop autoboot:  0 
    => printenv
    arch=arm
    baudrate=38400
    board=vexpress
    board_name=vexpress
    boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
    boot_efi_binary=if fdt addr ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr ${fdtcontroladdr};fi;load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootarm.efi; if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi
    boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
    boot_prefixes=/ /boot/
    boot_script_dhcp=boot.scr.uimg
    boot_scripts=boot.scr.uimg boot.scr
    boot_targets=mmc1 mmc0 pxe dhcp 
    bootcmd=run distro_bootcmd; run bootflash
    bootcmd_dhcp=if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:00010:UNDI:003000;setenv bootp_arch 0xa;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci;
    bootcmd_mmc0=setenv devnum 0; run mmc_boot
    bootcmd_mmc1=setenv devnum 1; run mmc_boot
    bootcmd_pxe=dhcp; if pxe get; then pxe boot; fi
    bootdelay=2
    bootflash=run flashargs; cp ${ramdisk_addr} ${ramdisk_addr_r} ${maxramdisk}; bootm ${kernel_addr} ${ramdisk_addr_r}
    console=ttyAMA0,38400n8
    cpu=armv7
    distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
    dram=1024M
    efi_dtb_prefixes=/ /dtb/ /dtb/current/
    ethact=smc911x-0
    ethaddr=52:54:00:12:34:56
    flashargs=setenv bootargs root=${root} console=${console} mem=${dram} mtdparts=${mtd} mmci.fmax=190000 devtmpfs.mount=0  vmalloc=256M
    kernel_addr=0x44100000
    kernel_addr_r=0x80008000
    load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
    loadaddr=0x80008000
    maxramdisk=0x1800000
    mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi
    mtd=armflash:1M@0x800000(uboot),7M@0x1000000(kernel),24M@0x2000000(initrd)
    pxefile_addr_r=0x88000000
    ramdisk_addr=0x44800000
    ramdisk_addr_r=0x61000000
    root=/dev/sda1 rw
    scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi;
    scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done
    scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootarm.efi; then echo Found EFI removable media binary efi/boot/bootarm.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; setenv efi_fdtfile
    scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.conf; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
    scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
    scriptaddr=0x88000000
    stderr=serial
    stdin=serial
    stdout=serial
    vendor=armltd
    
    Environment size: 4076/262140 bytes
    => 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69

    四、Linux内核编译

    1、解压内核

    onlylove@ubuntu:~/my/kernel/linux$ ls
    linux-4.15.tar.gz
    onlylove@ubuntu:~/my/kernel/linux$ tar -zxf linux-4.15.tar.gz 
    onlylove@ubuntu:~/my/kernel/linux$ ls
    linux-4.15  linux-4.15.tar.gz
    onlylove@ubuntu:~/my/kernel/linux$
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    2、设置编译工具链和平台架构

    1、修改前

    ARCH		?= $(SUBARCH)
    CROSS_COMPILE	?= $(CONFIG_CROSS_COMPILE:"%"=%)
    
    • 1
    • 2

    2、修改后

    ARCH		?= arm
    CROSS_COMPILE	?= /home/onlylove/my/gcc/gcc-linaro-6.5.0/bin/arm-linux-gnueabihf-
    
    • 1
    • 2

    3、设置vexpress_defconfig默认配置

    onlylove@ubuntu:~/my/kernel/linux/linux-4.15$ pwd
    /home/onlylove/my/kernel/linux/linux-4.15
    onlylove@ubuntu:~/my/kernel/linux/linux-4.15$ ls
    arch        COPYING        drivers   init     kernel       mm               net      security    usr
    block       CREDITS        firmware  ipc      lib          modules.builtin  README   sound       virt
    built-in.o  crypto         fs        Kbuild   MAINTAINERS  modules.order    samples  System.map  vmlinux
    certs       Documentation  include   Kconfig  Makefile     Module.symvers   scripts  tools       vmlinux.o
    onlylove@ubuntu:~/my/kernel/linux/linux-4.15$ make distclean
      CLEAN   .
      CLEAN   arch/arm/kernel
      CLEAN   arch/arm/vdso
      CLEAN   drivers/tty/vt
      CLEAN   drivers/video/logo
    ./scripts/gcc-version.sh: line 26: /home/onlylove/my/gcc/gcc-linaro-4.9.4/bin/arm-linux-gnueabihf-gcc: No such file or directory
    ./scripts/gcc-version.sh: line 27: /home/onlylove/my/gcc/gcc-linaro-4.9.4/bin/arm-linux-gnueabihf-gcc: No such file or directory
    ./scripts/gcc-version.sh: line 26: /home/onlylove/my/gcc/gcc-linaro-4.9.4/bin/arm-linux-gnueabihf-gcc: No such file or directory
    ./scripts/gcc-version.sh: line 27: /home/onlylove/my/gcc/gcc-linaro-4.9.4/bin/arm-linux-gnueabihf-gcc: No such file or directory
      CLEAN   kernel
      CLEAN   lib
      CLEAN   usr
    /bin/sh: 1: /home/onlylove/my/gcc/gcc-linaro-4.9.4/bin/arm-linux-gnueabihf-nm: not found
      CLEAN   arch/arm/boot/compressed
      CLEAN   arch/arm/boot
      CLEAN   .tmp_versions
      CLEAN   scripts/basic
      CLEAN   scripts/dtc
    make[2]: /home/onlylove/my/gcc/gcc-linaro-4.9.4/bin/arm-linux-gnueabihf-gcc: Command not found
      CLEAN   scripts/kconfig
      CLEAN   scripts/mod
      CLEAN   scripts
      CLEAN   include/config include/generated arch/arm/include/generated
      CLEAN   .config .version Module.symvers
    onlylove@ubuntu:~/my/kernel/linux/linux-4.15$ make vexpress_defconfig
      HOSTCC  scripts/basic/fixdep
      HOSTCC  scripts/kconfig/conf.o
      SHIPPED scripts/kconfig/zconf.tab.c
      SHIPPED scripts/kconfig/zconf.lex.c
      HOSTCC  scripts/kconfig/zconf.tab.o
    In file included from scripts/kconfig/zconf.tab.c:2468:
    scripts/kconfig/confdata.c: In function ‘conf_write’:
    scripts/kconfig/confdata.c:773:19: warning: ‘%s’ directive writing likely 7 or more bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
      773 |  sprintf(newname, "%s%s", dirname, basename);
          |                   ^~~~~~
    scripts/kconfig/confdata.c:773:19: note: assuming directive output of 7 bytes
    In file included from /usr/include/stdio.h:867,
                     from scripts/kconfig/zconf.tab.c:82:
    /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output 1 or more bytes (assuming 4104) into a destination of size 4097
       36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       37 |       __bos (__s), __fmt, __va_arg_pack ());
          |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from scripts/kconfig/zconf.tab.c:2468:
    scripts/kconfig/confdata.c:776:20: warning: ‘.tmpconfig.’ directive writing 11 bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
      776 |   sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
          |                    ^~~~~~~~~~~~~~~~~
    In file included from /usr/include/stdio.h:867,
                     from scripts/kconfig/zconf.tab.c:82:
    /usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 13 and 4119 bytes into a destination of size 4097
       36 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       37 |       __bos (__s), __fmt, __va_arg_pack ());
          |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      HOSTLD  scripts/kconfig/conf
    #
    # configuration written to .config
    #
    onlylove@ubuntu:~/my/kernel/linux/linux-4.15$ 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67

    4、内核编译

    make -j4
    
    • 1

    5、测试

    ./qemu-system-arm -M vexpress-a9 -m 512M -kernel zImage -append "rdinit=/linuxrc console=ttyAMA0 loglevel=8" -dtb vexpress-v2p-ca9.dtb -nographic
    
    • 1
    onlylove@ubuntu:~/my/qemu-lq$ ./qemu-system-arm -M vexpress-a9 -m 512M -kernel zImage -append "rdinit=/linuxrc console=ttyAMA0 loglevel=8" -dtb vexpress-v2p-ca9.dtb -nographic
    Booting Linux on physical CPU 0x0
    Linux version 4.15.0 (onlylove@ubuntu) (gcc version 6.5.0 (Linaro GCC 6.5-2018.12)) #1 SMP Sat Jun 25 19:45:44 CST 2022
    CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d
    CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
    OF: fdt: Machine model: V2P-CA9
    Memory policy: Data cache writeback
    On node 0 totalpages: 131072
      Normal zone: 1024 pages used for memmap
      Normal zone: 0 pages reserved
      Normal zone: 131072 pages, LIFO batch:31
    CPU: All CPU(s) started in SVC mode.
    percpu: Embedded 16 pages/cpu @(ptrval) s36044 r8192 d21300 u65536
    pcpu-alloc: s36044 r8192 d21300 u65536 alloc=16*4096
    pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
    Built 1 zonelists, mobility grouping on.  Total pages: 130048
    Kernel command line: rdinit=/linuxrc console=ttyAMA0 loglevel=8
    log_buf_len individual max cpu contribution: 4096 bytes
    log_buf_len total cpu_extra contributions: 12288 bytes
    log_buf_len min size: 16384 bytes
    log_buf_len: 32768 bytes
    early log buf free: 15100(92%)
    Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
    Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
    Memory: 509624K/524288K available (6144K kernel code, 387K rwdata, 1364K rodata, 1024K init, 165K bss, 14664K reserved, 0K cma-reserved)
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
        vmalloc : 0xa0800000 - 0xff800000   (1520 MB)
        lowmem  : 0x80000000 - 0xa0000000   ( 512 MB)
        modules : 0x7f000000 - 0x80000000   (  16 MB)
          .text : 0x(ptrval) - 0x(ptrval)   (7136 kB)
          .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
          .data : 0x(ptrval) - 0x(ptrval)   ( 388 kB)
           .bss : 0x(ptrval) - 0x(ptrval)   ( 166 kB)
    SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
    Hierarchical RCU implementation.
    	RCU event tracing is enabled.
    	RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
    RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
    NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
    GIC CPU mask not found - kernel will fail to boot.
    GIC CPU mask not found - kernel will fail to boot.
    L2C: platform modifies aux control register: 0x02020000 -> 0x02420000
    L2C: DT/platform modifies aux control register: 0x02020000 -> 0x02420000
    L2C-310 enabling early BRESP for Cortex-A9
    L2C-310 full line of zeros enabled for Cortex-A9
    L2C-310 dynamic clock gating disabled, standby mode disabled
    L2C-310 cache controller enabled, 8 ways, 128 kB
    L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x46420001
    smp_twd: clock not found -2
    sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
    clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
    Failed to initialize '/smb@4000000/motherboard/iofpga@7,00000000/timer@12000': -22
    Console: colour dummy device 80x30
    Calibrating local timer... 93.43MHz.
    Calibrating delay loop... 1587.60 BogoMIPS (lpj=7938048)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    CPU: Testing write buffer coherency: ok
    CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
    Setting up static identity map for 0x60100000 - 0x60100060
    Hierarchical SRCU implementation.
    smp: Bringing up secondary CPUs ...
    smp: Brought up 1 node, 1 CPU
    SMP: Total of 1 processors activated (1587.60 BogoMIPS).
    CPU: All CPU(s) started in SVC mode.
    devtmpfs: initialized
    random: get_random_u32 called from bucket_table_alloc+0xf4/0x248 with crng_init=0
    VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 0
    clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    futex hash table entries: 1024 (order: 4, 65536 bytes)
    random: fast init done
    NET: Registered protocol family 16
    DMA: preallocated 256 KiB pool for atomic coherent allocations
    cpuidle: using governor ladder
    hw-breakpoint: debug architecture 0x4 unsupported.
    Serial: AMBA PL011 UART driver
    OF: amba_device_add() failed (-19) for /memory-controller@100e0000
    OF: amba_device_add() failed (-19) for /memory-controller@100e1000
    OF: amba_device_add() failed (-19) for /watchdog@100e5000
    irq: type mismatch, failed to map hwirq-75 for interrupt-controller@1e001000!
    10009000.uart: ttyAMA0 at MMIO 0x10009000 (irq = 38, base_baud = 0) is a PL011 rev1
    console [ttyAMA0] enabled
    1000a000.uart: ttyAMA1 at MMIO 0x1000a000 (irq = 39, base_baud = 0) is a PL011 rev1
    1000b000.uart: ttyAMA2 at MMIO 0x1000b000 (irq = 40, base_baud = 0) is a PL011 rev1
    1000c000.uart: ttyAMA3 at MMIO 0x1000c000 (irq = 41, base_baud = 0) is a PL011 rev1
    OF: amba_device_add() failed (-19) for /smb@4000000/motherboard/iofpga@7,00000000/wdt@f000
    SCSI subsystem initialized
    libata version 3.00 loaded.
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    Advanced Linux Sound Architecture Driver Initialized.
    clocksource: Switched to clocksource arm,sp804
    NET: Registered protocol family 2
    TCP established hash table entries: 4096 (order: 2, 16384 bytes)
    TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
    TCP: Hash tables configured (established 4096 bind 4096)
    UDP hash table entries: 256 (order: 1, 8192 bytes)
    UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
    NET: Registered protocol family 1
    RPC: Registered named UNIX socket transport module.
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    hw perfevents: enabled with armv7_cortex_a9 PMU driver, 5 counters available
    workingset: timestamp_bits=30 max_order=17 bucket_order=0
    squashfs: version 4.0 (2009/01/31) Phillip Lougher
    jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
    9p: Installing v9fs 9p2000 file system support
    io scheduler noop registered (default)
    io scheduler mq-deadline registered
    io scheduler kyber registered
    clcd-pl11x 10020000.clcd: PL111 designer 41 rev2 at 0x10020000
    clcd-pl11x 10020000.clcd: clcd@10020000 hardware, 1024x768@59 display
    Console: switching to colour frame buffer device 128x48
    clcd-pl11x 1001f000.clcd: PL111 designer 41 rev2 at 0x1001f000
    clcd-pl11x 1001f000.clcd: clcd@1f000 hardware, 640x480@59 display
    40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
    Intel/Sharp Extended Query Table at 0x0031
    Using buffer write method
    erase region 0: offset=0x0,size=0x40000,blocks=256
    40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
    Intel/Sharp Extended Query Table at 0x0031
    Using buffer write method
    erase region 0: offset=0x0,size=0x40000,blocks=256
    Concatenating MTD devices:
    (0): "40000000.flash"
    (1): "40000000.flash"
    into device "40000000.flash"
    libphy: Fixed MDIO Bus: probed
    libphy: smsc911x-mdio: probed
    smsc911x 4e000000.ethernet eth0: MAC Address: 52:54:00:12:34:56
    isp1760 4f000000.usb: bus width: 32, oc: digital
    isp1760 4f000000.usb: NXP ISP1760 USB Host Controller
    isp1760 4f000000.usb: new USB bus registered, assigned bus number 1
    isp1760 4f000000.usb: Scratch test failed.
    isp1760 4f000000.usb: can't setup: -19
    isp1760 4f000000.usb: USB bus 1 deregistered
    usbcore: registered new interface driver usb-storage
    rtc-pl031 10017000.rtc: rtc core: registered pl031 as rtc0
    mmci-pl18x 10005000.mmci: Got CD GPIO
    mmci-pl18x 10005000.mmci: Got WP GPIO
    mmci-pl18x 10005000.mmci: mmc0: PL181 manf 41 rev0 at 0x10005000 irq 34,35 (pio)
    ledtrig-cpu: registered to indicate activity on CPUs
    usbcore: registered new interface driver usbhid
    usbhid: USB HID core driver
    aaci-pl041 10004000.aaci: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 33
    aaci-pl041 10004000.aaci: FIFO 512 entries
    oprofile: using arm/armv7-ca9
    NET: Registered protocol family 17
    9pnet: Installing 9P2000 support
    Registering SWP/SWPB emulation handler
    input: AT Raw Set 2 keyboard as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:iofpga@7,00000000/10006000.kmi/serio0/input/input0
    rtc-pl031 10017000.rtc: setting system clock to 2022-06-25 12:09:06 UTC (1656158946)
    ALSA device list:
      #0: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 33
    input: ImExPS/2 Generic Explorer Mouse as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:iofpga@7,00000000/10007000.kmi/serio1/input/input2
    VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
    Please append a correct "root=" boot option; here are the available partitions:
    1f00          131072 mtdblock0 
     (driver?)
    1f01           32768 mtdblock1 
     (driver?)
    Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.15.0 #1
    Hardware name: ARM-Versatile Express
    [<8010fb20>] (unwind_backtrace) from [<8010bd94>] (show_stack+0x10/0x14)
    [<8010bd94>] (show_stack) from [<8065ef0c>] (dump_stack+0x84/0x98)
    [<8065ef0c>] (dump_stack) from [<8011f00c>] (panic+0xdc/0x248)
    [<8011f00c>] (panic) from [<8090128c>] (mount_block_root+0x1b0/0x284)
    [<8090128c>] (mount_block_root) from [<80901480>] (mount_root+0x120/0x128)
    [<80901480>] (mount_root) from [<809015d8>] (prepare_namespace+0x150/0x194)
    [<809015d8>] (prepare_namespace) from [<80900eb4>] (kernel_init_freeable+0x240/0x250)
    [<80900eb4>] (kernel_init_freeable) from [<806733d8>] (kernel_init+0x8/0x108)
    [<806733d8>] (kernel_init) from [<80107948>] (ret_from_fork+0x14/0x2c)
    ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179

    五、根文件系统制作

    1、busybox编译

    1、解压

    onlylove@ubuntu:~/my/busybox$ ls
    busybox-1.35.0.tar.bz2
    onlylove@ubuntu:~/my/busybox$ tar -jxf busybox-1.35.0.tar.bz2 
    onlylove@ubuntu:~/my/busybox$ ls
    busybox-1.35.0  busybox-1.35.0.tar.bz2
    onlylove@ubuntu:~/my/busybox$
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    2、设置编译工具链和平台架构

    #注释
    #CROSS_COMPILE ?=
    #ARCH ?= $(SUBARCH)
    
    #添加
    CROSS_COMPILE ?= /home/onlylove/my/gcc/gcc-linaro-6.5.0/bin/arm-linux-gnueabihf-
    ARCH ?= arm
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    3、配置

    make menuconfig
    
    • 1
    Settings —>
    	Build Options
    		[ ] Build static binary (no shared libs)(勾选)
    
    • 1
    • 2
    • 3

    4、编译

    make -j4
    
    • 1
    onlylove@ubuntu:~/my/busybox/busybox-1.35.0$ make -j4
      HOSTLD  scripts/kconfig/conf
    scripts/kconfig/conf -s Config.in
    #
    # using defaults found in .config
    #
      SPLIT   include/autoconf.h -> include/config/*
      GEN     include/bbconfigopts.h
      GEN     include/common_bufsiz.h
      GEN     include/embedded_scripts.h
      HOSTCC  applets/usage
      HOSTCC  applets/applet_tables
    applets/usage.c: In function ‘main’:
    applets/usage.c:52:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-resul]
       52 |   write(STDOUT_FILENO, usage_array[i].usage, strlen(usage_array[i].usage) + 1);
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      GEN     include/usage_compressed.h
      GEN     include/applet_tables.h include/NUM_APPLETS.h
      GEN     include/applet_tables.h include/NUM_APPLETS.h
      HOSTCC  applets/usage_pod
      CC      applets/applets.o
      LD      applets/built-in.o
      DOC     busybox.pod
      DOC     BusyBox.txt
      DOC     busybox.1
      DOC     BusyBox.html
      LD      archival/built-in.o
      CC      archival/bbunzip.o
      CC      archival/bzip2.o
      LD      archival/libarchive/built-in.o
      CC      archival/libarchive/common.o
      LD      console-tools/built-in.o
      CC      console-tools/chvt.o
      CC      archival/libarchive/data_align.o
      CC      console-tools/clear.o
      CC      archival/chksum_and_xwrite_tar_header.o
      CC      archival/libarchive/data_extract_all.o
      CC      console-tools/deallocvt.o
      CC      archival/cpio.o
      CC      console-tools/dumpkmap.o
      CC      archival/libarchive/data_extract_to_command.o
      CC      console-tools/fgconsole.o
      CC      console-tools/kbd_mode.o
      CC      archival/libarchive/data_extract_to_stdout.o
      CC      console-tools/loadfont.o
      CC      console-tools/loadkmap.o
      CC      archival/libarchive/data_skip.o
      CC      archival/dpkg.o
      CC      console-tools/openvt.o
      CC      archival/libarchive/decompress_bunzip2.o
      CC      console-tools/reset.o
      LD      coreutils/built-in.o
      CC      coreutils/basename.o
      CC      console-tools/resize.o
      CC      coreutils/cat.o
      CC      console-tools/setconsole.o
      CC      archival/libarchive/decompress_gunzip.o
      CC      console-tools/setkeycodes.o
      CC      coreutils/chgrp.o
      CC      console-tools/setlogcons.o
      CC      coreutils/chmod.o
      CC      archival/dpkg_deb.o
      CC      console-tools/showkey.o
      CC      coreutils/chown.o
      CC      archival/libarchive/decompress_unlzma.o
      CC      archival/gzip.o
      AR      console-tools/lib.a
      CC      archival/lzop.o
      CC      coreutils/chroot.o
      CC      archival/libarchive/decompress_unxz.o
      CC      coreutils/cksum.o
      CC      coreutils/comm.o
      CC      archival/rpm.o
      CC      coreutils/cp.o
      CC      archival/tar.o
      CC      coreutils/cut.o
      CC      archival/unzip.o
      CC      archival/libarchive/filter_accept_all.o
      CC      coreutils/date.o
      CC      coreutils/dd.o
      CC      archival/libarchive/filter_accept_list.o
      AR      archival/lib.a
      LD      coreutils/libcoreutils/built-in.o
      CC      coreutils/libcoreutils/cp_mv_stat.o
      CC      coreutils/df.o
      CC      archival/libarchive/filter_accept_list_reassign.o
      CC      coreutils/libcoreutils/getopt_mk_fifo_nod.o
      CC      coreutils/dirname.o
      CC      archival/libarchive/filter_accept_reject_list.o
      CC      coreutils/dos2unix.o
      AR      coreutils/libcoreutils/lib.a
      CC      coreutils/du.o
      LD      debianutils/built-in.o
      CC      debianutils/pipe_progress.o
      CC      archival/libarchive/find_list_entry.o
      CC      coreutils/echo.o
      CC      debianutils/run_parts.o
      CC      archival/libarchive/get_header_ar.o
      LD      klibc-utils/built-in.o
      CC      klibc-utils/resume.o
      CC      coreutils/env.o
      CC      debianutils/start_stop_daemon.o
      CC      archival/libarchive/get_header_cpio.o
      AR      klibc-utils/lib.a
      CC      coreutils/expand.o
      CC      coreutils/expr.o
      CC      archival/libarchive/get_header_tar.o
      CC      debianutils/which.o
      LD      e2fsprogs/built-in.o
      CC      e2fsprogs/chattr.o
      CC      coreutils/factor.o
      AR      debianutils/lib.a
      LD      editors/built-in.o
      CC      editors/awk.o
      CC      e2fsprogs/e2fs_lib.o
      CC      archival/libarchive/get_header_tar_bz2.o
      CC      coreutils/false.o
      CC      e2fsprogs/fsck.o
      CC      archival/libarchive/get_header_tar_gz.o
      CC      coreutils/fold.o
      CC      archival/libarchive/get_header_tar_lzma.o
      CC      coreutils/head.o
      CC      archival/libarchive/get_header_tar_xz.o
      CC      e2fsprogs/lsattr.o
      CC      archival/libarchive/header_list.o
      CC      coreutils/hostid.o
      AR      e2fsprogs/lib.a
      CC      archival/libarchive/header_skip.o
      CC      coreutils/id.o
      LD      findutils/built-in.o
      CC      findutils/find.o
      CC      archival/libarchive/header_verbose_list.o
      CC      coreutils/install.o
      CC      archival/libarchive/init_handle.o
      CC      coreutils/link.o
      CC      archival/libarchive/lzo1x_1.o
      CC      editors/cmp.o
      CC      findutils/grep.o
      CC      coreutils/ln.o
      CC      archival/libarchive/lzo1x_1o.o
      CC      editors/diff.o
      CC      coreutils/logname.o
      CC      findutils/xargs.o
      CC      coreutils/ls.o
      CC      archival/libarchive/lzo1x_d.o
      CC      archival/libarchive/open_transformer.o
      AR      findutils/lib.a
      LD      init/built-in.o
      CC      init/bootchartd.o
      CC      editors/ed.o
      CC      coreutils/md5_sha1_sum.o
      CC      archival/libarchive/seek_by_jump.o
      CC      init/halt.o
      CC      coreutils/mkdir.o
      CC      archival/libarchive/seek_by_read.o
      CC      init/init.o
      CC      archival/libarchive/unpack_ar_archive.o
      CC      coreutils/mkfifo.o
      CC      editors/patch.o
      CC      coreutils/mknod.o
      CC      archival/libarchive/unsafe_prefix.o
      AR      init/lib.a
      CC      archival/libarchive/unsafe_symlink_target.o
      CC      coreutils/mktemp.o
      LD      libbb/built-in.o
      CC      libbb/appletlib.o
      CC      editors/sed.o
      AR      archival/libarchive/lib.a
      CC      coreutils/mv.o
      LD      libpwdgrp/built-in.o
      CC      libpwdgrp/pwd_grp.o
      CC      coreutils/nice.o
      CC      coreutils/nl.o
      CC      libpwdgrp/uidgid_get.o
      CC      libbb/ask_confirmation.o
      CC      editors/vi.o
      CC      coreutils/nohup.o
      AR      libpwdgrp/lib.a
      CC      libbb/auto_string.o
      LD      loginutils/built-in.o
      CC      loginutils/add-remove-shell.o
      CC      coreutils/nproc.o
      CC      libbb/bb_askpass.o
      CC      loginutils/addgroup.o
      CC      coreutils/od.o
      CC      libbb/bb_bswap_64.o
      CC      loginutils/adduser.o
      CC      libbb/bb_cat.o
      CC      loginutils/chpasswd.o
      CC      libbb/bb_do_delay.o
      CC      loginutils/cryptpw.o
      CC      libbb/bb_getgroups.o
      CC      coreutils/paste.o
      CC      loginutils/deluser.o
      CC      libbb/bb_getsockname.o
      CC      coreutils/printenv.o
      CC      loginutils/getty.o
      CC      libbb/bb_pwd.o
      CC      coreutils/printf.o
      CC      libbb/bb_qsort.o
      CC      loginutils/login.o
      CC      coreutils/pwd.o
      CC      libbb/bb_strtonum.o
      AR      editors/lib.a
      LD      mailutils/built-in.o
      CC      loginutils/passwd.o
      CC      mailutils/mail.o
      CC      coreutils/readlink.o
      CC      libbb/capability.o
      CC      coreutils/realpath.o
      CC      loginutils/su.o
      CC      mailutils/makemime.o
      CC      libbb/change_identity.o
      CC      coreutils/rm.o
      CC      mailutils/popmaildir.o
      CC      loginutils/sulogin.o
      CC      libbb/chomp.o
      CC      coreutils/rmdir.o
      CC      loginutils/vlock.o
      CC      libbb/common_bufsiz.o
      CC      mailutils/reformime.o
      CC      coreutils/seq.o
      CC      libbb/compare_string_array.o
      AR      loginutils/lib.a
      LD      miscutils/built-in.o
      CC      miscutils/adjtimex.o
      CC      mailutils/sendmail.o
      CC      coreutils/shred.o
      CC      libbb/concat_path_file.o
      CC      miscutils/ascii.o
      CC      coreutils/shuf.o
      CC      libbb/concat_subpath_file.o
      AR      mailutils/lib.a
      CC      miscutils/bc.o
      CC      miscutils/beep.o
      CC      libbb/const_hack.o
      CC      coreutils/sleep.o
      CC      miscutils/chat.o
      CC      libbb/copy_file.o
      CC      coreutils/sort.o
      CC      miscutils/conspy.o
      CC      libbb/copyfd.o
      CC      coreutils/split.o
      CC      libbb/correct_password.o
      CC      miscutils/crond.o
      CC      coreutils/stat.o
      CC      libbb/crc32.o
      CC      libbb/default_error_retval.o
      CC      coreutils/stty.o
      CC      miscutils/crontab.o
      CC      libbb/device_open.o
      CC      libbb/dump.o
      CC      miscutils/devmem.o
      CC      coreutils/sum.o
      CC      miscutils/fbsplash.o
      CC      coreutils/sync.o
      CC      libbb/duration.o
      CC      coreutils/tac.o
      CC      coreutils/tail.o
      CC      libbb/endofname.o
      CC      libbb/executable.o
      CC      libbb/fclose_nonstdin.o
      CC      coreutils/tee.o
      CC      libbb/fflush_stdout_and_exit.o
      CC      libbb/fgets_str.o
      CC      coreutils/test.o
      CC      coreutils/test_ptr_hack.o
      CC      coreutils/timeout.o
      CC      libbb/find_mount_point.o
      CC      miscutils/hdparm.o
      CC      coreutils/touch.o
      CC      libbb/find_pid_by_name.o
      CC      coreutils/tr.o
      CC      coreutils/true.o
      CC      libbb/find_root_device.o
      CC      coreutils/truncate.o
      CC      coreutils/tty.o
      CC      libbb/full_write.o
      CC      coreutils/uname.o
      CC      coreutils/uniq.o
      CC      libbb/get_console.o
      CC      coreutils/unlink.o
      CC      libbb/get_cpu_count.o
      CC      coreutils/usleep.o
      CC      miscutils/hexedit.o
      CC      libbb/get_last_path_component.o
      CC      libbb/get_line_from_file.o
      CC      coreutils/uudecode.o
      CC      libbb/get_shell_name.o
      CC      libbb/get_volsize.o
      CC      miscutils/i2c_tools.o
      LD      modutils/built-in.o
      CC      modutils/modinfo.o
      CC      coreutils/uuencode.o
      CC      libbb/getopt32.o
      CC      coreutils/wc.o
      CC      modutils/modprobe-small.o
      CC      libbb/getopt_allopts.o
      CC      coreutils/who.o
      CC      libbb/getpty.o
      CC      miscutils/less.o
      CC      coreutils/whoami.o
      CC      libbb/hash_md5_sha.o
      CC      modutils/modutils.o
      CC      coreutils/yes.o
      AR      modutils/lib.a
      AR      coreutils/lib.a
      CC      libbb/herror_msg.o
      LD      networking/built-in.o
      CC      networking/arp.o
      CC      libbb/human_readable.o
      CC      libbb/in_ether.o
      CC      networking/arping.o
      CC      miscutils/lsscsi.o
      CC      libbb/inet_cksum.o
      CC      libbb/inet_common.o
      CC      libbb/inode_hash.o
      CC      miscutils/makedevs.o
      CC      networking/brctl.o
      CC      networking/dnsd.o
      CC      libbb/isdirectory.o
      CC      miscutils/man.o
      CC      networking/ether-wake.o
      CC      libbb/isqrt.o
      CC      networking/ftpd.o
      CC      networking/ftpgetput.o
      CC      miscutils/microcom.o
      CC      libbb/iterate_on_dir.o
      CC      libbb/kernel_version.o
      CC      miscutils/mt.o
      CC      miscutils/nandwrite.o
      CC      networking/hostname.o
      CC      libbb/last_char_is.o
      CC      networking/httpd.o
      CC      miscutils/partprobe.o
      CC      libbb/lineedit.o
      CC      networking/ifconfig.o
      CC      miscutils/raidautorun.o
      CC      networking/ifenslave.o
      CC      miscutils/readahead.o
      CC      miscutils/runlevel.o
      CC      networking/ifplugd.o
      CC      miscutils/rx.o
      CC      miscutils/setfattr.o
      CC      networking/ifupdown.o
      CC      miscutils/setserial.o
      CC      libbb/lineedit_ptr_hack.o
      CC      networking/inetd.o
      CC      libbb/llist.o
      CC      miscutils/strings.o
      CC      libbb/logenv.o
      CC      miscutils/time.o
      CC      libbb/login.o
      CC      libbb/loop.o
      CC      libbb/make_directory.o
      CC      miscutils/ts.o
      CC      networking/interface.o
      CC      libbb/makedev.o
      CC      libbb/match_fstype.o
      CC      libbb/messages.o
      CC      miscutils/ttysize.o
      CC      networking/ip.o
      CC      libbb/missing_syscalls.o
      CC      miscutils/ubi_tools.o
      LD      networking/libiproute/built-in.o
      CC      networking/libiproute/ip_parse_common_args.o
      CC      libbb/mode_string.o
      CC      networking/ipcalc.o
      CC      miscutils/ubirename.o
      CC      networking/libiproute/ipaddress.o
      CC      libbb/nuke_str.o
      CC      networking/isrv.o
      CC      miscutils/volname.o
      CC      libbb/obscure.o
      CC      miscutils/watchdog.o
      CC      libbb/parse_config.o
      CC      networking/isrv_identd.o
      AR      miscutils/lib.a
      CC      networking/nameif.o
      CC      networking/libiproute/iplink.o
      CC      libbb/parse_mode.o
      CC      networking/libiproute/ipneigh.o
      CC      networking/nbd-client.o
      CC      libbb/percent_decode.o
      CC      libbb/perror_msg.o
      CC      networking/libiproute/iproute.o
      CC      networking/nc.o
      CC      networking/libiproute/iprule.o
      CC      libbb/perror_nomsg.o
      CC      libbb/perror_nomsg_and_die.o
      CC      libbb/pidfile.o
      CC      libbb/platform.o
      CC      networking/netstat.o
      CC      libbb/print_flags.o
      CC      networking/libiproute/iptunnel.o
      CC      libbb/print_numbered_lines.o
      CC      networking/libiproute/libnetlink.o
      CC      libbb/printable.o
      CC      networking/nslookup.o
      CC      libbb/printable_string.o
      CC      networking/libiproute/ll_addr.o
      CC      networking/libiproute/ll_map.o
      CC      libbb/process_escape_sequence.o
      CC      networking/libiproute/ll_proto.o
      CC      networking/libiproute/ll_types.o
      CC      networking/ntpd.o
      CC      libbb/procps.o
      CC      networking/libiproute/rt_names.o
      CC      networking/libiproute/rtm_map.o
      CC      networking/libiproute/utils.o
      LD      networking/udhcp/built-in.o
      CC      networking/udhcp/arpping.o
      CC      libbb/progress.o
      CC      networking/udhcp/common.o
      AR      networking/libiproute/lib.a
      LD      printutils/built-in.o
      CC      libbb/ptr_to_globals.o
      CC      printutils/lpd.o
      CC      libbb/pw_encrypt.o
      CC      networking/parse_pasv_epsv.o
      CC      printutils/lpr.o
      CC      networking/udhcp/d6_dhcpc.o
      CC      networking/ping.o
      AR      printutils/lib.a
      CC      networking/pscan.o
      CC      libbb/read.o
      CC      libbb/read_key.o
      CC      networking/route.o
      CC      libbb/read_printf.o
      CC      libbb/recursive_action.o
      CC      networking/udhcp/d6_packet.o
      CC      networking/udhcp/d6_socket.o
      CC      networking/slattach.o
      CC      libbb/remove_file.o
      CC      libbb/replace.o
      CC      networking/udhcp/dhcpc.o
      CC      networking/udhcp/dhcpd.o
      CC      libbb/rtc.o
      CC      networking/ssl_client.o
      CC      networking/tc.o
      CC      libbb/run_shell.o
      CC      libbb/safe_gethostname.o
      CC      networking/tcpudp.o
      LD      procps/built-in.o
      CC      procps/free.o
      CC      libbb/safe_poll.o
      CC      networking/udhcp/dhcprelay.o
      CC      libbb/safe_strncpy.o
      CC      procps/fuser.o
      CC      networking/tcpudp_perhost.o
      CC      networking/udhcp/domain_codec.o
      CC      libbb/safe_write.o
      CC      networking/telnet.o
      CC      procps/iostat.o
      CC      networking/udhcp/dumpleases.o
      CC      libbb/securetty.o
      CC      networking/udhcp/packet.o
      CC      libbb/setup_environment.o
      CC      networking/telnetd.o
      CC      procps/kill.o
      CC      libbb/signals.o
      CC      networking/udhcp/signalpipe.o
      CC      procps/lsof.o
      CC      libbb/simplify_path.o
      CC      networking/udhcp/socket.o
      CC      networking/tftp.o
      CC      procps/mpstat.o
      CC      libbb/single_argv.o
      AR      networking/udhcp/lib.a
      CC      procps/nmeter.o
      CC      libbb/skip_whitespace.o
      CC      networking/tls.o
      CC      libbb/speed_table.o
      CC      libbb/str_tolower.o
      CC      procps/pgrep.o
      CC      procps/pidof.o
      CC      libbb/strrstr.o
      CC      procps/pmap.o
      CC      procps/powertop.o
      CC      networking/tls_aes.o
      CC      libbb/sysconf.o
      CC      libbb/time.o
      CC      libbb/trim.o
      CC      networking/tls_aesgcm.o
      CC      procps/ps.o
      CC      libbb/u_signal_names.o
      CC      libbb/ubi.o
      CC      networking/tls_fe.o
      CC      libbb/udp_io.o
      CC      libbb/unicode.o
      CC      procps/pstree.o
      CC      libbb/update_passwd.o
      CC      networking/tls_pstm.o
      CC      libbb/utmp.o
      CC      procps/pwdx.o
      CC      networking/tls_pstm_montgomery_reduce.o
      CC      libbb/uuencode.o
      CC      procps/smemcap.o
      CC      libbb/verror_msg.o
      LD      runit/built-in.o
      CC      runit/chpst.o
      CC      procps/sysctl.o
      CC      networking/tls_pstm_mul_comba.o
      CC      libbb/vfork_daemon_rexec.o
      CC      runit/runsv.o
      CC      procps/top.o
      CC      networking/tls_pstm_sqr_comba.o
      CC      libbb/warn_ignoring_args.o
      CC      networking/tls_rsa.o
      CC      libbb/wfopen.o
      CC      runit/runsvdir.o
      CC      networking/tls_sp_c32.o
      CC      libbb/wfopen_input.o
      CC      procps/uptime.o
      CC      libbb/write.o
      CC      runit/sv.o
      CC      procps/watch.o
      CC      libbb/xatonum.o
      CC      networking/traceroute.o
      AR      procps/lib.a
      CC      networking/tunctl.o
      CC      runit/svlogd.o
      CC      libbb/xconnect.o
      CC      libbb/xfunc_die.o
      CC      networking/vconfig.o
      CC      libbb/xfuncs.o
      CC      networking/wget.o
      LD      selinux/built-in.o
      AR      selinux/lib.a
      LD      shell/built-in.o
      CC      shell/ash.o
      CC      libbb/xfuncs_printf.o
      AR      runit/lib.a
      LD      sysklogd/built-in.o
      CC      sysklogd/klogd.o
      CC      sysklogd/logread.o
      CC      libbb/xgetcwd.o
      CC      networking/whois.o
      CC      sysklogd/syslogd_and_logger.o
      CC      libbb/xgethostbyname.o
      CC      networking/zcip.o
      CC      libbb/xreadlink.o
      AR      networking/lib.a
      LD      util-linux/built-in.o
      CC      util-linux/acpid.o
      CC      libbb/xrealloc_vector.o
      AR      sysklogd/lib.a
      LD      util-linux/volume_id/built-in.o
      CC      util-linux/volume_id/bcache.o
      CC      libbb/xregcomp.o
      CC      util-linux/blkdiscard.o
      CC      util-linux/volume_id/btrfs.o
      AR      libbb/lib.a
      CC      shell/ash_ptr_hack.o
      CC      util-linux/blkid.o
      CC      shell/cttyhack.o
      CC      util-linux/volume_id/cramfs.o
      CC      util-linux/blockdev.o
      CC      util-linux/volume_id/erofs.o
      CC      shell/hush.o
      CC      util-linux/cal.o
      CC      util-linux/volume_id/exfat.o
      CC      util-linux/volume_id/ext.o
      CC      util-linux/chrt.o
      CC      util-linux/volume_id/f2fs.o
      CC      util-linux/dmesg.o
      CC      util-linux/volume_id/fat.o
      CC      util-linux/eject.o
      CC      util-linux/volume_id/get_devname.o
      CC      util-linux/fallocate.o
      CC      util-linux/volume_id/hfs.o
      CC      util-linux/fatattr.o
      CC      util-linux/volume_id/iso9660.o
      CC      util-linux/fbset.o
      CC      util-linux/volume_id/jfs.o
      CC      util-linux/fdformat.o
      CC      util-linux/volume_id/lfs.o
      CC      util-linux/fdisk.o
      CC      util-linux/volume_id/linux_raid.o
      CC      util-linux/volume_id/linux_swap.o
      CC      util-linux/volume_id/luks.o
      CC      util-linux/volume_id/minix.o
      CC      util-linux/volume_id/nilfs.o
      CC      shell/match.o
      CC      util-linux/volume_id/ntfs.o
      CC      shell/math.o
      CC      shell/random.o
      CC      util-linux/volume_id/ocfs2.o
      CC      util-linux/findfs.o
      CC      shell/shell_common.o
      CC      util-linux/volume_id/reiserfs.o
      CC      util-linux/flock.o
      CC      util-linux/freeramdisk.o
      CC      util-linux/volume_id/romfs.o
      CC      util-linux/fsck_minix.o
      CC      util-linux/fsfreeze.o
      AR      shell/lib.a
      CC      util-linux/fstrim.o
      CC      util-linux/volume_id/squashfs.o
      CC      util-linux/getopt.o
      CC      util-linux/hexdump.o
      CC      util-linux/volume_id/sysv.o
      CC      util-linux/hexdump_xxd.o
      CC      util-linux/volume_id/ubifs.o
      CC      util-linux/hwclock.o
      CC      util-linux/volume_id/udf.o
      CC      util-linux/ionice.o
      CC      util-linux/ipcrm.o
      CC      util-linux/ipcs.o
      CC      util-linux/last_fancy.o
      CC      util-linux/volume_id/util.o
      CC      util-linux/losetup.o
      CC      util-linux/lspci.o
      CC      util-linux/lsusb.o
      CC      util-linux/volume_id/volume_id.o
      CC      util-linux/mdev.o
      CC      util-linux/volume_id/xfs.o
      CC      util-linux/mesg.o
      CC      util-linux/mkfs_ext2.o
      AR      util-linux/volume_id/lib.a
      CC      util-linux/mkfs_minix.o
      CC      util-linux/mkfs_vfat.o
      CC      util-linux/mkswap.o
      CC      util-linux/more.o
      CC      util-linux/mount.o
      CC      util-linux/mountpoint.o
      CC      util-linux/nsenter.o
      CC      util-linux/pivot_root.o
      CC      util-linux/rdate.o
      CC      util-linux/rdev.o
      CC      util-linux/readprofile.o
      CC      util-linux/renice.o
      CC      util-linux/rev.o
      CC      util-linux/rtcwake.o
      CC      util-linux/script.o
      CC      util-linux/scriptreplay.o
      CC      util-linux/setarch.o
      CC      util-linux/setpriv.o
      CC      util-linux/setsid.o
      CC      util-linux/swaponoff.o
      CC      util-linux/switch_root.o
      CC      util-linux/taskset.o
      CC      util-linux/uevent.o
      CC      util-linux/umount.o
      CC      util-linux/unshare.o
      CC      util-linux/wall.o
      AR      util-linux/lib.a
      LINK    busybox_unstripped
    Static linking against glibc, can't use --gc-sections
    Trying libraries: crypt m resolv rt
     Library crypt is not needed, excluding it
     Library m is needed, can't exclude it (yet)
     Library resolv is needed, can't exclude it (yet)
     Library rt is not needed, excluding it
     Library m is needed, can't exclude it (yet)
     Library resolv is needed, can't exclude it (yet)
    Final link with: m resolv
    onlylove@ubuntu:~/my/busybox/busybox-1.35.0$ 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326
    • 327
    • 328
    • 329
    • 330
    • 331
    • 332
    • 333
    • 334
    • 335
    • 336
    • 337
    • 338
    • 339
    • 340
    • 341
    • 342
    • 343
    • 344
    • 345
    • 346
    • 347
    • 348
    • 349
    • 350
    • 351
    • 352
    • 353
    • 354
    • 355
    • 356
    • 357
    • 358
    • 359
    • 360
    • 361
    • 362
    • 363
    • 364
    • 365
    • 366
    • 367
    • 368
    • 369
    • 370
    • 371
    • 372
    • 373
    • 374
    • 375
    • 376
    • 377
    • 378
    • 379
    • 380
    • 381
    • 382
    • 383
    • 384
    • 385
    • 386
    • 387
    • 388
    • 389
    • 390
    • 391
    • 392
    • 393
    • 394
    • 395
    • 396
    • 397
    • 398
    • 399
    • 400
    • 401
    • 402
    • 403
    • 404
    • 405
    • 406
    • 407
    • 408
    • 409
    • 410
    • 411
    • 412
    • 413
    • 414
    • 415
    • 416
    • 417
    • 418
    • 419
    • 420
    • 421
    • 422
    • 423
    • 424
    • 425
    • 426
    • 427
    • 428
    • 429
    • 430
    • 431
    • 432
    • 433
    • 434
    • 435
    • 436
    • 437
    • 438
    • 439
    • 440
    • 441
    • 442
    • 443
    • 444
    • 445
    • 446
    • 447
    • 448
    • 449
    • 450
    • 451
    • 452
    • 453
    • 454
    • 455
    • 456
    • 457
    • 458
    • 459
    • 460
    • 461
    • 462
    • 463
    • 464
    • 465
    • 466
    • 467
    • 468
    • 469
    • 470
    • 471
    • 472
    • 473
    • 474
    • 475
    • 476
    • 477
    • 478
    • 479
    • 480
    • 481
    • 482
    • 483
    • 484
    • 485
    • 486
    • 487
    • 488
    • 489
    • 490
    • 491
    • 492
    • 493
    • 494
    • 495
    • 496
    • 497
    • 498
    • 499
    • 500
    • 501
    • 502
    • 503
    • 504
    • 505
    • 506
    • 507
    • 508
    • 509
    • 510
    • 511
    • 512
    • 513
    • 514
    • 515
    • 516
    • 517
    • 518
    • 519
    • 520
    • 521
    • 522
    • 523
    • 524
    • 525
    • 526
    • 527
    • 528
    • 529
    • 530
    • 531
    • 532
    • 533
    • 534
    • 535
    • 536
    • 537
    • 538
    • 539
    • 540
    • 541
    • 542
    • 543
    • 544
    • 545
    • 546
    • 547
    • 548
    • 549
    • 550
    • 551
    • 552
    • 553
    • 554
    • 555
    • 556
    • 557
    • 558
    • 559
    • 560
    • 561
    • 562
    • 563
    • 564
    • 565
    • 566
    • 567
    • 568
    • 569
    • 570
    • 571
    • 572
    • 573
    • 574
    • 575
    • 576
    • 577
    • 578
    • 579
    • 580
    • 581
    • 582
    • 583
    • 584
    • 585
    • 586
    • 587
    • 588
    • 589
    • 590
    • 591
    • 592
    • 593
    • 594
    • 595
    • 596
    • 597
    • 598
    • 599
    • 600
    • 601
    • 602
    • 603
    • 604
    • 605
    • 606
    • 607
    • 608
    • 609
    • 610
    • 611
    • 612
    • 613
    • 614
    • 615
    • 616
    • 617
    • 618
    • 619
    • 620
    • 621
    • 622
    • 623
    • 624
    • 625
    • 626
    • 627
    • 628
    • 629
    • 630
    • 631
    • 632
    • 633
    • 634
    • 635
    • 636
    • 637
    • 638
    • 639
    • 640
    • 641
    • 642
    • 643
    • 644
    • 645
    • 646
    • 647
    • 648
    • 649
    • 650
    • 651
    • 652
    • 653
    • 654
    • 655
    • 656
    • 657
    • 658

    5、安装

    make install
    
    • 1
    onlylove@ubuntu:~/my/busybox/busybox-1.35.0$ make install
      ./_install//bin/arch -> busybox
      ./_install//bin/ash -> busybox
      ./_install//bin/base32 -> busybox
      ./_install//bin/base64 -> busybox
      ./_install//bin/cat -> busybox
      ./_install//bin/chattr -> busybox
      ./_install//bin/chgrp -> busybox
      ./_install//bin/chmod -> busybox
      ./_install//bin/chown -> busybox
      ./_install//bin/conspy -> busybox
      ./_install//bin/cp -> busybox
      ./_install//bin/cpio -> busybox
      ./_install//bin/cttyhack -> busybox
      ./_install//bin/date -> busybox
      ./_install//bin/dd -> busybox
      ./_install//bin/df -> busybox
      ./_install//bin/dmesg -> busybox
      ./_install//bin/dnsdomainname -> busybox
      ./_install//bin/dumpkmap -> busybox
      ./_install//bin/echo -> busybox
      ./_install//bin/ed -> busybox
      ./_install//bin/egrep -> busybox
      ./_install//bin/false -> busybox
      ./_install//bin/fatattr -> busybox
      ./_install//bin/fdflush -> busybox
      ./_install//bin/fgrep -> busybox
      ./_install//bin/fsync -> busybox
      ./_install//bin/getopt -> busybox
      ./_install//bin/grep -> busybox
      ./_install//bin/gunzip -> busybox
      ./_install//bin/gzip -> busybox
      ./_install//bin/hostname -> busybox
      ./_install//bin/hush -> busybox
      ./_install//bin/ionice -> busybox
      ./_install//bin/iostat -> busybox
      ./_install//bin/ipcalc -> busybox
      ./_install//bin/kbd_mode -> busybox
      ./_install//bin/kill -> busybox
      ./_install//bin/link -> busybox
      ./_install//bin/linux32 -> busybox
      ./_install//bin/linux64 -> busybox
      ./_install//bin/ln -> busybox
      ./_install//bin/login -> busybox
      ./_install//bin/ls -> busybox
      ./_install//bin/lsattr -> busybox
      ./_install//bin/lzop -> busybox
      ./_install//bin/makemime -> busybox
      ./_install//bin/mkdir -> busybox
      ./_install//bin/mknod -> busybox
      ./_install//bin/mktemp -> busybox
      ./_install//bin/more -> busybox
      ./_install//bin/mount -> busybox
      ./_install//bin/mountpoint -> busybox
      ./_install//bin/mpstat -> busybox
      ./_install//bin/mt -> busybox
      ./_install//bin/mv -> busybox
      ./_install//bin/netstat -> busybox
      ./_install//bin/nice -> busybox
      ./_install//bin/pidof -> busybox
      ./_install//bin/ping -> busybox
      ./_install//bin/ping6 -> busybox
      ./_install//bin/pipe_progress -> busybox
      ./_install//bin/printenv -> busybox
      ./_install//bin/ps -> busybox
      ./_install//bin/pwd -> busybox
      ./_install//bin/reformime -> busybox
      ./_install//bin/resume -> busybox
      ./_install//bin/rev -> busybox
      ./_install//bin/rm -> busybox
      ./_install//bin/rmdir -> busybox
      ./_install//bin/rpm -> busybox
      ./_install//bin/run-parts -> busybox
      ./_install//bin/scriptreplay -> busybox
      ./_install//bin/sed -> busybox
      ./_install//bin/setarch -> busybox
      ./_install//bin/setpriv -> busybox
      ./_install//bin/setserial -> busybox
      ./_install//bin/sh -> busybox
      ./_install//bin/sleep -> busybox
      ./_install//bin/stat -> busybox
      ./_install//bin/stty -> busybox
      ./_install//bin/su -> busybox
      ./_install//bin/sync -> busybox
      ./_install//bin/tar -> busybox
      ./_install//bin/touch -> busybox
      ./_install//bin/true -> busybox
      ./_install//bin/umount -> busybox
      ./_install//bin/uname -> busybox
      ./_install//bin/usleep -> busybox
      ./_install//bin/vi -> busybox
      ./_install//bin/watch -> busybox
      ./_install//bin/zcat -> busybox
      ./_install//linuxrc -> bin/busybox
      ./_install//sbin/acpid -> ../bin/busybox
      ./_install//sbin/adjtimex -> ../bin/busybox
      ./_install//sbin/arp -> ../bin/busybox
      ./_install//sbin/blkid -> ../bin/busybox
      ./_install//sbin/blockdev -> ../bin/busybox
      ./_install//sbin/bootchartd -> ../bin/busybox
      ./_install//sbin/depmod -> ../bin/busybox
      ./_install//sbin/devmem -> ../bin/busybox
      ./_install//sbin/fbsplash -> ../bin/busybox
      ./_install//sbin/fdisk -> ../bin/busybox
      ./_install//sbin/findfs -> ../bin/busybox
      ./_install//sbin/freeramdisk -> ../bin/busybox
      ./_install//sbin/fsck -> ../bin/busybox
      ./_install//sbin/fsck.minix -> ../bin/busybox
      ./_install//sbin/fstrim -> ../bin/busybox
      ./_install//sbin/getty -> ../bin/busybox
      ./_install//sbin/halt -> ../bin/busybox
      ./_install//sbin/hdparm -> ../bin/busybox
      ./_install//sbin/hwclock -> ../bin/busybox
      ./_install//sbin/ifconfig -> ../bin/busybox
      ./_install//sbin/ifdown -> ../bin/busybox
      ./_install//sbin/ifenslave -> ../bin/busybox
      ./_install//sbin/ifup -> ../bin/busybox
      ./_install//sbin/init -> ../bin/busybox
      ./_install//sbin/insmod -> ../bin/busybox
      ./_install//sbin/ip -> ../bin/busybox
      ./_install//sbin/ipaddr -> ../bin/busybox
      ./_install//sbin/iplink -> ../bin/busybox
      ./_install//sbin/ipneigh -> ../bin/busybox
      ./_install//sbin/iproute -> ../bin/busybox
      ./_install//sbin/iprule -> ../bin/busybox
      ./_install//sbin/iptunnel -> ../bin/busybox
      ./_install//sbin/klogd -> ../bin/busybox
      ./_install//sbin/loadkmap -> ../bin/busybox
      ./_install//sbin/logread -> ../bin/busybox
      ./_install//sbin/losetup -> ../bin/busybox
      ./_install//sbin/lsmod -> ../bin/busybox
      ./_install//sbin/makedevs -> ../bin/busybox
      ./_install//sbin/mdev -> ../bin/busybox
      ./_install//sbin/mkdosfs -> ../bin/busybox
      ./_install//sbin/mke2fs -> ../bin/busybox
      ./_install//sbin/mkfs.ext2 -> ../bin/busybox
      ./_install//sbin/mkfs.minix -> ../bin/busybox
      ./_install//sbin/mkfs.vfat -> ../bin/busybox
      ./_install//sbin/mkswap -> ../bin/busybox
      ./_install//sbin/modinfo -> ../bin/busybox
      ./_install//sbin/modprobe -> ../bin/busybox
      ./_install//sbin/nameif -> ../bin/busybox
      ./_install//sbin/pivot_root -> ../bin/busybox
      ./_install//sbin/poweroff -> ../bin/busybox
      ./_install//sbin/raidautorun -> ../bin/busybox
      ./_install//sbin/reboot -> ../bin/busybox
      ./_install//sbin/rmmod -> ../bin/busybox
      ./_install//sbin/route -> ../bin/busybox
      ./_install//sbin/run-init -> ../bin/busybox
      ./_install//sbin/runlevel -> ../bin/busybox
      ./_install//sbin/setconsole -> ../bin/busybox
      ./_install//sbin/slattach -> ../bin/busybox
      ./_install//sbin/start-stop-daemon -> ../bin/busybox
      ./_install//sbin/sulogin -> ../bin/busybox
      ./_install//sbin/swapoff -> ../bin/busybox
      ./_install//sbin/swapon -> ../bin/busybox
      ./_install//sbin/switch_root -> ../bin/busybox
      ./_install//sbin/sysctl -> ../bin/busybox
      ./_install//sbin/syslogd -> ../bin/busybox
      ./_install//sbin/tc -> ../bin/busybox
      ./_install//sbin/tunctl -> ../bin/busybox
      ./_install//sbin/udhcpc -> ../bin/busybox
      ./_install//sbin/uevent -> ../bin/busybox
      ./_install//sbin/vconfig -> ../bin/busybox
      ./_install//sbin/watchdog -> ../bin/busybox
      ./_install//sbin/zcip -> ../bin/busybox
      ./_install//usr/bin/[ -> ../../bin/busybox
      ./_install//usr/bin/[[ -> ../../bin/busybox
      ./_install//usr/bin/ascii -> ../../bin/busybox
      ./_install//usr/bin/awk -> ../../bin/busybox
      ./_install//usr/bin/basename -> ../../bin/busybox
      ./_install//usr/bin/bc -> ../../bin/busybox
      ./_install//usr/bin/beep -> ../../bin/busybox
      ./_install//usr/bin/blkdiscard -> ../../bin/busybox
      ./_install//usr/bin/bunzip2 -> ../../bin/busybox
      ./_install//usr/bin/bzcat -> ../../bin/busybox
      ./_install//usr/bin/bzip2 -> ../../bin/busybox
      ./_install//usr/bin/cal -> ../../bin/busybox
      ./_install//usr/bin/chpst -> ../../bin/busybox
      ./_install//usr/bin/chrt -> ../../bin/busybox
      ./_install//usr/bin/chvt -> ../../bin/busybox
      ./_install//usr/bin/cksum -> ../../bin/busybox
      ./_install//usr/bin/clear -> ../../bin/busybox
      ./_install//usr/bin/cmp -> ../../bin/busybox
      ./_install//usr/bin/comm -> ../../bin/busybox
      ./_install//usr/bin/crc32 -> ../../bin/busybox
      ./_install//usr/bin/crontab -> ../../bin/busybox
      ./_install//usr/bin/cryptpw -> ../../bin/busybox
      ./_install//usr/bin/cut -> ../../bin/busybox
      ./_install//usr/bin/dc -> ../../bin/busybox
      ./_install//usr/bin/deallocvt -> ../../bin/busybox
      ./_install//usr/bin/diff -> ../../bin/busybox
      ./_install//usr/bin/dirname -> ../../bin/busybox
      ./_install//usr/bin/dos2unix -> ../../bin/busybox
      ./_install//usr/bin/dpkg -> ../../bin/busybox
      ./_install//usr/bin/dpkg-deb -> ../../bin/busybox
      ./_install//usr/bin/du -> ../../bin/busybox
      ./_install//usr/bin/dumpleases -> ../../bin/busybox
      ./_install//usr/bin/eject -> ../../bin/busybox
      ./_install//usr/bin/env -> ../../bin/busybox
      ./_install//usr/bin/envdir -> ../../bin/busybox
      ./_install//usr/bin/envuidgid -> ../../bin/busybox
      ./_install//usr/bin/expand -> ../../bin/busybox
      ./_install//usr/bin/expr -> ../../bin/busybox
      ./_install//usr/bin/factor -> ../../bin/busybox
      ./_install//usr/bin/fallocate -> ../../bin/busybox
      ./_install//usr/bin/fgconsole -> ../../bin/busybox
      ./_install//usr/bin/find -> ../../bin/busybox
      ./_install//usr/bin/flock -> ../../bin/busybox
      ./_install//usr/bin/fold -> ../../bin/busybox
      ./_install//usr/bin/free -> ../../bin/busybox
      ./_install//usr/bin/ftpget -> ../../bin/busybox
      ./_install//usr/bin/ftpput -> ../../bin/busybox
      ./_install//usr/bin/fuser -> ../../bin/busybox
      ./_install//usr/bin/groups -> ../../bin/busybox
      ./_install//usr/bin/hd -> ../../bin/busybox
      ./_install//usr/bin/head -> ../../bin/busybox
      ./_install//usr/bin/hexdump -> ../../bin/busybox
      ./_install//usr/bin/hexedit -> ../../bin/busybox
      ./_install//usr/bin/hostid -> ../../bin/busybox
      ./_install//usr/bin/id -> ../../bin/busybox
      ./_install//usr/bin/install -> ../../bin/busybox
      ./_install//usr/bin/ipcrm -> ../../bin/busybox
      ./_install//usr/bin/ipcs -> ../../bin/busybox
      ./_install//usr/bin/killall -> ../../bin/busybox
      ./_install//usr/bin/last -> ../../bin/busybox
      ./_install//usr/bin/less -> ../../bin/busybox
      ./_install//usr/bin/logger -> ../../bin/busybox
      ./_install//usr/bin/logname -> ../../bin/busybox
      ./_install//usr/bin/lpq -> ../../bin/busybox
      ./_install//usr/bin/lpr -> ../../bin/busybox
      ./_install//usr/bin/lsof -> ../../bin/busybox
      ./_install//usr/bin/lspci -> ../../bin/busybox
      ./_install//usr/bin/lsscsi -> ../../bin/busybox
      ./_install//usr/bin/lsusb -> ../../bin/busybox
      ./_install//usr/bin/lzcat -> ../../bin/busybox
      ./_install//usr/bin/lzma -> ../../bin/busybox
      ./_install//usr/bin/man -> ../../bin/busybox
      ./_install//usr/bin/md5sum -> ../../bin/busybox
      ./_install//usr/bin/mesg -> ../../bin/busybox
      ./_install//usr/bin/microcom -> ../../bin/busybox
      ./_install//usr/bin/mkfifo -> ../../bin/busybox
      ./_install//usr/bin/mkpasswd -> ../../bin/busybox
      ./_install//usr/bin/nc -> ../../bin/busybox
      ./_install//usr/bin/nl -> ../../bin/busybox
      ./_install//usr/bin/nmeter -> ../../bin/busybox
      ./_install//usr/bin/nohup -> ../../bin/busybox
      ./_install//usr/bin/nproc -> ../../bin/busybox
      ./_install//usr/bin/nsenter -> ../../bin/busybox
      ./_install//usr/bin/nslookup -> ../../bin/busybox
      ./_install//usr/bin/od -> ../../bin/busybox
      ./_install//usr/bin/openvt -> ../../bin/busybox
      ./_install//usr/bin/passwd -> ../../bin/busybox
      ./_install//usr/bin/paste -> ../../bin/busybox
      ./_install//usr/bin/patch -> ../../bin/busybox
      ./_install//usr/bin/pgrep -> ../../bin/busybox
      ./_install//usr/bin/pkill -> ../../bin/busybox
      ./_install//usr/bin/pmap -> ../../bin/busybox
      ./_install//usr/bin/printf -> ../../bin/busybox
      ./_install//usr/bin/pscan -> ../../bin/busybox
      ./_install//usr/bin/pstree -> ../../bin/busybox
      ./_install//usr/bin/pwdx -> ../../bin/busybox
      ./_install//usr/bin/readlink -> ../../bin/busybox
      ./_install//usr/bin/realpath -> ../../bin/busybox
      ./_install//usr/bin/renice -> ../../bin/busybox
      ./_install//usr/bin/reset -> ../../bin/busybox
      ./_install//usr/bin/resize -> ../../bin/busybox
      ./_install//usr/bin/rpm2cpio -> ../../bin/busybox
      ./_install//usr/bin/runsv -> ../../bin/busybox
      ./_install//usr/bin/runsvdir -> ../../bin/busybox
      ./_install//usr/bin/rx -> ../../bin/busybox
      ./_install//usr/bin/script -> ../../bin/busybox
      ./_install//usr/bin/seq -> ../../bin/busybox
      ./_install//usr/bin/setfattr -> ../../bin/busybox
      ./_install//usr/bin/setkeycodes -> ../../bin/busybox
      ./_install//usr/bin/setsid -> ../../bin/busybox
      ./_install//usr/bin/setuidgid -> ../../bin/busybox
      ./_install//usr/bin/sha1sum -> ../../bin/busybox
      ./_install//usr/bin/sha256sum -> ../../bin/busybox
      ./_install//usr/bin/sha3sum -> ../../bin/busybox
      ./_install//usr/bin/sha512sum -> ../../bin/busybox
      ./_install//usr/bin/showkey -> ../../bin/busybox
      ./_install//usr/bin/shred -> ../../bin/busybox
      ./_install//usr/bin/shuf -> ../../bin/busybox
      ./_install//usr/bin/smemcap -> ../../bin/busybox
      ./_install//usr/bin/softlimit -> ../../bin/busybox
      ./_install//usr/bin/sort -> ../../bin/busybox
      ./_install//usr/bin/split -> ../../bin/busybox
      ./_install//usr/bin/ssl_client -> ../../bin/busybox
      ./_install//usr/bin/strings -> ../../bin/busybox
      ./_install//usr/bin/sum -> ../../bin/busybox
      ./_install//usr/bin/sv -> ../../bin/busybox
      ./_install//usr/bin/svc -> ../../bin/busybox
      ./_install//usr/bin/svok -> ../../bin/busybox
      ./_install//usr/bin/tac -> ../../bin/busybox
      ./_install//usr/bin/tail -> ../../bin/busybox
      ./_install//usr/bin/taskset -> ../../bin/busybox
      ./_install//usr/bin/tcpsvd -> ../../bin/busybox
      ./_install//usr/bin/tee -> ../../bin/busybox
      ./_install//usr/bin/telnet -> ../../bin/busybox
      ./_install//usr/bin/test -> ../../bin/busybox
      ./_install//usr/bin/tftp -> ../../bin/busybox
      ./_install//usr/bin/time -> ../../bin/busybox
      ./_install//usr/bin/timeout -> ../../bin/busybox
      ./_install//usr/bin/top -> ../../bin/busybox
      ./_install//usr/bin/tr -> ../../bin/busybox
      ./_install//usr/bin/traceroute -> ../../bin/busybox
      ./_install//usr/bin/traceroute6 -> ../../bin/busybox
      ./_install//usr/bin/truncate -> ../../bin/busybox
      ./_install//usr/bin/ts -> ../../bin/busybox
      ./_install//usr/bin/tty -> ../../bin/busybox
      ./_install//usr/bin/ttysize -> ../../bin/busybox
      ./_install//usr/bin/udhcpc6 -> ../../bin/busybox
      ./_install//usr/bin/udpsvd -> ../../bin/busybox
      ./_install//usr/bin/unexpand -> ../../bin/busybox
      ./_install//usr/bin/uniq -> ../../bin/busybox
      ./_install//usr/bin/unix2dos -> ../../bin/busybox
      ./_install//usr/bin/unlink -> ../../bin/busybox
      ./_install//usr/bin/unlzma -> ../../bin/busybox
      ./_install//usr/bin/unshare -> ../../bin/busybox
      ./_install//usr/bin/unxz -> ../../bin/busybox
      ./_install//usr/bin/unzip -> ../../bin/busybox
      ./_install//usr/bin/uptime -> ../../bin/busybox
      ./_install//usr/bin/users -> ../../bin/busybox
      ./_install//usr/bin/uudecode -> ../../bin/busybox
      ./_install//usr/bin/uuencode -> ../../bin/busybox
      ./_install//usr/bin/vlock -> ../../bin/busybox
      ./_install//usr/bin/volname -> ../../bin/busybox
      ./_install//usr/bin/w -> ../../bin/busybox
      ./_install//usr/bin/wall -> ../../bin/busybox
      ./_install//usr/bin/wc -> ../../bin/busybox
      ./_install//usr/bin/wget -> ../../bin/busybox
      ./_install//usr/bin/which -> ../../bin/busybox
      ./_install//usr/bin/who -> ../../bin/busybox
      ./_install//usr/bin/whoami -> ../../bin/busybox
      ./_install//usr/bin/whois -> ../../bin/busybox
      ./_install//usr/bin/xargs -> ../../bin/busybox
      ./_install//usr/bin/xxd -> ../../bin/busybox
      ./_install//usr/bin/xz -> ../../bin/busybox
      ./_install//usr/bin/xzcat -> ../../bin/busybox
      ./_install//usr/bin/yes -> ../../bin/busybox
      ./_install//usr/sbin/add-shell -> ../../bin/busybox
      ./_install//usr/sbin/addgroup -> ../../bin/busybox
      ./_install//usr/sbin/adduser -> ../../bin/busybox
      ./_install//usr/sbin/arping -> ../../bin/busybox
      ./_install//usr/sbin/brctl -> ../../bin/busybox
      ./_install//usr/sbin/chat -> ../../bin/busybox
      ./_install//usr/sbin/chpasswd -> ../../bin/busybox
      ./_install//usr/sbin/chroot -> ../../bin/busybox
      ./_install//usr/sbin/crond -> ../../bin/busybox
      ./_install//usr/sbin/delgroup -> ../../bin/busybox
      ./_install//usr/sbin/deluser -> ../../bin/busybox
      ./_install//usr/sbin/dhcprelay -> ../../bin/busybox
      ./_install//usr/sbin/dnsd -> ../../bin/busybox
      ./_install//usr/sbin/ether-wake -> ../../bin/busybox
      ./_install//usr/sbin/fakeidentd -> ../../bin/busybox
      ./_install//usr/sbin/fbset -> ../../bin/busybox
      ./_install//usr/sbin/fdformat -> ../../bin/busybox
      ./_install//usr/sbin/fsfreeze -> ../../bin/busybox
      ./_install//usr/sbin/ftpd -> ../../bin/busybox
      ./_install//usr/sbin/httpd -> ../../bin/busybox
      ./_install//usr/sbin/i2cdetect -> ../../bin/busybox
      ./_install//usr/sbin/i2cdump -> ../../bin/busybox
      ./_install//usr/sbin/i2cget -> ../../bin/busybox
      ./_install//usr/sbin/i2cset -> ../../bin/busybox
      ./_install//usr/sbin/i2ctransfer -> ../../bin/busybox
      ./_install//usr/sbin/ifplugd -> ../../bin/busybox
      ./_install//usr/sbin/inetd -> ../../bin/busybox
      ./_install//usr/sbin/killall5 -> ../../bin/busybox
      ./_install//usr/sbin/loadfont -> ../../bin/busybox
      ./_install//usr/sbin/lpd -> ../../bin/busybox
      ./_install//usr/sbin/mim -> ../../bin/busybox
      ./_install//usr/sbin/nanddump -> ../../bin/busybox
      ./_install//usr/sbin/nandwrite -> ../../bin/busybox
      ./_install//usr/sbin/nbd-client -> ../../bin/busybox
      ./_install//usr/sbin/nologin -> ../../bin/busybox
      ./_install//usr/sbin/ntpd -> ../../bin/busybox
      ./_install//usr/sbin/partprobe -> ../../bin/busybox
      ./_install//usr/sbin/popmaildir -> ../../bin/busybox
      ./_install//usr/sbin/powertop -> ../../bin/busybox
      ./_install//usr/sbin/rdate -> ../../bin/busybox
      ./_install//usr/sbin/rdev -> ../../bin/busybox
      ./_install//usr/sbin/readahead -> ../../bin/busybox
      ./_install//usr/sbin/readprofile -> ../../bin/busybox
      ./_install//usr/sbin/remove-shell -> ../../bin/busybox
      ./_install//usr/sbin/rtcwake -> ../../bin/busybox
      ./_install//usr/sbin/sendmail -> ../../bin/busybox
      ./_install//usr/sbin/setfont -> ../../bin/busybox
      ./_install//usr/sbin/setlogcons -> ../../bin/busybox
      ./_install//usr/sbin/svlogd -> ../../bin/busybox
      ./_install//usr/sbin/telnetd -> ../../bin/busybox
      ./_install//usr/sbin/tftpd -> ../../bin/busybox
      ./_install//usr/sbin/ubiattach -> ../../bin/busybox
      ./_install//usr/sbin/ubidetach -> ../../bin/busybox
      ./_install//usr/sbin/ubimkvol -> ../../bin/busybox
      ./_install//usr/sbin/ubirename -> ../../bin/busybox
      ./_install//usr/sbin/ubirmvol -> ../../bin/busybox
      ./_install//usr/sbin/ubirsvol -> ../../bin/busybox
      ./_install//usr/sbin/ubiupdatevol -> ../../bin/busybox
      ./_install//usr/sbin/udhcpd -> ../../bin/busybox
    
    
    --------------------------------------------------
    You will probably need to make your busybox binary
    setuid root to ensure all configured applets will
    work properly.
    --------------------------------------------------
    
    onlylove@ubuntu:~/my/busybox/busybox-1.35.0$ 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326
    • 327
    • 328
    • 329
    • 330
    • 331
    • 332
    • 333
    • 334
    • 335
    • 336
    • 337
    • 338
    • 339
    • 340
    • 341
    • 342
    • 343
    • 344
    • 345
    • 346
    • 347
    • 348
    • 349
    • 350
    • 351
    • 352
    • 353
    • 354
    • 355
    • 356
    • 357
    • 358
    • 359
    • 360
    • 361
    • 362
    • 363
    • 364
    • 365
    • 366
    • 367
    • 368
    • 369
    • 370
    • 371
    • 372
    • 373
    • 374
    • 375
    • 376
    • 377
    • 378
    • 379
    • 380
    • 381
    • 382
    • 383
    • 384
    • 385
    • 386
    • 387
    • 388
    • 389
    • 390
    • 391
    • 392
    • 393
    • 394
    • 395
    • 396
    • 397
    • 398
    • 399
    • 400
    • 401
    • 402
    • 403
    • 404
    • 405
    • 406
    • 407
    • 408
    • 409

    6、测试

    onlylove@ubuntu:~/my/busybox/busybox-1.35.0$ ls
    applets                 configs        _install         Makefile.help           runit
    applets_sh              console-tools  INSTALL          make_single_applets.sh  scripts
    arch                    coreutils      klibc-utils      miscutils               selinux
    archival                debianutils    libbb            modutils                shell
    AUTHORS                 docs           libpwdgrp        networking              size_single_applets.sh
    busybox                 e2fsprogs      LICENSE          NOFORK_NOEXEC.lst       sysklogd
    busybox.links           editors        loginutils       NOFORK_NOEXEC.sh        testsuite
    busybox_unstripped      examples       mailutils        printutils              TODO
    busybox_unstripped.map  findutils      Makefile         procps                  TODO_unicode
    busybox_unstripped.out  include        Makefile.custom  qemu_multiarch_testing  util-linux
    Config.in               init           Makefile.flags   README
    onlylove@ubuntu:~/my/busybox/busybox-1.35.0$ ls -l _install/
    total 12
    drwxrwxr-x 2 onlylove onlylove 4096 Jun 25 21:39 bin
    lrwxrwxrwx 1 onlylove onlylove   11 Jun 25 21:39 linuxrc -> bin/busybox
    drwxrwxr-x 2 onlylove onlylove 4096 Jun 25 21:39 sbin
    drwxrwxr-x 4 onlylove onlylove 4096 Jun 25 21:39 usr
    onlylove@ubuntu:~/my/busybox/busybox-1.35.0$
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19

    7、异常处理

    异常:

    <command-line>: fatal error: curses.h: No such file or directory
    
    • 1

    解决方案:

    sudo apt-get install libncurses5-dev libncursesw5-dev
    
    • 1

    2、制作根文件系统

    1、创建根目录

    mkdir rootfs
    
    • 1

    2、拷贝busybox编译出的库文件

    cp -r ……/busybox/_install/* ……/rootfs/
    
    • 1

    3、添加设备

    1、、创建 dev 文件夹

    mkdir dev
    
    • 1

    2、创建4个串口设备

    sudo mknod -m 666 tty1 c 4 1
    sudo mknod -m 666 tty2 c 4 2
    sudo mknod -m 666 tty3 c 4 3
    sudo mknod -m 666 tty4 c 4 4
    
    • 1
    • 2
    • 3
    • 4

    3、创建控制台

    sudo mknod -m 666 console c 5 1
    
    • 1

    4、创建null

    sudo mknod -m 666 null c 1 3
    
    • 1

    4、添加动态库

    1、创建 lib 文件夹

    mkdir lib
    
    • 1

    2、将交叉编译链arm-linux-gnueabihe/libc/lib下的所有so和.a文件拷贝到刚才创建的lib文件下

    cp *so* *.a ……/rootfs/lib -d
    
    • 1

    3、将刚拷贝过来放在lib目录下的ld-linux-armhf.so.3的软链接改为源文件,首先删除文件

    rm ld-linux-armhf.so.3
    
    • 1

    4、然后重新在交叉编译链arm-linux-gnueabihe/libc/lib下将文件拷贝过来

    cp ld-linux-armhf.so.3 ……/rootfs/lib
    
    • 1

    5、将交叉编译链arm-linux-gnueabihe/lib下的所有so和.a文件拷贝到刚才创建的lib文件下

    cp *so* *.a ……/rootfs/lib -d
    
    • 1

    6、在生成的根文件目录下创建usr/lib文件夹

    mkdir usr/lib
    cd usr/lib
    
    • 1
    • 2

    7、将交叉编译链arm-linux-gnueabihe/libc/usr/lib下的所有so和.a文件拷贝到刚才创建的lib文件下

    cp *so* *.a ……/rootfs/usr/lib -d
    
    • 1

    8、通过du命令查看刚才拷贝文件的大小

    du ./lib ./usr/lib
    
    • 1

    5、创建其他文件夹

    mkdir proc mnt sys tmp root etc
    
    • 1

    6、创建 rcS 文件

    1、目录:/etc/init.d/rcS

    #! /bin/sh
    
    PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:$PATH
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:/usr/lib
    export PATH LD_LIBRARY_PATH
    
    mount -a
    mkdir /dev/pts
    mount -t devpts devpts /dev/pts
    
    echo /sbin/mdev > /proc/sys/kernel/hotplug
     
    mdev -s
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    2、更改权限

    chmod 777 rcS
    
    • 1

    7、fstab文件创建

    /etc路径下创建fstab文件

    # <file system>        <dir>         <type>    <options>             <dump> <pass>
    proc                   /proc         proc      defaults              0      0
    tmpfs                  /tmp          tmpfs     defaults              0      0
    sysfs                  /sys          sysfs     defaults              0      0
    
    • 1
    • 2
    • 3
    • 4

    8、inittab文件创建

    /etc路径下创建inittab文件

    #etc/inittab
    ::sysinit:/etc/init.d/rcS
    console::askfirst:-/bin/sh
    ::restart:/sbin/init
    ::ctrlaltdel:/sbin/reboot
    ::shutdown:/bin/umount -a -r
    ::shutdown:/sbin/swapoff -a
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    六、uboot启动Linux内核测试

    1、制作SD卡镜像

    1、生成一个空的SD卡镜像

    dd if=/dev/zero of=uboot.disk bs=1M count=1024
    
    • 1

    2、创建GPT分区,下面创建了两个分区,一个用来存放kernel和设备树,另一个存放根文件系统

    sgdisk -n 0:0:+10M -c 0:kernel uboot.disk
    sgdisk -n 0:0:0 -c 0:rootfs uboot.disk
    
    • 1
    • 2

    3、查看分区

    sgdisk -p uboot.disk
    
    • 1

    4、寻找一个空闲的loop设备

    sudo losetup -f
    
    • 1

    5、将SD卡镜像映射到loop设备上

    sudo losetup /dev/loop15 uboot.disk
    sudo partprobe /dev/loop15
    
    • 1
    • 2

    特别说明:loop15为空闲loop设备,实际操作中loop设备可能不同。

    6、格式化

    sudo mkfs.ext4 /dev/loop15p1
    sudo mkfs.ext4 /dev/loop15p2
    
    • 1
    • 2

    7、挂载

    sudo mount -t ext4 /dev/loop15p1 /mnt/p1/
    sudo mount -t ext4 /dev/loop15p2 /mnt/p2/
    
    • 1
    • 2

    特别说明:/mnt/p1/ 和 /mnt/p2/ 目录需要提前创建。

    8、拷贝文件

    sudo cp zImage /mnt/p1/
    sudo cp vexpress-v2p-ca9.dtb /mnt/p1/
    sudo cp -raf rootfs/* /mnt/p2/
    
    • 1
    • 2
    • 3

    9、卸载

    sudo umount /mnt/p1
    sudo umount /mnt/p2
    
    • 1
    • 2

    10、测试

    onlylove@ubuntu:~/my/kernel/rootfs$ pwd
    /home/onlylove/my/kernel/rootfs
    onlylove@ubuntu:~/my/kernel/rootfs$ ls
    rootfs  rootfs-l  rootfs-l.tar.gz  tmpfs
    onlylove@ubuntu:~/my/kernel/rootfs$ dd if=/dev/zero of=uboot.disk bs=1M count=1024
    1024+0 records in
    1024+0 records out
    1073741824 bytes (1.1 GB, 1.0 GiB) copied, 1.47417 s, 728 MB/s
    onlylove@ubuntu:~/my/kernel/rootfs$ ls
    rootfs  rootfs-l  rootfs-l.tar.gz  tmpfs  uboot.disk
    onlylove@ubuntu:~/my/kernel/rootfs$ sgdisk -n 0:0:+10M -c 0:kernel uboot.disk
    Creating new GPT entries in memory.
    Setting name!
    partNum is 0
    Warning: The kernel is still using the old partition table.
    The new table will be used at the next reboot or after you
    run partprobe(8) or kpartx(8)
    The operation has completed successfully.
    onlylove@ubuntu:~/my/kernel/rootfs$ sgdisk -n 0:0:0 -c 0:rootfs uboot.disk
    Setting name!
    partNum is 1
    Warning: The kernel is still using the old partition table.
    The new table will be used at the next reboot or after you
    run partprobe(8) or kpartx(8)
    The operation has completed successfully.
    onlylove@ubuntu:~/my/kernel/rootfs$ sgdisk -p uboot.disk
    Disk uboot.disk: 2097152 sectors, 1024.0 MiB
    Sector size (logical): 512 bytes
    Disk identifier (GUID): F120DC25-FE69-4C3F-8CDF-23336FF28ACC
    Partition table holds up to 128 entries
    Main partition table begins at sector 2 and ends at sector 33
    First usable sector is 34, last usable sector is 2097118
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 2014 sectors (1007.0 KiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1            2048           22527   10.0 MiB    8300  kernel
       2           22528         2097118   1013.0 MiB  8300  rootfs
    onlylove@ubuntu:~/my/kernel/rootfs$ sudo losetup -f
    [sudo] password for onlylove: 
    /dev/loop15
    onlylove@ubuntu:~/my/kernel/rootfs$ sudo losetup /dev/loop15 uboot.disk
    onlylove@ubuntu:~/my/kernel/rootfs$ sudo partprobe /dev/loop15
    onlylove@ubuntu:~/my/kernel/rootfs$ sudo mkfs.ext4 /dev/loop15p1
    mke2fs 1.45.5 (07-Jan-2020)
    Creating filesystem with 2560 4k blocks and 2560 inodes
    
    Allocating group tables: done                            
    Writing inode tables: done                            
    Creating journal (1024 blocks): done
    Writing superblocks and filesystem accounting information: done
    
    onlylove@ubuntu:~/my/kernel/rootfs$ sudo mkfs.ext4 /dev/loop15p2
    mke2fs 1.45.5 (07-Jan-2020)
    Discarding device blocks: done                            
    Creating filesystem with 259323 4k blocks and 64896 inodes
    Filesystem UUID: aa020fbf-657b-40d6-b6ec-c48a3b857d10
    Superblock backups stored on blocks: 
    	32768, 98304, 163840, 229376
    
    Allocating group tables: done                            
    Writing inode tables: done                            
    Creating journal (4096 blocks): done
    Writing superblocks and filesystem accounting information: done
    
    onlylove@ubuntu:~/my/kernel/rootfs$ sudo mount -t ext4 /dev/loop15p1 /mnt/p1/
    onlylove@ubuntu:~/my/kernel/rootfs$ sudo mount -t ext4 /dev/loop15p2 /mnt/p2/
    onlylove@ubuntu:~/my/kernel/rootfs$ sudo cp ~/my/qemu-lq/zImage /mnt/p1/
    onlylove@ubuntu:~/my/kernel/rootfs$ sudo cp ~/my/qemu-lq/vexpress-v2p-ca9.dtb /mnt/p1/
    onlylove@ubuntu:~/my/kernel/rootfs$ sudo cp -raf rootfs/* /mnt/p2/
    onlylove@ubuntu:~/my/kernel/rootfs$ 
    onlylove@ubuntu:~/my/kernel/rootfs$ ls /mnt/p1/
    lost+found  vexpress-v2p-ca9.dtb  zImage
    onlylove@ubuntu:~/my/kernel/rootfs$ ls /mnt/p2/
    bin  dev  etc  lib  linuxrc  lost+found  mnt  proc  root  sbin  sys  tmp  usr
    onlylove@ubuntu:~/my/kernel/rootfs$ sudo umount /mnt/p1
    onlylove@ubuntu:~/my/kernel/rootfs$ sudo umount /mnt/p2
    onlylove@ubuntu:~/my/kernel/rootfs$ ls
    rootfs  rootfs-l  rootfs-l.tar.gz  tmpfs  uboot.disk
    onlylove@ubuntu:~/my/kernel/rootfs$ ls -l
    total 223764
    drwxrwxr-x 13 onlylove onlylove       4096 Jun 25 22:12 rootfs
    drwxrwxr-x 13 onlylove onlylove       4096 Jan 18 21:35 rootfs-l
    -rw-rw-r--  1 onlylove onlylove   41630588 Jun 25 16:03 rootfs-l.tar.gz
    drwxr-xr-x  2 root     root           4096 Jun 26 07:12 tmpfs
    -rw-rw-r--  1 onlylove onlylove 1073741824 Jun 26 09:13 uboot.disk
    onlylove@ubuntu:~/my/kernel/rootfs$ 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87

    2、启动uboot

    1、启动命令

    ./qemu-system-arm -M vexpress-a9 -m 256 -kernel u-boot -nographic -sd uboot.disk
    
    • 1

    2、启动log

    onlylove@ubuntu:~/my/qemu-lq$ pwd
    /home/onlylove/my/qemu-lq
    onlylove@ubuntu:~/my/qemu-lq$ ls
    qemu-system-arm  u-boot  uboot.disk  vexpress-v2p-ca9.dtb  zImage
    onlylove@ubuntu:~/my/qemu-lq$ ./qemu-system-arm -M vexpress-a9 -m 256 -kernel u-boot -nographic -sd uboot.disk
    WARNING: Image format was not specified for 'uboot.disk' and probing guessed raw.
             Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
             Specify the 'raw' format explicitly to remove the restrictions.
    
    
    U-Boot 2018.03 (Jun 25 2022 - 17:53:48 +0800)
    
    DRAM:  256 MiB
    WARNING: Caches not enabled
    Flash: 128 MiB
    MMC:   MMC: 0
    *** Warning - bad CRC, using default environment
    
    In:    serial
    Out:   serial
    Err:   serial
    Net:   smc911x-0
    Hit any key to stop autoboot:  0 
    => 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24

    3、查看SD卡状态

    => mmc dev 0
    switch to partitions #0, OK
    mmc0 is current device
    => mmc info
    Device: MMC
    Manufacturer ID: aa
    OEM: 5859
    Name: QEMU! 
    Bus Speed: 6250000
    Mode : SD Legacy
    Rd Block Len: 512
    SD version 2.0
    High Capacity: No
    Capacity: 1 GiB
    Bus Width: 1-bit
    Erase Group Size: 512 Bytes
    =>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    4、查看SD卡分区状态

    => part list mmc 0
    
    Partition Map for MMC device 0  --   Partition Type: EFI
    
    Part	Start LBA	End LBA		Name
    	Attributes
    	Type GUID
    	Partition GUID
      1	0x00000800	0x000057ff	"kernel"
    	attrs:	0x0000000000000000
    	type:	0fc63daf-8483-4772-8e79-3d69d8477de4
    	guid:	8b98743a-31e7-4f8f-be22-f6d767d3462b
      2	0x00005800	0x001fffde	"rootfs"
    	attrs:	0x0000000000000000
    	type:	0fc63daf-8483-4772-8e79-3d69d8477de4
    	guid:	a0008d90-dbc6-4089-82d1-c80c3b6e7141
    => ls mmc 0:1
    <DIR>       4096 .
    <DIR>       4096 ..
    <DIR>      16384 lost+found
             3956152 zImage
               14318 vexpress-v2p-ca9.dtb
    => ls mmc 0:2
    <DIR>       4096 .
    <DIR>       4096 ..
    <DIR>      16384 lost+found
    <DIR>       4096 bin
    <DIR>       4096 dev
    <DIR>       4096 etc
    <DIR>       4096 lib
    <SYM>         11 linuxrc
    <DIR>       4096 mnt
    <DIR>       4096 proc
    <DIR>       4096 root
    <DIR>       4096 sbin
    <DIR>       4096 sys
    <DIR>       4096 tmp
    <DIR>       4096 usr
    => 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39

    3、加载kernel、设备树

    => load mmc 0:1 0x60008000 zImage
    3956152 bytes read in 4930 ms (783.2 KiB/s)
    => load mmc 0:1 0x61000000 vexpress-v2p-ca9.dtb
    14318 bytes read in 31 ms (450.2 KiB/s)
    =>
    
    • 1
    • 2
    • 3
    • 4
    • 5

    4、设置bootargs

    setenv bootargs 'root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait earlycon console=ttyAMA0 init=/linuxrc ignore_loglevel'
    
    • 1

    5、引导内核

    bootz 0x60008000 - 0x61000000
    
    • 1

    6、启动信息

    => bootz 0x60008000 - 0x61000000
    Kernel image @ 0x60008000 [ 0x000000 - 0x3c5db8 ]
    ## Flattened Device Tree blob at 61000000
       Booting using the fdt blob at 0x61000000
       Loading Device Tree to 6feef000, end 6fef57ed ... OK
    
    Starting kernel ...
    
    Booting Linux on physical CPU 0x0
    Linux version 4.15.0 (onlylove@ubuntu) (gcc version 6.5.0 (Linaro GCC 6.5-2018.12)) #1 SMP Sat Jun 25 19:45:44 CST 2022
    CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d
    CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
    OF: fdt: Machine model: V2P-CA9
    Malformed early option 'earlycon'
    debug: ignoring loglevel setting.
    Memory policy: Data cache writeback
    On node 0 totalpages: 65536
      Normal zone: 512 pages used for memmap
      Normal zone: 0 pages reserved
      Normal zone: 65536 pages, LIFO batch:15
    CPU: All CPU(s) started in SVC mode.
    random: fast init done
    percpu: Embedded 16 pages/cpu @(ptrval) s36044 r8192 d21300 u65536
    pcpu-alloc: s36044 r8192 d21300 u65536 alloc=16*4096
    pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
    Built 1 zonelists, mobility grouping on.  Total pages: 65024
    Kernel command line: root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait earlycon console=ttyAMA0 init=/linuxrc ignore_loglevel
    log_buf_len individual max cpu contribution: 4096 bytes
    log_buf_len total cpu_extra contributions: 12288 bytes
    log_buf_len min size: 16384 bytes
    log_buf_len: 32768 bytes
    early log buf free: 14904(90%)
    Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
    Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
    Memory: 249752K/262144K available (6144K kernel code, 387K rwdata, 1364K rodata, 1024K init, 165K bss, 12392K reserved, 0K cma-reserved)
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
        vmalloc : 0x90800000 - 0xff800000   (1776 MB)
        lowmem  : 0x80000000 - 0x90000000   ( 256 MB)
        modules : 0x7f000000 - 0x80000000   (  16 MB)
          .text : 0x(ptrval) - 0x(ptrval)   (7136 kB)
          .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
          .data : 0x(ptrval) - 0x(ptrval)   ( 388 kB)
           .bss : 0x(ptrval) - 0x(ptrval)   ( 166 kB)
    SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
    Hierarchical RCU implementation.
    	RCU event tracing is enabled.
    	RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
    RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
    NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
    GIC CPU mask not found - kernel will fail to boot.
    GIC CPU mask not found - kernel will fail to boot.
    L2C: platform modifies aux control register: 0x02020000 -> 0x02420000
    L2C: DT/platform modifies aux control register: 0x02020000 -> 0x02420000
    L2C-310 enabling early BRESP for Cortex-A9
    L2C-310 full line of zeros enabled for Cortex-A9
    L2C-310 dynamic clock gating disabled, standby mode disabled
    L2C-310 cache controller enabled, 8 ways, 128 kB
    L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x46420001
    smp_twd: clock not found -2
    sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
    clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
    Failed to initialize '/smb@4000000/motherboard/iofpga@7,00000000/timer@12000': -22
    Console: colour dummy device 80x30
    Calibrating local timer... 91.66MHz.
    Calibrating delay loop... 1502.41 BogoMIPS (lpj=7512064)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    CPU: Testing write buffer coherency: ok
    CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
    Setting up static identity map for 0x60100000 - 0x60100060
    Hierarchical SRCU implementation.
    smp: Bringing up secondary CPUs ...
    smp: Brought up 1 node, 1 CPU
    SMP: Total of 1 processors activated (1502.41 BogoMIPS).
    CPU: All CPU(s) started in SVC mode.
    devtmpfs: initialized
    VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 0
    clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    futex hash table entries: 1024 (order: 4, 65536 bytes)
    NET: Registered protocol family 16
    DMA: preallocated 256 KiB pool for atomic coherent allocations
    cpuidle: using governor ladder
    hw-breakpoint: debug architecture 0x4 unsupported.
    Serial: AMBA PL011 UART driver
    OF: amba_device_add() failed (-19) for /memory-controller@100e0000
    OF: amba_device_add() failed (-19) for /memory-controller@100e1000
    OF: amba_device_add() failed (-19) for /watchdog@100e5000
    10009000.uart: ttyAMA0 at MMIO 0x10009000 (irq = 35, base_baud = 0) is a PL011 rev1
    console [ttyAMA0] enabled
    1000a000.uart: ttyAMA1 at MMIO 0x1000a000 (irq = 36, base_baud = 0) is a PL011 rev1
    1000b000.uart: ttyAMA2 at MMIO 0x1000b000 (irq = 37, base_baud = 0) is a PL011 rev1
    1000c000.uart: ttyAMA3 at MMIO 0x1000c000 (irq = 38, base_baud = 0) is a PL011 rev1
    OF: amba_device_add() failed (-19) for /smb@4000000/motherboard/iofpga@7,00000000/wdt@f000
    SCSI subsystem initialized
    libata version 3.00 loaded.
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    Advanced Linux Sound Architecture Driver Initialized.
    clocksource: Switched to clocksource arm,sp804
    NET: Registered protocol family 2
    TCP established hash table entries: 2048 (order: 1, 8192 bytes)
    TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
    TCP: Hash tables configured (established 2048 bind 2048)
    UDP hash table entries: 256 (order: 1, 8192 bytes)
    UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
    NET: Registered protocol family 1
    RPC: Registered named UNIX socket transport module.
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    hw perfevents: enabled with armv7_cortex_a9 PMU driver, 5 counters available
    workingset: timestamp_bits=30 max_order=16 bucket_order=0
    squashfs: version 4.0 (2009/01/31) Phillip Lougher
    jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
    9p: Installing v9fs 9p2000 file system support
    io scheduler noop registered (default)
    io scheduler mq-deadline registered
    io scheduler kyber registered
    clcd-pl11x 10020000.clcd: PL111 designer 41 rev2 at 0x10020000
    clcd-pl11x 10020000.clcd: clcd@10020000 hardware, 1024x768@59 display
    Console: switching to colour frame buffer device 128x48
    clcd-pl11x 1001f000.clcd: PL111 designer 41 rev2 at 0x1001f000
    clcd-pl11x 1001f000.clcd: clcd@1f000 hardware, 640x480@59 display
    40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
    Intel/Sharp Extended Query Table at 0x0031
    Using buffer write method
    erase region 0: offset=0x0,size=0x40000,blocks=256
    40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
    Intel/Sharp Extended Query Table at 0x0031
    Using buffer write method
    erase region 0: offset=0x0,size=0x40000,blocks=256
    Concatenating MTD devices:
    (0): "40000000.flash"
    (1): "40000000.flash"
    into device "40000000.flash"
    libphy: Fixed MDIO Bus: probed
    libphy: smsc911x-mdio: probed
    smsc911x 4e000000.ethernet eth0: MAC Address: 52:54:00:12:34:56
    isp1760 4f000000.usb: bus width: 32, oc: digital
    isp1760 4f000000.usb: NXP ISP1760 USB Host Controller
    isp1760 4f000000.usb: new USB bus registered, assigned bus number 1
    isp1760 4f000000.usb: Scratch test failed.
    isp1760 4f000000.usb: can't setup: -19
    isp1760 4f000000.usb: USB bus 1 deregistered
    usbcore: registered new interface driver usb-storage
    rtc-pl031 10017000.rtc: rtc core: registered pl031 as rtc0
    mmci-pl18x 10005000.mmci: Got CD GPIO
    mmci-pl18x 10005000.mmci: Got WP GPIO
    mmci-pl18x 10005000.mmci: mmc0: PL181 manf 41 rev0 at 0x10005000 irq 31,32 (pio)
    mmc0: new SD card at address 4567
    ledtrig-cpu: registered to indicate activity on CPUs
    usbcore: registered new interface driver usbhid
    usbhid: USB HID core driver
    input: AT Raw Set 2 keyboard as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:iofpga@7,00000000/10006000.kmi/serio0/input/input0
    mmcblk0: mmc0:4567 QEMU! 1.00 GiB 
    aaci-pl041 10004000.aaci: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 30
    aaci-pl041 10004000.aaci: FIFO 512 entries
    oprofile: using arm/armv7-ca9
    NET: Registered protocol family 17
    9pnet: Installing 9P2000 support
    Registering SWP/SWPB emulation handler
    rtc-pl031 10017000.rtc: setting system clock to 2022-06-26 01:22:50 UTC (1656206570)
    ALSA device list:
      #0: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 30
     mmcblk0: p1 p2
    input: ImExPS/2 Generic Explorer Mouse as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:iofpga@7,00000000/10007000.kmi/serio1/input/input2
    EXT4-fs (mmcblk0p2): Filesystem with huge files cannot be mounted RDWR without CONFIG_LBDAF
    EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
    VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
    Freeing unused kernel memory: 1024K
    random: crng init done
    mkdir: can't create directory '/dev/pts': Read-only file system
    mount: mounting devpts on /dev/pts failed: No such file or directory
    mdev: can't create 'network_latency': Read-only file system
    mdev: can't create 'tty22': Read-only file system
    mdev: can't create 'tty50': Read-only file system
    mdev: can't create 'tty12': Read-only file system
    mdev: can't create 'tty40': Read-only file system
    mdev: can't create 'ptyp5': Read-only file system
    mdev: can't create 'ptypf': Read-only file system
    mdev: can't create 'tty30': Read-only file system
    mdev: can't create 'tty59': Read-only file system
    mdev: can't create directory 'snd': Read-only file system
    mdev: can't create 'snd/pcmC0D0p': No such file or directory
    mdev: can't create 'memory_bandwidth': Read-only file system
    mdev: can't create 'tty20': Read-only file system
    mdev: can't create 'tty49': Read-only file system
    mdev: can't create 'ttyp8': Read-only file system
    mdev: can't create 'mtd1': Read-only file system
    mdev: can't create 'tty10': Read-only file system
    mdev: can't create 'tty39': Read-only file system
    mdev: can't create directory 'snd': Read-only file system
    mdev: can't create 'snd/pcmC0D0c': No such file or directory
    mdev: can't create 'vcsa1': Read-only file system
    mdev: can't create 'ptyp3': Read-only file system
    mdev: can't create 'ptypd': Read-only file system
    mdev: can't create 'tty29': Read-only file system
    mdev: can't create 'urandom': Read-only file system
    mdev: can't create 'tty57': Read-only file system
    mdev: can't create 'ubi_ctrl': Read-only file system
    mdev: can't create 'tty19': Read-only file system
    mdev: can't create 'tty0': Read-only file system
    mdev: can't create 'tty47': Read-only file system
    mdev: can't create 'ttyp6': Read-only file system
    mdev: can't create 'mtd0': Read-only file system
    mdev: can't create 'ttyAMA2': Read-only file system
    mdev: can't create 'tty37': Read-only file system
    mdev: can't create 'ptyp1': Read-only file system
    mdev: can't create 'ptypb': Read-only file system
    mdev: can't create 'tty27': Read-only file system
    mdev: can't create 'tty9': Read-only file system
    mdev: can't create 'gpiochip2': Read-only file system
    mdev: can't create 'full': Read-only file system
    mdev: can't create 'ttype': Read-only file system
    mdev: can't create 'tty55': Read-only file system
    mdev: can't create 'vcs': Read-only file system
    mdev: can't create 'tty17': Read-only file system
    mdev: can't create 'tty45': Read-only file system
    mdev: can't create 'ttyp4': Read-only file system
    mdev: can't create 'fb1': Read-only file system
    mdev: can't create 'ttyAMA0': Read-only file system
    mdev: can't create 'tty35': Read-only file system
    mdev: can't create directory 'input': Read-only file system
    mdev: can't create 'input/event1': No such file or directory
    mdev: can't create 'tty63': Read-only file system
    mdev: can't create 'tty25': Read-only file system
    mdev: can't create 'tty7': Read-only file system
    mdev: can't create 'gpiochip0': Read-only file system
    mdev: can't create 'zero': Read-only file system
    mdev: can't create 'ttypc': Read-only file system
    mdev: can't create 'tty53': Read-only file system
    mdev: can't create 'tty15': Read-only file system
    mdev: can't create 'tty43': Read-only file system
    mdev: can't create 'ttyp2': Read-only file system
    mdev: can't create 'ptyp8': Read-only file system
    mdev: can't create 'tty33': Read-only file system
    mdev: can't create 'tty61': Read-only file system
    mdev: can't create 'cpu_dma_latency': Read-only file system
    mdev: can't create 'tty23': Read-only file system
    mdev: can't create 'tty5': Read-only file system
    mdev: can't create 'ttypa': Read-only file system
    mdev: can't create 'tty51': Read-only file system
    mdev: can't create 'tty13': Read-only file system
    mdev: can't create 'tty41': Read-only file system
    mdev: can't create 'ttyp0': Read-only file system
    mdev: can't create 'ptyp6': Read-only file system
    mdev: can't create 'tty31': Read-only file system
    mdev: can't create 'network_throughput': Read-only file system
    mdev: can't create 'tty21': Read-only file system
    mdev: can't create 'mem': Read-only file system
    mdev: can't create 'ttyp9': Read-only file system
    mdev: can't create 'mtd1ro': Read-only file system
    mdev: can't create 'tty11': Read-only file system
    mdev: can't create 'kmsg': Read-only file system
    mdev: can't create 'ptyp4': Read-only file system
    mdev: can't create 'ptype': Read-only file system
    mdev: can't create 'tty58': Read-only file system
    mdev: can't create 'hwrng': Read-only file system
    mdev: can't create 'tty48': Read-only file system
    mdev: can't create 'ttyp7': Read-only file system
    mdev: can't create 'mtd0ro': Read-only file system
    mdev: can't create 'rtc0': Read-only file system
    mdev: can't create 'ttyAMA3': Read-only file system
    mdev: can't create directory 'snd': Read-only file system
    mdev: can't create 'snd/timer': No such file or directory
    mdev: can't create 'tty38': Read-only file system
    mdev: can't create 'vcsa': Read-only file system
    mdev: can't create 'ptyp2': Read-only file system
    mdev: can't create 'ptypc': Read-only file system
    mdev: can't create 'tty28': Read-only file system
    mdev: can't create 'gpiochip3': Read-only file system
    mdev: can't create 'random': Read-only file system
    mdev: can't create 'ttypf': Read-only file system
    mdev: can't create 'tty56': Read-only file system
    mdev: can't create 'vcs1': Read-only file system
    mdev: can't create 'tty18': Read-only file system
    mdev: can't create 'tty46': Read-only file system
    mdev: can't create 'ttyp5': Read-only file system
    mdev: can't create 'ttyAMA1': Read-only file system
    mdev: can't create 'tty36': Read-only file system
    mdev: can't create 'ptmx': Read-only file system
    mdev: can't create 'ptyp0': Read-only file system
    mdev: can't create 'ptypa': Read-only file system
    mdev: can't create 'tty26': Read-only file system
    mdev: can't create 'tty8': Read-only file system
    mdev: can't create 'gpiochip1': Read-only file system
    mdev: can't create 'ttypd': Read-only file system
    mdev: can't create 'tty54': Read-only file system
    mdev: can't create 'tty16': Read-only file system
    mdev: can't create 'tty44': Read-only file system
    mdev: can't create directory 'snd': Read-only file system
    mdev: can't create 'snd/controlC0': No such file or directory
    mdev: can't create 'ttyp3': Read-only file system
    mdev: can't create 'fb0': Read-only file system
    mdev: can't create 'ptyp9': Read-only file system
    mdev: can't create 'tty34': Read-only file system
    mdev: can't create directory 'input': Read-only file system
    mdev: can't create 'input/event0': No such file or directory
    mdev: can't create 'tty62': Read-only file system
    mdev: can't create 'tty': Read-only file system
    mdev: can't create 'tty24': Read-only file system
    mdev: can't create 'tty6': Read-only file system
    mdev: can't create 'ttypb': Read-only file system
    mdev: can't create 'tty52': Read-only file system
    mdev: can't create 'tty14': Read-only file system
    mdev: can't create 'tty42': Read-only file system
    mdev: can't create 'ttyp1': Read-only file system
    mdev: can't create 'ptyp7': Read-only file system
    mdev: can't create 'usbmon0': Read-only file system
    mdev: can't create 'tty32': Read-only file system
    mdev: can't create 'tty60': Read-only file system
    mdev: can't create 'mmcblk0p1': Read-only file system
    mdev: can't create 'mtdblock1': Read-only file system
    mdev: can't create 'mmcblk0p2': Read-only file system
    mdev: can't create 'mmcblk0': Read-only file system
    mdev: can't create 'mtdblock0': Read-only file system
    
    Please press Enter to activate this console. 
    / # ls
    bin         lib         mnt         sbin        usr
    dev         linuxrc     proc        sys
    etc         lost+found  root        tmp
    / # 
    / # 
    / # 
    / # 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326
    • 327
    • 328
    • 329
    • 330

    七、只启动Linux内核

    1、生成虚拟SD卡系统镜像

    1、生成镜像

    dd if=/dev/zero of=rootfs.ext4 bs=1M count=1024
    
    • 1

    2、格式化镜像

    mkfs.ext4 rootfs.ext4
    
    • 1

    3、挂载镜像到本地

    sudo mount -t ext4 rootfs.ext4 /mnt -o loop
    
    • 1

    4、拷贝rootfs文件

    sudo cp -raf rootfs/* /mnt/
    
    • 1

    5、卸载

    sudo umount /mnt/
    
    • 1

    6、测试

    onlylove@ubuntu:~/my/kernel/rootfs$ pwd
    /home/onlylove/my/kernel/rootfs
    onlylove@ubuntu:~/my/kernel/rootfs$ ls
    rootfs  rootfs-l  rootfs-l.tar.gz  tmpfs
    onlylove@ubuntu:~/my/kernel/rootfs$ dd if=/dev/zero of=rootfs.ext4 bs=1M count=1024
    1024+0 records in
    1024+0 records out
    1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.654694 s, 1.6 GB/s
    onlylove@ubuntu:~/my/kernel/rootfs$ mkfs.ext4 rootfs.ext4
    mke2fs 1.45.5 (07-Jan-2020)
    Discarding device blocks: done                            
    Creating filesystem with 262144 4k blocks and 65536 inodes
    Filesystem UUID: 00ced43b-b7d8-4d04-8019-f118d7c6f87c
    Superblock backups stored on blocks: 
    	32768, 98304, 163840, 229376
    
    Allocating group tables: done                            
    Writing inode tables: done                            
    Creating journal (8192 blocks): done
    Writing superblocks and filesystem accounting information: done
    
    onlylove@ubuntu:~/my/kernel/rootfs$ sudo mount -t ext4 rootfs.ext4 /mnt -o loop
    [sudo] password for onlylove: 
    onlylove@ubuntu:~/my/kernel/rootfs$ sudo cp -raf rootfs/* /mnt/
    onlylove@ubuntu:~/my/kernel/rootfs$ sudo umount /mnt/
    onlylove@ubuntu:~/my/kernel/rootfs$ 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26

    2、启动linux内核

    1、启动命令

    ./qemu-system-arm -M vexpress-a9 -m 1024M -kernel zImage -append "root=/dev/mmcblk0 console=ttyAMA0 loglevel=8" -dtb vexpress-v2p-ca9.dtb -nographic -sd rootfs.ext4
    
    • 1

    特别注意:根文件系统挂载参数(root=/dev/mmcblk0)。

    2、启动日志

    onlylove@ubuntu:~/my/qemu-lq$ pwd
    /home/onlylove/my/qemu-lq
    onlylove@ubuntu:~/my/qemu-lq$ ls
    qemu-system-arm  rootfs.ext4  u-boot  uboot.disk  vexpress-v2p-ca9.dtb  zImage
    onlylove@ubuntu:~/my/qemu-lq$ 
    onlylove@ubuntu:~/my/qemu-lq$ 
    onlylove@ubuntu:~/my/qemu-lq$ ./qemu-system-arm -M vexpress-a9 -m 1024M -kernel zImage -append "root=/dev/mmcblk0 console=ttyAMA0 loglevel=8" -dtb vexpress-v2p-ca9.dtb -nographic -sd rootfs.ext4
    WARNING: Image format was not specified for 'rootfs.ext4' and probing guessed raw.
             Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
             Specify the 'raw' format explicitly to remove the restrictions.
    Booting Linux on physical CPU 0x0
    Linux version 4.15.0 (onlylove@ubuntu) (gcc version 6.5.0 (Linaro GCC 6.5-2018.12)) #1 SMP Sat Jun 25 19:45:44 CST 2022
    CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d
    CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
    OF: fdt: Machine model: V2P-CA9
    Memory policy: Data cache writeback
    On node 0 totalpages: 262144
      Normal zone: 2048 pages used for memmap
      Normal zone: 0 pages reserved
      Normal zone: 262144 pages, LIFO batch:31
    CPU: All CPU(s) started in SVC mode.
    percpu: Embedded 16 pages/cpu @(ptrval) s36044 r8192 d21300 u65536
    pcpu-alloc: s36044 r8192 d21300 u65536 alloc=16*4096
    pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
    Built 1 zonelists, mobility grouping on.  Total pages: 260096
    Kernel command line: root=/dev/mmcblk0 console=ttyAMA0 loglevel=8
    log_buf_len individual max cpu contribution: 4096 bytes
    log_buf_len total cpu_extra contributions: 12288 bytes
    log_buf_len min size: 16384 bytes
    log_buf_len: 32768 bytes
    early log buf free: 15096(92%)
    Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
    Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
    Memory: 1029432K/1048576K available (6144K kernel code, 387K rwdata, 1364K rodata, 1024K init, 165K bss, 19144K reserved, 0K cma-reserved)
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
        vmalloc : 0xc0800000 - 0xff800000   (1008 MB)
        lowmem  : 0x80000000 - 0xc0000000   (1024 MB)
        modules : 0x7f000000 - 0x80000000   (  16 MB)
          .text : 0x(ptrval) - 0x(ptrval)   (7136 kB)
          .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
          .data : 0x(ptrval) - 0x(ptrval)   ( 388 kB)
           .bss : 0x(ptrval) - 0x(ptrval)   ( 166 kB)
    SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
    Hierarchical RCU implementation.
    	RCU event tracing is enabled.
    	RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
    RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
    NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
    GIC CPU mask not found - kernel will fail to boot.
    GIC CPU mask not found - kernel will fail to boot.
    L2C: platform modifies aux control register: 0x02020000 -> 0x02420000
    L2C: DT/platform modifies aux control register: 0x02020000 -> 0x02420000
    L2C-310 enabling early BRESP for Cortex-A9
    L2C-310 full line of zeros enabled for Cortex-A9
    L2C-310 dynamic clock gating disabled, standby mode disabled
    L2C-310 cache controller enabled, 8 ways, 128 kB
    L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x46420001
    smp_twd: clock not found -2
    sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
    clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
    Failed to initialize '/smb@4000000/motherboard/iofpga@7,00000000/timer@12000': -22
    Console: colour dummy device 80x30
    Calibrating local timer... 92.30MHz.
    Calibrating delay loop... 1476.19 BogoMIPS (lpj=7380992)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
    Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
    CPU: Testing write buffer coherency: ok
    CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
    Setting up static identity map for 0x60100000 - 0x60100060
    Hierarchical SRCU implementation.
    smp: Bringing up secondary CPUs ...
    smp: Brought up 1 node, 1 CPU
    SMP: Total of 1 processors activated (1476.19 BogoMIPS).
    CPU: All CPU(s) started in SVC mode.
    devtmpfs: initialized
    random: get_random_u32 called from bucket_table_alloc+0xf4/0x248 with crng_init=0
    VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 0
    clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    futex hash table entries: 1024 (order: 4, 65536 bytes)
    random: fast init done
    NET: Registered protocol family 16
    DMA: preallocated 256 KiB pool for atomic coherent allocations
    cpuidle: using governor ladder
    hw-breakpoint: debug architecture 0x4 unsupported.
    Serial: AMBA PL011 UART driver
    OF: amba_device_add() failed (-19) for /memory-controller@100e0000
    OF: amba_device_add() failed (-19) for /memory-controller@100e1000
    OF: amba_device_add() failed (-19) for /watchdog@100e5000
    irq: type mismatch, failed to map hwirq-75 for interrupt-controller@1e001000!
    10009000.uart: ttyAMA0 at MMIO 0x10009000 (irq = 38, base_baud = 0) is a PL011 rev1
    console [ttyAMA0] enabled
    1000a000.uart: ttyAMA1 at MMIO 0x1000a000 (irq = 39, base_baud = 0) is a PL011 rev1
    1000b000.uart: ttyAMA2 at MMIO 0x1000b000 (irq = 40, base_baud = 0) is a PL011 rev1
    1000c000.uart: ttyAMA3 at MMIO 0x1000c000 (irq = 41, base_baud = 0) is a PL011 rev1
    OF: amba_device_add() failed (-19) for /smb@4000000/motherboard/iofpga@7,00000000/wdt@f000
    SCSI subsystem initialized
    libata version 3.00 loaded.
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    Advanced Linux Sound Architecture Driver Initialized.
    clocksource: Switched to clocksource arm,sp804
    NET: Registered protocol family 2
    TCP established hash table entries: 8192 (order: 3, 32768 bytes)
    TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
    TCP: Hash tables configured (established 8192 bind 8192)
    UDP hash table entries: 512 (order: 2, 16384 bytes)
    UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
    NET: Registered protocol family 1
    RPC: Registered named UNIX socket transport module.
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    hw perfevents: enabled with armv7_cortex_a9 PMU driver, 5 counters available
    workingset: timestamp_bits=30 max_order=18 bucket_order=0
    squashfs: version 4.0 (2009/01/31) Phillip Lougher
    jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
    9p: Installing v9fs 9p2000 file system support
    io scheduler noop registered (default)
    io scheduler mq-deadline registered
    io scheduler kyber registered
    clcd-pl11x 10020000.clcd: PL111 designer 41 rev2 at 0x10020000
    clcd-pl11x 10020000.clcd: clcd@10020000 hardware, 1024x768@59 display
    Console: switching to colour frame buffer device 128x48
    clcd-pl11x 1001f000.clcd: PL111 designer 41 rev2 at 0x1001f000
    clcd-pl11x 1001f000.clcd: clcd@1f000 hardware, 640x480@59 display
    40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
    Intel/Sharp Extended Query Table at 0x0031
    Using buffer write method
    erase region 0: offset=0x0,size=0x40000,blocks=256
    40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
    Intel/Sharp Extended Query Table at 0x0031
    Using buffer write method
    erase region 0: offset=0x0,size=0x40000,blocks=256
    Concatenating MTD devices:
    (0): "40000000.flash"
    (1): "40000000.flash"
    into device "40000000.flash"
    libphy: Fixed MDIO Bus: probed
    libphy: smsc911x-mdio: probed
    smsc911x 4e000000.ethernet eth0: MAC Address: 52:54:00:12:34:56
    isp1760 4f000000.usb: bus width: 32, oc: digital
    isp1760 4f000000.usb: NXP ISP1760 USB Host Controller
    isp1760 4f000000.usb: new USB bus registered, assigned bus number 1
    isp1760 4f000000.usb: Scratch test failed.
    isp1760 4f000000.usb: can't setup: -19
    isp1760 4f000000.usb: USB bus 1 deregistered
    usbcore: registered new interface driver usb-storage
    rtc-pl031 10017000.rtc: rtc core: registered pl031 as rtc0
    mmci-pl18x 10005000.mmci: Got CD GPIO
    mmci-pl18x 10005000.mmci: Got WP GPIO
    mmci-pl18x 10005000.mmci: mmc0: PL181 manf 41 rev0 at 0x10005000 irq 34,35 (pio)
    mmc0: new SD card at address 4567
    ledtrig-cpu: registered to indicate activity on CPUs
    usbcore: registered new interface driver usbhid
    usbhid: USB HID core driver
    input: AT Raw Set 2 keyboard as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:iofpga@7,00000000/10006000.kmi/serio0/input/input0
    mmcblk0: mmc0:4567 QEMU! 1.00 GiB 
    aaci-pl041 10004000.aaci: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 33
    aaci-pl041 10004000.aaci: FIFO 512 entries
    oprofile: using arm/armv7-ca9
    NET: Registered protocol family 17
    9pnet: Installing 9P2000 support
    Registering SWP/SWPB emulation handler
    rtc-pl031 10017000.rtc: setting system clock to 2022-06-26 01:37:56 UTC (1656207476)
    ALSA device list:
      #0: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 33
    input: ImExPS/2 Generic Explorer Mouse as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:iofpga@7,00000000/10007000.kmi/serio1/input/input2
    EXT4-fs (mmcblk0): couldn't mount as ext3 due to feature incompatibilities
    EXT4-fs (mmcblk0): mounted filesystem with ordered data mode. Opts: (null)
    VFS: Mounted root (ext4 filesystem) readonly on device 179:0.
    Freeing unused kernel memory: 1024K
    random: crng init done
    mkdir: can't create directory '/dev/pts': Read-only file system
    mount: mounting devpts on /dev/pts failed: No such file or directory
    mdev: can't create 'network_latency': Read-only file system
    mdev: can't create 'tty22': Read-only file system
    mdev: can't create 'tty50': Read-only file system
    mdev: can't create 'tty12': Read-only file system
    mdev: can't create 'tty40': Read-only file system
    mdev: can't create 'ptyp5': Read-only file system
    mdev: can't create 'ptypf': Read-only file system
    mdev: can't create 'tty30': Read-only file system
    mdev: can't create 'tty59': Read-only file system
    mdev: can't create directory 'snd': Read-only file system
    mdev: can't create 'snd/pcmC0D0p': No such file or directory
    mdev: can't create 'memory_bandwidth': Read-only file system
    mdev: can't create 'tty20': Read-only file system
    mdev: can't create 'tty49': Read-only file system
    mdev: can't create 'ttyp8': Read-only file system
    mdev: can't create 'mtd1': Read-only file system
    mdev: can't create 'tty10': Read-only file system
    mdev: can't create 'tty39': Read-only file system
    mdev: can't create directory 'snd': Read-only file system
    mdev: can't create 'snd/pcmC0D0c': No such file or directory
    mdev: can't create 'vcsa1': Read-only file system
    mdev: can't create 'ptyp3': Read-only file system
    mdev: can't create 'ptypd': Read-only file system
    mdev: can't create 'tty29': Read-only file system
    mdev: can't create 'urandom': Read-only file system
    mdev: can't create 'tty57': Read-only file system
    mdev: can't create 'ubi_ctrl': Read-only file system
    mdev: can't create 'tty19': Read-only file system
    mdev: can't create 'tty0': Read-only file system
    mdev: can't create 'tty47': Read-only file system
    mdev: can't create 'ttyp6': Read-only file system
    mdev: can't create 'mtd0': Read-only file system
    mdev: can't create 'ttyAMA2': Read-only file system
    mdev: can't create 'tty37': Read-only file system
    mdev: can't create 'ptyp1': Read-only file system
    mdev: can't create 'ptypb': Read-only file system
    mdev: can't create 'tty27': Read-only file system
    mdev: can't create 'tty9': Read-only file system
    mdev: can't create 'gpiochip2': Read-only file system
    mdev: can't create 'full': Read-only file system
    mdev: can't create 'ttype': Read-only file system
    mdev: can't create 'tty55': Read-only file system
    mdev: can't create 'vcs': Read-only file system
    mdev: can't create 'tty17': Read-only file system
    mdev: can't create 'tty45': Read-only file system
    mdev: can't create 'ttyp4': Read-only file system
    mdev: can't create 'fb1': Read-only file system
    mdev: can't create 'ttyAMA0': Read-only file system
    mdev: can't create 'tty35': Read-only file system
    mdev: can't create directory 'input': Read-only file system
    mdev: can't create 'input/event1': No such file or directory
    mdev: can't create 'tty63': Read-only file system
    mdev: can't create 'tty25': Read-only file system
    mdev: can't create 'tty7': Read-only file system
    mdev: can't create 'gpiochip0': Read-only file system
    mdev: can't create 'zero': Read-only file system
    mdev: can't create 'ttypc': Read-only file system
    mdev: can't create 'tty53': Read-only file system
    mdev: can't create 'tty15': Read-only file system
    mdev: can't create 'tty43': Read-only file system
    mdev: can't create 'ttyp2': Read-only file system
    mdev: can't create 'ptyp8': Read-only file system
    mdev: can't create 'tty33': Read-only file system
    mdev: can't create 'tty61': Read-only file system
    mdev: can't create 'cpu_dma_latency': Read-only file system
    mdev: can't create 'tty23': Read-only file system
    mdev: can't create 'tty5': Read-only file system
    mdev: can't create 'ttypa': Read-only file system
    mdev: can't create 'tty51': Read-only file system
    mdev: can't create 'tty13': Read-only file system
    mdev: can't create 'tty41': Read-only file system
    mdev: can't create 'ttyp0': Read-only file system
    mdev: can't create 'ptyp6': Read-only file system
    mdev: can't create 'tty31': Read-only file system
    mdev: can't create 'network_throughput': Read-only file system
    mdev: can't create 'tty21': Read-only file system
    mdev: can't create 'mem': Read-only file system
    mdev: can't create 'ttyp9': Read-only file system
    mdev: can't create 'mtd1ro': Read-only file system
    mdev: can't create 'tty11': Read-only file system
    mdev: can't create 'kmsg': Read-only file system
    mdev: can't create 'ptyp4': Read-only file system
    mdev: can't create 'ptype': Read-only file system
    mdev: can't create 'tty58': Read-only file system
    mdev: can't create 'hwrng': Read-only file system
    mdev: can't create 'tty48': Read-only file system
    mdev: can't create 'ttyp7': Read-only file system
    mdev: can't create 'mtd0ro': Read-only file system
    mdev: can't create 'rtc0': Read-only file system
    mdev: can't create 'ttyAMA3': Read-only file system
    mdev: can't create directory 'snd': Read-only file system
    mdev: can't create 'snd/timer': No such file or directory
    mdev: can't create 'tty38': Read-only file system
    mdev: can't create 'vcsa': Read-only file system
    mdev: can't create 'ptyp2': Read-only file system
    mdev: can't create 'ptypc': Read-only file system
    mdev: can't create 'tty28': Read-only file system
    mdev: can't create 'gpiochip3': Read-only file system
    mdev: can't create 'random': Read-only file system
    mdev: can't create 'ttypf': Read-only file system
    mdev: can't create 'tty56': Read-only file system
    mdev: can't create 'vcs1': Read-only file system
    mdev: can't create 'tty18': Read-only file system
    mdev: can't create 'tty46': Read-only file system
    mdev: can't create 'ttyp5': Read-only file system
    mdev: can't create 'ttyAMA1': Read-only file system
    mdev: can't create 'tty36': Read-only file system
    mdev: can't create 'ptmx': Read-only file system
    mdev: can't create 'ptyp0': Read-only file system
    mdev: can't create 'ptypa': Read-only file system
    mdev: can't create 'tty26': Read-only file system
    mdev: can't create 'tty8': Read-only file system
    mdev: can't create 'gpiochip1': Read-only file system
    mdev: can't create 'ttypd': Read-only file system
    mdev: can't create 'tty54': Read-only file system
    mdev: can't create 'tty16': Read-only file system
    mdev: can't create 'tty44': Read-only file system
    mdev: can't create directory 'snd': Read-only file system
    mdev: can't create 'snd/controlC0': No such file or directory
    mdev: can't create 'ttyp3': Read-only file system
    mdev: can't create 'fb0': Read-only file system
    mdev: can't create 'ptyp9': Read-only file system
    mdev: can't create 'tty34': Read-only file system
    mdev: can't create directory 'input': Read-only file system
    mdev: can't create 'input/event0': No such file or directory
    mdev: can't create 'tty62': Read-only file system
    mdev: can't create 'tty': Read-only file system
    mdev: can't create 'tty24': Read-only file system
    mdev: can't create 'tty6': Read-only file system
    mdev: can't create 'ttypb': Read-only file system
    mdev: can't create 'tty52': Read-only file system
    mdev: can't create 'tty14': Read-only file system
    mdev: can't create 'tty42': Read-only file system
    mdev: can't create 'ttyp1': Read-only file system
    mdev: can't create 'ptyp7': Read-only file system
    mdev: can't create 'usbmon0': Read-only file system
    mdev: can't create 'tty32': Read-only file system
    mdev: can't create 'tty60': Read-only file system
    mdev: can't create 'mtdblock1': Read-only file system
    mdev: can't create 'mmcblk0': Read-only file system
    mdev: can't create 'mtdblock0': Read-only file system
    
    Please press Enter to activate this console. 
    / # ls
    bin         lib         mnt         sbin        usr
    dev         linuxrc     proc        sys
    etc         lost+found  root        tmp
    / # 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326

    八、搭建网络开发环境

    1、搭建tftp环境

    1、搭建环境

    ubuntu20.04 搭建tftp服务器_lqonlylove的博客-CSDN博客_ubuntu配置tftp服务器

    2、配置qemu网络环境

    Linux 内核调试 七:qemu网络配置_lqonlylove的博客-CSDN博客_qemu 网络配置

    3、搭建tftp环境

    ubuntu20.04 搭建tftp服务器_lqonlylove的博客-CSDN博客_ubuntu配置tftp服务器

    4、搭建nfs环境

    ubuntu20.04 搭建NFS服务器_lqonlylove的博客-CSDN博客

    5、qemu网络配置

    Linux 内核调试 七:qemu网络配置_lqonlylove的博客-CSDN博客_qemu 网络配置

    九、使用NFS挂载根文件系统

    1、配置 busybox

    编译busybox,使其支持nfs加载文件系统:

    nfs
    Linux System Utilities  --->
        [*] mount (23 kb)
            [*]   upport mounting NFS file systems on Linux < 2.6.23
    
    • 1
    • 2
    • 3
    • 4

    2、配置Linux内核

    File systems
    	[*] Network File Systems
    		[*]   Root file system on NFS
    
    • 1
    • 2
    • 3

    3、uboot配置启动环境

    1、启动 uboot

    ./qemu-system-arm -M vexpress-a9 -m 512 -kernel u-boot -nographic -net nic -net tap,ifname=tap0,script=no,downscript=no
    
    • 1

    2、uboot 日志

    onlylove@ubuntu:~/my/qemu-lq$ ./qemu-system-arm -M vexpress-a9 -m 512 -kernel u-boot -nographic -net nic -net tap,ifname=tap0,script=no,downscript=no
    
    
    U-Boot 2018.03 (Jun 25 2022 - 17:53:48 +0800)
    
    DRAM:  512 MiB
    WARNING: Caches not enabled
    Flash: 128 MiB
    MMC:   MMC: 0
    *** Warning - bad CRC, using default environment
    
    In:    serial
    Out:   serial
    Err:   serial
    Net:   smc911x-0
    Hit any key to stop autoboot:  0 
    =>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    3、配置 uboot 网络

    setenv ipaddr 192.168.2.129; setenv netmask 255.255.255.0; setenv serverip 192.168.2.128;
    
    • 1

    4、配置 bootargs

    setenv bootargs 'root=/dev/nfs nfsroot=192.168.2.128:/home/onlylove/my/nfs/rootfs,v3 ip=192.168.2.110:192.168.2.128:192.168.2.1:255.255.255.0::eth0:off console=ttyAMA0'
    
    • 1

    5、加载 Linux镜像和设备树

    tftp 0x60003000 zImage;
    tftp 0x60500000 vexpress-v2p-ca9.dtb;
    
    • 1
    • 2
    => tftp 0x60003000 zImage;
    smc911x: MAC 52:54:00:12:34:56
    smc911x: detected LAN9118 controller
    smc911x: phy initialized
    smc911x: MAC 52:54:00:12:34:56
    Using smc911x-0 device
    TFTP from server 192.168.2.128; our IP address is 192.168.2.129
    Filename 'zImage'.
    Load address: 0x60003000
    Loading: #################################################################
    	 #################################################################
    	 #################################################################
    	 #################################################################
    	 ##########
    	 5.2 MiB/s
    done
    Bytes transferred = 3956152 (3c5db8 hex)
    smc911x: MAC 52:54:00:12:34:56
    => tftp 0x60500000 vexpress-v2p-ca9.dtb;
    smc911x: MAC 52:54:00:12:34:56
    smc911x: detected LAN9118 controller
    smc911x: phy initialized
    smc911x: MAC 52:54:00:12:34:56
    Using smc911x-0 device
    TFTP from server 192.168.2.128; our IP address is 192.168.2.129
    Filename 'vexpress-v2p-ca9.dtb'.
    Load address: 0x60500000
    Loading: #
    	 2.7 MiB/s
    done
    Bytes transferred = 14318 (37ee hex)
    smc911x: MAC 52:54:00:12:34:56
    => 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33

    6、启动 Linux

    bootz 0x60003000 - 0x60500000;
    
    • 1

    4、Linux 启动

    => bootz 0x60003000 - 0x60500000;
    Kernel image @ 0x60003000 [ 0x000000 - 0x3c5db8 ]
    ## Flattened Device Tree blob at 60500000
       Booting using the fdt blob at 0x60500000
       Loading Device Tree to 7feef000, end 7fef57ed ... OK
    
    Starting kernel ...
    
    Booting Linux on physical CPU 0x0
    Linux version 4.15.0 (onlylove@ubuntu) (gcc version 6.5.0 (Linaro GCC 6.5-2018.12)) #1 SMP Sat Jun 25 19:45:44 CST 2022
    CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d
    CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
    OF: fdt: Machine model: V2P-CA9
    Memory policy: Data cache writeback
    CPU: All CPU(s) started in SVC mode.
    random: fast init done
    percpu: Embedded 16 pages/cpu @(ptrval) s36044 r8192 d21300 u65536
    Built 1 zonelists, mobility grouping on.  Total pages: 130048
    Kernel command line: root=/dev/nfs nfsroot=192.168.2.128:/home/onlylove/my/nfs/rootfs,v3 ip=192.168.2.110:192.168.2.128:192.168.2.1:255.255.255.0::eth0:off console=ttyAMA0
    log_buf_len individual max cpu contribution: 4096 bytes
    log_buf_len total cpu_extra contributions: 12288 bytes
    log_buf_len min size: 16384 bytes
    log_buf_len: 32768 bytes
    early log buf free: 14952(91%)
    Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
    Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
    Memory: 509656K/524288K available (6144K kernel code, 387K rwdata, 1364K rodata, 1024K init, 165K bss, 14632K reserved, 0K cma-reserved)
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
        vmalloc : 0xa0800000 - 0xff800000   (1520 MB)
        lowmem  : 0x80000000 - 0xa0000000   ( 512 MB)
        modules : 0x7f000000 - 0x80000000   (  16 MB)
          .text : 0x(ptrval) - 0x(ptrval)   (7136 kB)
          .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
          .data : 0x(ptrval) - 0x(ptrval)   ( 388 kB)
           .bss : 0x(ptrval) - 0x(ptrval)   ( 166 kB)
    SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
    Hierarchical RCU implementation.
    	RCU event tracing is enabled.
    	RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
    RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
    NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
    GIC CPU mask not found - kernel will fail to boot.
    GIC CPU mask not found - kernel will fail to boot.
    L2C: platform modifies aux control register: 0x02020000 -> 0x02420000
    L2C: DT/platform modifies aux control register: 0x02020000 -> 0x02420000
    L2C-310 enabling early BRESP for Cortex-A9
    L2C-310 full line of zeros enabled for Cortex-A9
    L2C-310 dynamic clock gating disabled, standby mode disabled
    L2C-310 cache controller enabled, 8 ways, 128 kB
    L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x46420001
    smp_twd: clock not found -2
    sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
    clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
    Failed to initialize '/smb@4000000/motherboard/iofpga@7,00000000/timer@12000': -22
    Console: colour dummy device 80x30
    Calibrating local timer... 85.52MHz.
    Calibrating delay loop... 1476.19 BogoMIPS (lpj=7380992)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    CPU: Testing write buffer coherency: ok
    CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
    Setting up static identity map for 0x60100000 - 0x60100060
    Hierarchical SRCU implementation.
    smp: Bringing up secondary CPUs ...
    smp: Brought up 1 node, 1 CPU
    SMP: Total of 1 processors activated (1476.19 BogoMIPS).
    CPU: All CPU(s) started in SVC mode.
    devtmpfs: initialized
    VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 0
    clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    futex hash table entries: 1024 (order: 4, 65536 bytes)
    NET: Registered protocol family 16
    DMA: preallocated 256 KiB pool for atomic coherent allocations
    cpuidle: using governor ladder
    hw-breakpoint: debug architecture 0x4 unsupported.
    Serial: AMBA PL011 UART driver
    OF: amba_device_add() failed (-19) for /memory-controller@100e0000
    OF: amba_device_add() failed (-19) for /memory-controller@100e1000
    OF: amba_device_add() failed (-19) for /watchdog@100e5000
    10009000.uart: ttyAMA0 at MMIO 0x10009000 (irq = 35, base_baud = 0) is a PL011 rev1
    console [ttyAMA0] enabled
    1000a000.uart: ttyAMA1 at MMIO 0x1000a000 (irq = 36, base_baud = 0) is a PL011 rev1
    1000b000.uart: ttyAMA2 at MMIO 0x1000b000 (irq = 37, base_baud = 0) is a PL011 rev1
    1000c000.uart: ttyAMA3 at MMIO 0x1000c000 (irq = 38, base_baud = 0) is a PL011 rev1
    OF: amba_device_add() failed (-19) for /smb@4000000/motherboard/iofpga@7,00000000/wdt@f000
    SCSI subsystem initialized
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    Advanced Linux Sound Architecture Driver Initialized.
    clocksource: Switched to clocksource arm,sp804
    NET: Registered protocol family 2
    TCP established hash table entries: 4096 (order: 2, 16384 bytes)
    TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
    TCP: Hash tables configured (established 4096 bind 4096)
    UDP hash table entries: 256 (order: 1, 8192 bytes)
    UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
    NET: Registered protocol family 1
    RPC: Registered named UNIX socket transport module.
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    hw perfevents: enabled with armv7_cortex_a9 PMU driver, 5 counters available
    workingset: timestamp_bits=30 max_order=17 bucket_order=0
    squashfs: version 4.0 (2009/01/31) Phillip Lougher
    jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
    9p: Installing v9fs 9p2000 file system support
    io scheduler noop registered (default)
    io scheduler mq-deadline registered
    io scheduler kyber registered
    clcd-pl11x 10020000.clcd: PL111 designer 41 rev2 at 0x10020000
    clcd-pl11x 10020000.clcd: clcd@10020000 hardware, 1024x768@59 display
    Console: switching to colour frame buffer device 128x48
    clcd-pl11x 1001f000.clcd: PL111 designer 41 rev2 at 0x1001f000
    clcd-pl11x 1001f000.clcd: clcd@1f000 hardware, 640x480@59 display
    40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
    Intel/Sharp Extended Query Table at 0x0031
    Using buffer write method
    40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
    Intel/Sharp Extended Query Table at 0x0031
    Using buffer write method
    Concatenating MTD devices:
    (0): "40000000.flash"
    (1): "40000000.flash"
    into device "40000000.flash"
    libphy: Fixed MDIO Bus: probed
    libphy: smsc911x-mdio: probed
    smsc911x 4e000000.ethernet eth0: MAC Address: 52:54:00:12:34:56
    isp1760 4f000000.usb: bus width: 32, oc: digital
    isp1760 4f000000.usb: NXP ISP1760 USB Host Controller
    isp1760 4f000000.usb: new USB bus registered, assigned bus number 1
    isp1760 4f000000.usb: Scratch test failed.
    isp1760 4f000000.usb: can't setup: -19
    isp1760 4f000000.usb: USB bus 1 deregistered
    usbcore: registered new interface driver usb-storage
    rtc-pl031 10017000.rtc: rtc core: registered pl031 as rtc0
    mmci-pl18x 10005000.mmci: Got CD GPIO
    mmci-pl18x 10005000.mmci: Got WP GPIO
    mmci-pl18x 10005000.mmci: mmc0: PL181 manf 41 rev0 at 0x10005000 irq 31,32 (pio)
    ledtrig-cpu: registered to indicate activity on CPUs
    usbcore: registered new interface driver usbhid
    usbhid: USB HID core driver
    input: AT Raw Set 2 keyboard as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:iofpga@7,00000000/10006000.kmi/serio0/input/input0
    aaci-pl041 10004000.aaci: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 30
    aaci-pl041 10004000.aaci: FIFO 512 entries
    oprofile: using arm/armv7-ca9
    NET: Registered protocol family 17
    9pnet: Installing 9P2000 support
    Registering SWP/SWPB emulation handler
    rtc-pl031 10017000.rtc: setting system clock to 2022-06-26 04:59:27 UTC (1656219567)
    Generic PHY 4e000000.ethernet-ffffffff:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=4e000000.ethernet-ffffffff:01, irq=POLL)
    smsc911x 4e000000.ethernet eth0: SMSC911x/921x identified at 0xa1290000, IRQ: 28
    input: ImExPS/2 Generic Explorer Mouse as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:iofpga@7,00000000/10007000.kmi/serio1/input/input2
    IP-Config: Complete:
         device=eth0, hwaddr=52:54:00:12:34:56, ipaddr=192.168.2.110, mask=255.255.255.0, gw=192.168.2.1
         host=192.168.2.110, domain=, nis-domain=(none)
         bootserver=192.168.2.128, rootserver=192.168.2.128, rootpath=
    ALSA device list:
      #0: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 30
    VFS: Mounted root (nfs filesystem) readonly on device 0:13.
    Freeing unused kernel memory: 1024K
    nfs: server 192.168.2.128 not responding, still trying
    nfs: server 192.168.2.128 not responding, still trying
    nfs: server 192.168.2.128 OK
    nfs: server 192.168.2.128 OK
    can't run '/etc/init.d/rcS': No such file or directory
    
    Please press Enter to activate this console. 
    / # ls
    bin       etc       linuxrc   proc      sbin      test.com  usr
    dev       lib       mnt       root      sys       tmp
    / # ping 192.168.2.128
    PING 192.168.2.128 (192.168.2.128): 56 data bytes
    64 bytes from 192.168.2.128: seq=0 ttl=64 time=5.666 ms
    64 bytes from 192.168.2.128: seq=1 ttl=64 time=3.485 ms
    64 bytes from 192.168.2.128: seq=2 ttl=64 time=1.351 ms
    ^C
    --- 192.168.2.128 ping statistics ---
    3 packets transmitted, 3 packets received, 0% packet loss
    round-trip min/avg/max = 1.351/3.500/5.666 ms
    / #
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184

    5、NFS 测试

    1、qemu 中根文件系统

    / # ls
    bin      etc      linuxrc  proc     sbin     tmp
    dev      lib      mnt      root     sys      usr
    / #
    
    • 1
    • 2
    • 3
    • 4

    2、ubuntu 中根文件系统

    onlylove@ubuntu:~/my/nfs/rootfs$ pwd
    /home/onlylove/my/nfs/rootfs
    onlylove@ubuntu:~/my/nfs/rootfs$ ls
    bin  dev  etc  lib  linuxrc  mnt  proc  root  sbin  sys  tmp  usr
    onlylove@ubuntu:~/my/nfs/rootfs$ vim test.txt
    onlylove@ubuntu:~/my/nfs/rootfs$ ls
    bin  dev  etc  lib  linuxrc  mnt  proc  root  sbin  sys  test.txt  tmp  usr
    onlylove@ubuntu:~/my/nfs/rootfs$
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    3、qemu 中根文件系统

    / # ls
    bin      etc      linuxrc  proc     sbin     tmp
    dev      lib      mnt      root     sys      usr
    / # 
    / # ls
    bin       etc       linuxrc   proc      sbin      test.txt  usr
    dev       lib       mnt       root      sys       tmp
    / #
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    4、测试结果

    在 ubuntu 中创建 test.txt 文件后,qemu 根文件系统中也可以查到。

    6、异常处理

    1、VFS: Cannot open root device “nfs” or unknown-block(2,0): error -6

    解决方案:设置bootargs时加上参数v3

    十、应用程序测试

    1、目标

    在 ubuntu 中编写测试程序,并进行编译。在 qemu 模拟的 ARM 开发板中进行测试。

    2、应用程序

    1、源码目录

    onlylove@ubuntu:~/my/demo/arm$ pwd
    /home/onlylove/my/demo/arm
    onlylove@ubuntu:~/my/demo/arm$ ls
    hello
    onlylove@ubuntu:~/my/demo/arm$ tree hello/
    hello/
    ├── makefile
    └── user
        └── main.c
    
    1 directory, 2 files
    onlylove@ubuntu:~/my/demo/arm$
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    2、makefile

    # 版本信息:2022.04.02 - lqonlylove-v1.0.0
    
    
    
    ##############################
    # 目标
    ##############################
    TARGET := main
    
    
    
    
    ##############################
    # 环境参数
    ##############################
    # CURDIR - make 自动指定(不用修改)
    # SHELL  - make 自动指定(不用修改)
    
    
    
    
    ##############################
    # 编译参数
    ##############################
    CC      := /home/onlylove/my/gcc/gcc-linaro-6.5.0/bin/arm-linux-gnueabihf-gcc
    #LD		:=
    LDLIBS  :=
    LDFLAGS :=
    DEFINES :=
    #INCLUDE := -I.
    CFLAGS 	= -g -Wall -O3 $(DEFINES) $(INCLUDE)
    CXXFLAGS = $(CFLAGS) -DHAVE_CONFIG_H
    #LOADLIBES := 
    #OUTPUT_OPTION := 
    
    #OBJCOPY :=
    #OBJDUMP :=
    
    
    
    
    ##############################
    # 目录管理
    ##############################
    # 设置编译目录
    BUILD_PATH := build
    # 编译过程文件存放目录
    OBJ_PATH := $(BUILD_PATH)/temp
    # 编译可执行文件存放目录
    BIN_PATH := $(BUILD_PATH)/bin
    
    # 头文件目录(根据需要调整)
    INC_PATH := user \
    		   bsp/inc
    
    # 源文件目录(根据需要调整)
    SRC_PATH := user \
    			bsp/src
    
    # 获取源文件下的 c 文件列表(带目录信息)
    SRC := $(foreach dir,$(SRC_PATH),$(wildcard $(dir)/*.c))
    SRC_WITHOUT_DIR := $(notdir $(SRC))
    
    # 为头文件目录添加 -I 选项(详细内容见 gcc 使用手册)
    INCLUDE = $(addprefix -I ,$(INC_PATH))
    
    # 生成 .c 文件对应的 .o 文件列表
    OBJ := $(patsubst %.c,%.o,$(SRC_WITHOUT_DIR))
    # 为 .o 加上编译目录
    OBJ_WITH_BUILD_DIR := $(addprefix $(OBJ_PATH)/,$(OBJ))
    
    # 指定 makefile 源文件查找路径(非常重要)
    VPATH := $(SRC_PATH)
    
    
    
    
    
    
    ##############################
    # makefile 目标管理
    ##############################
    all: build_path $(TARGET)
    
    # 指定目标文件生成规则
    $(TARGET):$(OBJ_WITH_BUILD_DIR)
    	$(CC) -o $(BIN_PATH)/$@ $^
    
    # 指定过程文件生成规则(详细内容见 makefile 静态模式)
    $(OBJ_WITH_BUILD_DIR):$(OBJ_PATH)/%.o: %.c
    	$(CC) -c $(CFLAGS) -o $@ $<
    
    build_path:
    	@if [ ! -d $(BUILD_PATH) ]; then \
      	mkdir -p $(OBJ_PATH);mkdir -p $(BIN_PATH);\
    	fi
    
    
    # 清除过程文件
    .PHONY: clean print
    # 打印部分信息(测试使用)
    print:
    	@echo $(BIN_PATH)
    
    clean:
    	-rm -rf $(BIN_PATH)/$(TARGET) $(OBJ_WITH_BUILD_DIR)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106

    3、main.c

    #include <stdio.h>
    
    int main(int argc, char* argv[])
    {
        printf("hello world!\r\n");
        
        return 0;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    4、编译

    onlylove@ubuntu:~/my/demo/arm/hello$ pwd
    /home/onlylove/my/demo/arm/hello
    onlylove@ubuntu:~/my/demo/arm/hello$ ls
    makefile  user
    onlylove@ubuntu:~/my/demo/arm/hello$ make
    /home/onlylove/my/gcc/gcc-linaro-6.5.0/bin/arm-linux-gnueabihf-gcc -c -g -Wall -O3  -I user -I bsp/inc -o build/temp/main.o user/main.c
    /home/onlylove/my/gcc/gcc-linaro-6.5.0/bin/arm-linux-gnueabihf-gcc -o build/bin/main build/temp/main.o
    onlylove@ubuntu:~/my/demo/arm/hello$ ls
    build  makefile  user
    onlylove@ubuntu:~/my/demo/arm/hello$ tree .
    .
    ├── build
    │   ├── bin
    │   │   └── main
    │   └── temp
    │       └── main.o
    ├── makefile
    └── user
        └── main.c
    
    4 directories, 4 files
    onlylove@ubuntu:~/my/demo/arm/hello$
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22

    3、测试

    1、将 mian 拷贝到 nfs 根文件系统中

    / # ls
    bin      etc      linuxrc  mnt      root     sys      usr
    dev      lib      main     proc     sbin     tmp
    / #
    
    • 1
    • 2
    • 3
    • 4

    2、测试

    / # ls
    bin      etc      linuxrc  mnt      root     sys      usr
    dev      lib      main     proc     sbin     tmp
    / # ./main 
    hello world!
    / #
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
  • 相关阅读:
    leetcode17. 电话号码的字母组合
    Windows 安装docker(详细图解)
    [数据可视化] 词云(Word Cloud)
    Linux常用命令
    BeanFactory、FactoryBean和ObjectFactory、ApplicationContext的入门理解
    知识蒸馏和知识图谱相结合的大模型微调方案
    【云原生之Docker实战】部署CasaOS家庭云系统管理平台
    STC8G1K08A-36I-SOP8 实验版 A1
    LabVIEW大量数据的内存管理
    反射和注解
  • 原文地址:https://blog.csdn.net/OnlyLove_/article/details/125477339