Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

RockpiS/dev/pxe

< RockpiS‎ | dev
    ROCK Pi S >  Development > PXE BOOT

PXE boot, Preboot eXecution Environment is a specification describes a standardized client-server environment that boots a software assembly, retrieved from a network. U-boot of ROCK Pi S supports PXE boot and it's enabled by default. This page describe how to use PXE boot on ROCK Pi S.

PC Server setting

this document is used tftp server to test pxe boot to ramdisk,next,we will instruct on installing and configuring the tftp server in ubuntu 18.04.5 LTS,and preparing some boot files.

Step 1: Install TFTP and TFTP server

 sudo apt-get install tftp-hpa tftpd-hpa

Step 2: Configure TFTP server

1.Create a folder,like this:

 mkdir /data/tftp_server

2.modify configuration file,like this:

 $ cat /etc/default/tftpd-hpa 
 # /etc/default/tftpd-hpa
 
 TFTP_USERNAME="tftp"
 TFTP_DIRECTORY="/data/tftp_server"
 TFTP_ADDRESS="0.0.0.0:69"
 TFTP_OPTIONS="-l -c -s"

Step 3: Restart tftp

 service tftpd-hpa restart

Step 4:Preparing boot file

copy all files from debian os boot partition,as follows:

 #:sudo scp -r rock@ip:/boot/* /data/tftp_server
 #:/data/tftp_server$ tree
 .
├── boot.cmd
├── boot.scr
├── config-4.4.143-61-rockchip-g1f77a85486f7                  //copy from ubuntu
├── dtbs                                                     //.dtb file,we need rockpi-s-linux.dtb,copy from ubuntu
│   └── 4.4.143-61-rockchip-g1f77a85486f7
│       └── rockchip
│           ├── overlay                                     //.dtbo files,copy from ubuntu
│           │   ├── i2c1-hym8563.dtbo
│           │   ├── README.rockchip-overlays
│           │   ├── rk3308-console-on-uart0.dtbo
  .
  .
  .
│           ├── rk3308-rock-pi-s.dtb
  .
  .
  .
├── extlinux                                                  //copy from ubuntu
│   └── extlinux.conf
├── initrd.img-4.4.143-61-rockchip-g1f77a85486f7            //ramdisk,copy from ubuntu
├── pxelinux.cfg                                            //this folder is important,you can make the folder by yourself
│   └── 01-5e-50-a4-83-72-98                               //named it by env ethaddr of uboot.i will introduce this file
├── System.map-4.4.143-61-rockchip-g1f77a85486f7
├── uEnv.txt
└── vmlinuz-4.4.143-61-rockchip-g1f77a85486f7             //this is a kernel image,copy from debian or build by yourself

Pxelinux.cfg

named pxe configaration file,run to uboot and print ethaddr:

 ...
   hclk_perilp1 100000 KHz                                                                                                                 
   pclk_perilp1 50000 KHz                                                                                                                  
 Net:   eth0: ethernet@fe300000                                                                                                            
 Hit key to stop autoboot('CTRL+C'):  0                                                                                                    
 => print ethaddr                                                                                                                          
 ethaddr=5e:50:a4:83:72:98 

so i named my pxe configaration file 01-5e-50-a4-83-72-98,or you can named it default

 :/data/tftp_server/pxelinux.cfg$ cat 01-5e-50-a4-83-72-98
 label kernel-4.4.143-61-rockchip-g1f77a85486f7
   kernel /vmlinuz-4.4.143-61-rockchip-g1f77a85486f7               //choose your kernel image
   initrd /initrd.img-4.4.143-61-rockchip-g1f77a85486f7             //choose your ramdisk
   devicetreedir /dtbs/4.4.143-61-rockchip-g1f77a85486f7           //choose your dtb folder
   append earlyprintk console=ttyFIQ0,1500000n8 rw init=/sbin/init rootfstype=ext4 rootwait  root=UUID=f6864320-28f2-41de-a865-3c2fb8d0e670             //this is bootargs for kernel


Rock Pi S

we must install uboot on microSD,this document is used microSD,so please see | microSD to install uboot in microSD

Step 1: Configure ip addr

enter uboot,and set some env:

 => setenv ipaddr xx.xx.xx.xx         //set rockpis ip
 => setenv serverip xx.xx.xx.xx        //set ip of tftp

Step 2: run pxe boot cammand

