Jz2440 u-boot-2016.11, linux-4.17 and busybox-1.28.4 migration notes

Time:2020-1-13

Since May 2018, u-boot-2016.11, u-boot-spl-2016.11 have been successively transplanted on jz2440
Linux-4.17 and busybox-1.28.4, of which linux-4.17 and busybox-1.28.4 were the latest
Version, as a summary of two years of learning Linux.
Unfortunately, at that time, I didn’t take notes at each stage of the migration process, just wanted to finish it as soon as possible. Cause present
I have forgotten about it. I can hardly remember how to compile and burn it. After migration, due to
I was busy working and didn’t submit the code to GitHub. Just recently started a new notebook, so I plan to
Rearrange the data.
Fortunately, GIT’s submission log records the detailed migration process. You can refer to the submission record
Learn how to port a complete Linux system from scratch.
Compared with the u-boot-1.1.6, linux-2.6.22.6 and fs﹤qtopia of the jz2440 development board, I
The transplanted u-boot-2016.11 mainly added the support of independent SPL guided u-boot and DTS device tree
With SPL and DTB partition added, I also tried to migrate u-boot-1.1.6, and found that the jz2440 development board has its own
U-boot-1.1.6 is complicated, and many unnecessary changes have been made, which seems very confusing. If readers need
If you want to leave a message, I will submit it to GitHub.
For linux-4.17, the device tree support is mainly added on jz2440, and the basic peripheral drivers are all set through
Standby tree to configure.

GitHub warehouse:
u-boot-2016.11:https://github.com/cgw201410/u-boot-2016.11_jz2440.git
linux-4.17:    https://github.com/cgw201410/linux-4.17_jz2440.git
busybox-1.28.4:https://github.com/cgw201410/rootfs_jz2440.git

1、 Install build toolchain
1. Install compilation tools
   mkdir /usr/local/arm
Unzip arm-linux-gcc-4.4.3.tar.gz to / usr / local / arm
   tar -zxvf arm-linux-gcc-4.4.3.tar.gz
  
2. Set environment variables
Add a line at the end of ~ /. Bashrc: export path = $path: / usr / local / arm / 4.4.3/bin
Update environment variable: source ~ /. Bashrc
 
2、 U-boot / u-boot-spl compilation
1. Compile u-boot / u-boot-spl
   make O=../tmp/build distclean
   make O=../tmp/build JZ2440_defconfig
   make O=../tmp/build all
  
2. U-boot started by NANDt
Close macro in include / configs / jz2440. H: config sys boot from NOR Flash
U-boot.bin Directory:.. / TMP / build / u-boot.bin
U-boot-spl.bin Directory:.. / TMP / build / SPL / u-boot-spl.bin
  
3. U-boot started by nor
Open macro in include / configs / jz2440. H: config sys boot from NOR Flash
U-boot.bin Directory:.. / TMP / build / u-boot.bin
U-boot-spl.bin Directory:.. / TMP / build / SPL / u-boot-spl.bin
  
   Note: the u-boot-spl.bin compiled by the above two modes is the same.
  
3、 U-boot / u-boot-spl burning
1. U-boot started by nor
Burn u-boot.bin directly through j-link, and u-boot-spl.bin does not need to be burned. Because u-boot does not need SPL boot when nor is started, start u-boot directly in nor.
Reference: how to write S3C2440 bare board program
  
2. NAND initiated u-boot
Here, take TFTP as an example to burn:
   2.1 setting environment variables
   set ipaddr 192.168.xxx.xxx
   set serverip 192.168.xxx.xxx
  
   2.2 burn
   tftp 0x30000000 u-boot-spl.bin; nand erase 0 0x20000; nand write 0x30000000 0 0x20000
   tftp 0x30000000 u-boot.bin; nand erase.part bootloader; nand write 0x30000000 bootloader
  
4、 Environment variable
1. Enter the u-boot command mode, and set the environment variables (except for network related, other default settings are OK).
   baudrate=115200
   bootcmd=nand read 0x30007FC0 kernel; nand read 0x31000000 dtb; bootm 0x30007FC0 – 0x31000000
   bootdelay=5
   ethact=dm9000
   ethaddr=08:00:3e:26:0a:5b
   ipaddr=192.168.1.10
   mtddevname=rootfs
   mtddevnum=5
   netmask=255.255.255.0
   partition=nand0,5
   serverip=192.168.1.167
   stderr=serial
   stdin=serial
   stdout=serial
  
2. Zoning
   device nand0 , # parts = 6
    #: name                size            offset          mask_flags
    0: spl                 0x00020000      0x00000000      0
    1: bootloader          0x000a0000      0x00020000      0
    2: params              0x00020000      0x000c0000      0
    3: dtb                 0x00020000      0x000e0000      0
    4: kernel              0x00500000      0x00100000      0
    5: rootfs              0x0fa00000      0x00600000      0
   active partition: nand0,0 – (spl) 0x00020000 @ 0x00000000
   defaults:
   mtdids  : nand0=jz2440-nand0
   mtdparts: mtdparts=jz2440-nand0:[email protected](spl),640k(bootloader),128k(params),128k(dtb),5m(kernel),-(rootfs)  
  
5、 Compiling and burning Linux kernel
1. compilation
    make distclean
    make jz2440_defconfig
    make uImage
   
ZImage Directory: arch / arm / boot / uimage
DTB Directory: arch / arm / boot / DTS / s3c2440-jz2440.dtb
 
2. burn
   tftp 0x30000000 s3c2440-jz2440.dtb; nand erase.part dtb; nand write 0x30000000 dtb
   tftp 0x30000000 uImage; nand erase.part kernel; nand write 0x30000000 kernel
  
6、 Making and burning busybox file system
1. Making JFFS2 file system with compiled busybox
   mkfs.jffs2 -n -s 0x800 -e 0x20000 –pad=0x800000 -d rootfs -o fs_root.jffs2
  
2. burn
   tftp 0x30000000 rootfs-1.28.4.jffs2; nand erase.part rootfs; nand write 0x30000000 0x600000 $filesize 
 
enjoy !