1*4882a593Smuzhiyun1. SATA usage in U-Boot 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun There are two ways to operate the hard disk 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun * Read/write raw blocks from/to SATA hard disk 6*4882a593Smuzhiyun * ext2load to read a file from ext2 file system 7*4882a593Smuzhiyun 8*4882a593Smuzhiyun1.0 How to read the SATA hard disk's information? 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun => sata info 11*4882a593Smuzhiyun 12*4882a593SmuzhiyunSATA device 0: Model: ST3320620AS Firm: 3.AAD Ser#: 4QF01ZTN 13*4882a593Smuzhiyun Type: Hard Disk 14*4882a593Smuzhiyun Supports 48-bit addressing 15*4882a593Smuzhiyun Capacity: 305245.3 MB = 298.0 GB (625142448 x 512) 16*4882a593Smuzhiyun 17*4882a593Smuzhiyun1.1 How to raw write the kernel, file system, dtb to a SATA hard disk? 18*4882a593Smuzhiyun 19*4882a593Smuzhiyun Notes: Hard disk sectors are normally 512 bytes, so 20*4882a593Smuzhiyun 0x1000 sectors = 2 MBytes 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun write kernel 23*4882a593Smuzhiyun => tftp 40000 /tftpboot/uImage.837x 24*4882a593Smuzhiyun => sata write 40000 0 2000 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun write ramdisk 27*4882a593Smuzhiyun => tftp 40000 /tftpboot/ramdisk.837x 28*4882a593Smuzhiyun => sata write 40000 2000 8000 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun write dtb 31*4882a593Smuzhiyun => tftp 40000 /tftpboot/mpc837xemds.dtb 32*4882a593Smuzhiyun => sata write 40000 a000 1000 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun1.2 How to raw read the kernel, file system, dtb from a SATA hard disk? 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun load kernel 37*4882a593Smuzhiyun => sata read 200000 0 2000 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun load ramdisk 40*4882a593Smuzhiyun => sata read 1000000 2000 8000 41*4882a593Smuzhiyun 42*4882a593Smuzhiyun load dtb 43*4882a593Smuzhiyun => sata read 2000000 a000 1000 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun boot 46*4882a593Smuzhiyun => bootm 200000 1000000 2000000 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun1.3 How to load an image from an ext2 file system in U-Boot? 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun U-Boot doesn't support writing to an ext2 file system, so the 51*4882a593Smuzhiyun files must be written by other means (e.g. linux). 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun => ext2ls sata 0:1 / 54*4882a593Smuzhiyun <DIR> 4096 . 55*4882a593Smuzhiyun <DIR> 4096 .. 56*4882a593Smuzhiyun <DIR> 16384 lost+found 57*4882a593Smuzhiyun 1352023 uImage.837x 58*4882a593Smuzhiyun 3646377 ramdisk.837x 59*4882a593Smuzhiyun 12288 mpc837xemds.dtb 60*4882a593Smuzhiyun 12 hello.txt 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun => ext2load sata 0:1 200000 /uImage.837x 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun => ext2load sata 0:1 1000000 /ramdisk.837x 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun => ext2load sata 0:1 2000000 /mpc837xemds.dtb 67*4882a593Smuzhiyun 68*4882a593Smuzhiyun => bootm 200000 1000000 2000000 69