when you run pxe cammand,uboot will get some boot files from your tftp server.as follows:

 =>pxe get  
  missing environment variable: pxeuuid                                           
  missing environment variable: bootfile                                          
  Retrieving file: pxelinux.cfg/01-5e-50-a4-83-72-98                              
  Speed: 100, full duplex                                                         
  Using ethernet@ff4e0000 device                                                  
  TFTP from server 192.168.1.102; our IP address is 192.168.1.104                 
  Filename 'pxelinux.cfg/01-5e-50-a4-83-72-98'.                                   
  Load address: 0x600000                                                          
  Loading: #                                                                      
        95.7 KiB/s                                                             
  done                                                                            
  Bytes transferred = 395 (18b hex)                                               
  Config file found
 =>pxe boot                                                                                                                                                                                                                                          
 select kernel                                                                   
 1:      kernel-4.4.143-61-rockchip-g1f77a85486f7                                
 Enter choice: missing environment variable: bootfile                            
 Retrieving file: /hw_intfc.conf                                                 
 Speed: 100, full duplex                                                         
 Using ethernet@ff4e0000 device                                                  
 TFTP from server 192.168.1.102; our IP address is 192.168.1.104                 
 Filename '/hw_intfc.conf'.                                                      
 Load address: 0x700000                                                          
 Loading: *                                                                      
 TFTP error: 'File not found' (1)                                                
 Not retrying...                                                                 
 hw_conf.valid = 0                                                               
 hw_conf.i2c0 = 2                                                                
 hw_conf.i2c1 = 2                                                                
 hw_conf.i2c2 = 2                                                                
 hw_conf.i2c3 = 2                                                                
 hw_conf.pwm1 = 2                                                                
 hw_conf.pwm2 = 2                                                                
 hw_conf.pwm3 = 2                                                                
 hw_conf.spi0 = 2                                                                
 hw_conf.spi2 = 2                                                                
 hw_conf.uart0 = 2                                                               
 hw_conf.uart1 = 2                                                               
 hw_conf.uart2 = 2                                                               
 hw_conf.dts_overlay_count = 0                                                   
 1:      kernel-4.4.143-61-rockchip-g1f77a85486f7                                
 missing environment variable: bootfile                                          
 Retrieving file: /initrd.img-4.4.143-61-rockchip-g1f77a85486f7                  
 Speed: 100, full duplex                                                         
 Using ethernet@ff4e0000 device                                                  
 TFTP from server 192.168.1.102; our IP address is 192.168.1.104                 
 Filename '/initrd.img-4.4.143-61-rockchip-g1f77a85486f7'.                       
 Load address: 0x4000000                                                         
 Loading: #################################################################        
          #################################################################      
          #################################################################      
          ##################                                                     
          4 MiB/s                                                                
 done                                                                            
 Bytes transferred = 6941705 (69ec09 hex)                                        
 missing environment variable: bootfile                                          
 Retrieving file: /vmlinuz-4.4.143-61-rockchip-g1f77a85486f7                     
 Speed: 100, full duplex                                                         
 Using ethernet@ff4e0000 device                                                  
 TFTP from server 192.168.1.102; our IP address is 192.168.1.104                 
 Filename '/vmlinuz-4.4.143-61-rockchip-g1f77a85486f7'.                          
 Load address: 0x280000                                                          
 Loading: #################################################################      
          #################################################################      
          #################################################################      
          ############                                                           
          3.9 MiB/s                                                              
 done                                                                            
 Bytes transferred = 10663944 (a2b808 hex)                                       
 append: earlyprintk console=ttyFIQ0,1500000n8 rw init=/sbin/init rootfstype=ext0
 missing environment variable: bootfile                                          
 Retrieving file: /dtbs/4.4.143-61-rockchip-g1f77a85486f7/rockchip/rk3308-rock-pb
 Speed: 100, full duplex                                                         
 Using ethernet@ff4e0000 device                                                  
 TFTP from server 192.168.1.102; our IP address is 192.168.1.104                 
 Filename '/dtbs/4.4.143-61-rockchip-g1f77a85486f7/rockchip/rk3308-rock-pi-s.dtb.
 Load address: 0x1f00000                                                         
 Loading: #####                                                                  
          2.8 MiB/s                                                              
 done                                                                            
 Bytes transferred = 63554 (f842 hex)                                            
 fdt addr 0000000001f00000                                                       
 fdt magic number edfe0dd0                                                       
 fdt size 1048576                                                                
 ## Flattened Device Tree blob at 01f00000                                       
    Booting using the fdt blob at 0x1f00000                                      
    Loading Ramdisk to 1ee68000, end 1f506c09 ... OK                             
    Loading Device Tree to 000000001ed65000, end 000000001ee67fff ... OK         
 Adding bank: 0x00200000 - 0x20000000 (size: 0x1fe00000)                         
                                                                               
 Starting kernel ... 
 

and now,your kernel is booting up