当前位置:网站首页>Nanopineo use development process record

Nanopineo use development process record

2022-07-07 04:22:00 Fiery red auspicious cloud

NanopiNEO Learning notes

Experience process

  • adopt Ubuntu Burning official .img Image file

    First, through df -h see SD The mount of

    And then through umount /dev/sdx Uninstall all SD Mount item for (x I'm going to replace it with the corresponding 1-2-3)

    Finally, burn the image file through instructions

    sudo if=xxxx.img of=/dev/sdc bs=4M

  • Configure wireless network card

    • function ifconfig -a If there is wlan0 Indicates that the network card is available

    • Modify file sudo vim /etc/wpa_supplicant/wap_suoolicant.conf

      network{
              
          ssid = "QQ"
          PSK="qwertyuiop789"
      }
      
    • Save and exit

    • ifdown wlan0 Close network card

    • ifup wlan0 Open network card

  • adopt ssh [email protected] Realization SSH Sign in

uboot

compile uboot

  1. First install the compiler , Prepare the compilation environment

  • uboot The compiled source code must be from Ubuntu through git download , Not in Windows through git download , And then through FTP to Ubuntu in , This compilation will make an error

  • After compiling, it passes

    dd if=u-boot-sunxi-with-spl.bin of=/dev/sdc bs=1024 seek=8

    Download to SD card , And then plug in SD card , adopt SD Card activation uboot

  • modify uboot The variable parameters of ,uboot Boot kernel , It was through uboot.src This script file starts , The contents of this script file can be found in Linux After successful startup , stay boot Find the contents to view in this folder

  • Modify the way to start the kernel

    Original :

    bootcmd=fatload mmc 0:1 ${scriptaddr} boot.scr; source ${scriptaddr}

    adopt boot.src The script to start , It seems that the startup parameters are also in the script file

    modify :

    bootcmd=fatload mmc 0:1 42000000 zImage;fatload mmc 0:1 43000000 sun8i-h3-nanopi-neo.dtb;bootz 42000000 - 43000000

    adopt bootz start-up

  • Modify startup parameters

    Original :

    Kernel command line: console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2
    rootfstypxt4 rw rootwait fsck.repair=yes panic=10 fbcon=map:0 data=/dev/mmcblk0p3 snd-soc-core.pmdown_time00000

    It is amended as follows :

    bootargs=console=ttyS0,115200 root=/dev/mmcblk1p2 rootwait rw

    After the modification, a a job is running for dev-mmcblk0p1.device 1min30s The problem of , Unresolved

Linux kernel

compile Linux kernel

  1. First compile Linux kernel , In this way, when starting, you can know whether it is your own kernel by checking the compilation date

  2. Install the compiler before compiling , Configure the compilation environment

    • sudo apt-get install u-boot-tools

    • cd linux

    • touch .scmversion

    • make sunxi_defconfig ARCH=arm CROSS_COMPILE=arm-linux-

    • Compiling the kernel

      make zImage ARCH=arm CROSS_COMPILE=arm-linux-

    • Compile the device tree

      make dtbs ARCH=arm CROSS_COMPILE=arm-linux-

  3. Compile the complete ,zImage and The device tree file is ready

Replace the original img Kernel file and device tree file in the file

  1. And Replace the original img Root file system in file Is essentially the same , Just to /dev/sdc2 Replace with the storage area for kernel files and device tree files /dev/sdc1

  2. The replaced file is arch/arm/boot/zImage and arch/arm/boot/dtb/sun8i-h3-nanopi-neo.dtb

The root file system

Replace the original img Root file system in file

  1. Prepare a compiled file system ( The one used here has passed buildroot Compiled with the file system )

  2. Insert and burn the original img Of documents SD card

  3. Unload the partition of the root file ( Here is /dev/sdc2)

    sudo umount /dev/sdc2

  4. take /dev/sdc2 Mount to the temporary partition /mnt

    sudo mount /dev/sdc2 /mnt

  5. Delete the original root file system

    • Enter the root file system

      cd /mnt

    • Delete all files

      sudo rm ./* -rf

      Be careful : Use sudo, Otherwise, some files have no permission to delete

      Don't delete the wrong path , Wrong, see for yourself ....

  6. Put the compiled root file system into the mounted temporary partition /mnt in

    sudo cp Lib_rootfa.tar /mnt

  7. Unzip the root file system

    sudo tar xfv Lib_rootfa.tar

  8. Delete the compressed package of the root file system

    sudo rm Lib_rootfa.tar

  9. Synchronize files

    sync

  10. Unmount the temporary mount area of the root file system

    • First, the command window should exit /mnt route , Otherwise, you are using how to uninstall

    • Directly enter the system root directory

      cd

    • uninstall

      sudo umount /dev/sdc2

    • Be accomplished , Card insertion , restart

Summary of the learning process

Replace img Document summary in

  1. Now it's all through SD Remove the card and then mount it to the temporary area to replace the files in different partitions , Can I update files through the network ? The probability is ok , I haven't mastered , Continue to update later

Summary of use experience

  • take SD Card in computer , adopt df -h see SD Allocation of chuck area

    /dev/sdc1        40M        12M        29M        30%        /media/lux/boot
    /dev/sdc2        1.2G    1.1G    67M        95%        /media/lux/rootfs
    /dev/sdc3        14G        572M    13G        5%        /media/lux/userdata
    
    • /media/lux/boot The device tree file and Linux Of zImage Image file
    • /media/lux/rootfs The root file system is stored in
    • /media/lux/userdata The root file of the super user is stored in
  • uboot Where are the things that start the content ?

    1. zImage The image and device tree are written in

      cp arch/arm/boot/zImage /media/lux/boot

      cp arch/arm/boot/dts/sun8i-h3-nanopi-neo.dtb /media/lux/boot

      These files exist /media/lux/boot in

    2. The burning method of the root file system is

      make modules_install INSTALL_MOD_PATH=/media/lux/rootfs ARCH=arm CROSS_COMPILE=arm-linux-

    3. uboot The way of burning is

      dd if=uboot.bin of=/dev/sdc bs=1024 seek=8

      therefore uboot Is in the partition 0 The inside? ? That is to say /dev/sdc0?

  • Create a system image file .img

    1. Create a .img file

      dd if=/dev/zero of=sys.img bs=1024 conut=300

      .img File size =bs*count

    2. mount .img file

      sudo mount -o loop sys.img /mnt

      • loop Mount to /dev/loopX Partition ,X The system will automatically adjust the value of

      • Use df -h Check and you will see a /dev/loopX 283M 2.1M 262M 1% /mnt The option to

      • Uninstall is to execute sudo umount /mnt

      • Put the file to be made into the mounted directory /mnt

        sudo cp /home/lux/files/* /mnt -avrf

      • Fix and size files

        e2fsck -p -f sys.img

        resize2fs -M sys.img

    3. format .img file (*, Record , Choose to do )

      sudo mkfs -t ext4 sys.img

      Will be able to sys.img Format to store ext4 File format

Commands used in the development process

  • Query idle loop equipment

    sudo losetup -f

  • mount .img Image file

    sudo losetup /dev/loop21 sys.img

  • Query file system format

    lsblk -f

  • Create a new one 500M The size of .img file .img

    dd if=/dev/zero of=sys.img bs=1M count=500

  • Mount the image file 2 To loop On the device

    sudo losetup /dev/loop21 sys.img

  • Create partitions

    sudo fdisk /dev/loop21

  • Multi partitioned .img File with the loop relation

    sudo kpartx -av sys.img

  • View the associated loop Partition

    ls /dev/mapper/

  • format partition

    sudo mkfs.vfat /dev/mapper/loopXp1

    sudo mkfs.ext4 /dev/mapper/loopXp2

    sudo mkfs.ext4 /dev/mapper/loopXp3

    sudo mkfs.ext4 /dev/mapper/loopXp4

  • Mount partition

    sudo mount /dev/mapper/loopXp1 /mnt

  • Put the file in the partition

    cd /mnt

    cp xxx /mnt

  • Uninstall partition

    sudo umount /dev/mapper/loopXp1

    Do not uninstall instructions in /mnt Execute under directory

原网站

版权声明
本文为[Fiery red auspicious cloud]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207062142031275.html