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

Difference between revisions of "Rockpi4/dev/u-boot/pxe/es es"

< Rockpi4‎ | dev‎ | u-boot‎ | pxe
(Created page with "{{Languages|rockpi4/dev/u-boot/pxe}} {{rockpi4_header_es}} <div class="col-md-12" style="text-shadow: 2px 2px 4px #DDDDDD; box-shadow: 2px 2px 5px #999999;"> rockp...")
 
Line 7: Line 7:
 
       [[rockpi4/es_es | ROCK Pi 4]] > [[rockpi4/dev/es_es | Desarrollando]] > [[rockpi4/dev/u-boot/pxe/es_es  | U-boot PXE ]]
 
       [[rockpi4/es_es | ROCK Pi 4]] > [[rockpi4/dev/es_es | Desarrollando]] > [[rockpi4/dev/u-boot/pxe/es_es  | U-boot PXE ]]
  
 +
PXE boot, Preboot eXecution Environment es una especificación que describe un entorno estándar cliente servidor que inicia software ensamblado, desde una red. U-boot del ROCK Pi soporte boot PXE y está activo por defecto. Esta página describe como usar el boot PXE del ROCK Pi 4.
 +
 +
== Configuración del Servidor ==
 +
Este documento es usado por el servidor tftp para probar boot pxe en '''ramdisk''', a continuación, instalamos y configuramos el servidor tftp con Ubuntu 16.04LTS, y preparamos algunos archivos de inicio.
 +
 +
====Paso 1: Instalar TFTP y el servidor TFTP====
 +
  sudo apt-get install tftp-hpa tftpd-hpa
 +
 +
====Paso 2: Configurar el servidor TFTP====
 +
1.Crear una carpeta, así:
 +
  mkdir '''/data/tftp_server'''
 +
2.Modifica el fichero de configuración, así:
 +
  $ 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"
 +
 +
====Paso 3: Reiniciar tftp====
 +
  service tftpd-hpa restart
 +
 +
====Paso 4: Preparar el fichero de inicio====
 +
copiamos todos los archivos de debian  en la partición boot, de esta forma:
 +
  #:/data/tftp_server$ tree
 +
  .
 +
  ├── config-4.4.154-88-rockchip-00030-g90239a6      //copia de debian
 +
  ├── dtbs                                          // el fichero .dtb, que necesitamos '''rockpi-4b-linux.dtb''', copiar de debian
 +
  │   └── 4.4.154-88-rockchip-00030-g90239a6
 +
  │      └── rockchip
 +
  │          ├── ficus-linux.dtb
 +
  │          ├── px30-evb-ddr3-lvds-v10.dtb
 +
    .
 +
    .
 +
    .
 +
  │          └── '''rockpi-4b-linux.dtb'''
 +
  ├── extlinux                                            //copia de debian
 +
  │   ├── extlinux.conf
 +
  ├── hw_intfc.conf                                      //copia de debian                         
 +
  ├── initrd.img-4.4.154-88-rockchip-00030-g90239a6      //ramdisk,copia de debian
 +
  ├── overlays                                            //.dtbo files,copia de debian
 +
  │   ├── at24c02.dtbo
 +
  │   ├── console-on-ttyS2.dtbo
 +
  │   ├── console-on-ttyS4.dtbo
 +
    .
 +
    .
 +
    .
 +
  │   ├── spi1-waveshare35c.dtbo
 +
  │   └── two-color-led.dtbo
 +
  ├── pxelinux.cfg                                    //this folder is important,you can make the folder by yourself
 +
  │   ├── 01-be-73-e6-4e-04-2b                        //named it by env ethaddr of uboot.i will introduce this file
 +
  │   └── extlinux.conf
 +
  └── vmlinuz-4.4.154-88-rockchip-00030-g90239a6      //this is a kernel image,copy from debian or build by yourself
 +
 +
====Pxelinux.cfg====
 +
Fichero de configuración pxe, ejecutar uboot e imprimir ethaddr:
 +
  ...
 +
    hclk_perilp1 100000 KHz                                                                                                               
 +
    pclk_perilp1 50000 KHz                                                                                                                 
 +
  Net:  eth0: ethernet@fe300000                                                                                                           
 +
  Hit key to stop autoboot('CTRL+C'):  0                                                                                                   
 +
  => print ethaddr                                                                                                                         
 +
  ethaddr=be:73:e6:4e:04:2b
 +
así llamé a mi fichero de configuración pxe 01-be-73-e6-4e-04-2b, o puedes nombrarlo por defecto
 +
 +
  :/data/tftp_server/pxelinux.cfg$ cat 01-be-73-e6-4e-04-2b
 +
  label kernel-4.4.154-88-rockchip-00030-g90239a6
 +
      kernel /vmlinuz-4.4.154-88-rockchip-00030-g90239a6          //choose your kernel image
 +
      devicetreedir /dtbs/4.4.154-88-rockchip-00030-g90239a6      //choose your dtb folder
 +
      initrd initrd.img-4.4.154-88-rockchip-00030-g90239a6      //choose your ramdisk
 +
      append earlycon=uart8250,mmio32,0xff1a0000 swiotlb=1 coherent_pool=1m earlyprintk console=ttyFIQ0,1500000n8 rw root=PARTUUID=b921b045-1d  rootfstype=ext4 init=/sbin/init rootwait        //this is bootargs for kernel
 +
 +
==Rock Pi 4==
 +
debemos instalar uboot en flash spi o en emmc o microSD, este documento usa spi flash, así que mira [https://wiki.radxa.com/Rockpi4/dev/spi-install spi-install] para instalar uboot en spi flash
 +
 +
====Paso 2: Configurar direccion ip====
 +
enter uboot,and set some env:
 +
  => setenv ipaddr xx.xx.xx.xx        //establecer la direccion ip rockpi4
 +
  => setenv serverip xx.xx.xx.xx        //establecer la ip a tftp
 +
 +
====Paso 3: ejecutar comando pxe boot====
 +
cuando ejecute el comando pxe, uboot obtendrá algunos ficheros de su servidor tftp, así:
 +
  '''=>pxe get''' 
 +
  missing environment variable: pxeuuid                                                                                                   
 +
  missing environment variable: bootfile                                                                                                   
 +
  Retrieving file: pxelinux.cfg/01-be-73-e6-4e-04-2b                                                                                       
 +
  Speed: 1000, full duplex                                                                                                                 
 +
  Using ethernet@fe300000 device                                                                                                           
 +
  TFTP from server 192.168.2.140; our IP address is 192.168.2.205                                                                         
 +
  Filename 'pxelinux.cfg/01-be-73-e6-4e-04-2b'.                                                                                           
 +
  Load address: 0x600000                                                                                                                   
 +
  Loading: #                                                                                                                               
 +
          391.6 KiB/s                                                                                                                     
 +
  done                                                                                                                                     
 +
  Bytes transferred = 401 (191 hex)                                                                                                       
 +
  Config file found
 +
  '''=>pxe boot'''                                                                                                                                                                                                                                         
 +
  missing environment variable: bootfile                                                                                                   
 +
  Retrieving file: /hw_intfc.conf                                                                                                         
 +
  Speed: 1000, full duplex                                                                                                                 
 +
  Using ethernet@fe300000 device                                                                                                           
 +
  TFTP from server 192.168.2.140; our IP address is 192.168.2.205                                                                         
 +
  Filename '/hw_intfc.conf'.                                                                                                               
 +
  Load address: 0x700000                                                                                                                   
 +
  Loading: #                                                                                                                               
 +
          840.8 KiB/s                                                                                                                     
 +
  done                                                                                                                                     
 +
  Bytes transferred = 1722 (6ba hex)                                                                                                       
 +
  dtoverlay number: 0, name:/overlays/console-on-ttyS2.dtbo                                                                               
 +
  hw_conf.valid = 1                                                                                                                       
 +
  hw_conf.pwm0 = 0                                                                                                                         
 +
  hw_conf.pwm1 = 0                                                                                                                         
 +
  hw_conf.uart2 = 0                                                                                                                       
 +
  hw_conf.uart4 = 0                                                                                                                       
 +
  hw_conf.spi1 = 0                                                                                                                         
 +
  hw_conf.spi2 = 0                                                                                                                         
 +
  hw_conf.i2c2 = 0                                                                                                                         
 +
  hw_conf.i2c6 = 0                                                                                                                         
 +
  hw_conf.i2c7 = 0                                                                                                                         
 +
  hw_conf.dts_overlay_count = 1                                                                                                           
 +
  hw_conf.dts_overlay[0] = /overlays/console-on-ttyS2.dtbo                                                                                 
 +
  1:      kernel-4.4.154-88-rockchip-00030-g90239a6                                                                                       
 +
  missing environment variable: bootfile                                                                                                   
 +
  Retrieving file: initrd.img-4.4.154-88-rockchip-00030-g90239a6                                                                           
 +
  Speed: 1000, full duplex                                                                                                                 
 +
  Using ethernet@fe300000 device                                                                                                           
 +
  TFTP from server 192.168.2.140; our IP address is 192.168.2.205                                                                         
 +
  Filename 'initrd.img-4.4.154-88-rockchip-00030-g90239a6'.                                                                               
 +
  Load address: 0xa200000                                                                                                                 
 +
  Loading: ########......                                                                                                                       
 +
          ##################                                                                                                             
 +
          5.2 MiB/s                                                                                                                       
 +
  done                                                                                                                                     
 +
  Bytes transferred = 4072215 (3e2317 hex)                                                                                                 
 +
  missing environment variable: bootfile                                                                                                   
 +
  Retrieving file: /vmlinuz-4.4.154-88-rockchip-00030-g90239a6                                                                             
 +
  Speed: 1000, full duplex                                                                                                                 
 +
  Using ethernet@fe300000 device                                                                                                           
 +
  TFTP from server 192.168.2.140; our IP address is 192.168.2.205                                                                         
 +
  Filename '/vmlinuz-4.4.154-88-rockchip-00030-g90239a6'.                                                                                 
 +
  Load address: 0x280000                                                                                                                   
 +
  Loading: ################# ......                                                   
 +
          ########################                                                                                                       
 +
        5 MiB/s                                                                                                                         
 +
  done                                                                                                                                     
 +
  Bytes transferred = 19427336 (1287008 hex)                                                                                               
 +
  append: earlycon=uart8250,mmio32,0xff1a0000 swiotlb=1 coherent_pool=1m earlyprintk console=ttyFIQ0,1500000n8 rw root=PARTUUID=b921b045-1dt
 +
  missing environment variable: bootfile                                                                                                   
 +
  Retrieving file: /dtbs/4.4.154-88-rockchip-00030-g90239a6/rockchip/rockpi-4b-linux.dtb                                                   
 +
  Speed: 1000, full duplex                                                                                                                 
 +
  Using ethernet@fe300000 device                                                                                                           
 +
  TFTP from server 192.168.2.140; our IP address is 192.168.2.205                                                                         
 +
  Filename '/dtbs/4.4.154-88-rockchip-00030-g90239a6/rockchip/rockpi-4b-linux.dtb'.                                                       
 +
  Load address: 0x8300000                                                                                                                 
 +
  Loading: #######                                                                                                                         
 +
          5 MiB/s                                                                                                                         
 +
  done                                                                                                                                     
 +
  Bytes transferred = 93561 (16d79 hex)                                                                                                   
 +
  fdt addr 0000000008300000                                                                                                               
 +
  fdt magic number edfe0dd0                                                                                                               
 +
  fdt size 1048576                                                                                                                         
 +
  merge_dts_overlay                                                                                                                       
 +
  missing environment variable: bootfile                                                                                                   
 +
  Retrieving file: /overlays/console-on-ttyS2.dtbo                                                                                         
 +
  Speed: 1000, full duplex                                                                                                                 
 +
  Using ethernet@fe300000 device                                                                                                           
 +
  TFTP from server 192.168.2.140; our IP address is 192.168.2.205                                                                         
 +
  Filename '/overlays/console-on-ttyS2.dtbo'.                                                                                             
 +
  Load address: 0x8200000                                                                                                                 
 +
  Loading: #                                                                                                                               
 +
          755.9 KiB/s                                                                                                                     
 +
  done                                                                                                                                     
 +
  Bytes transferred = 774 (306 hex)                                                                                                       
 +
  overlay dtb(0x0000000008200000) is valid                                                                                                 
 +
  fdt_overlay_apply 0000000008300000 0000000008200000                                                                                     
 +
  ## Flattened Device Tree blob at 08300000                                                                                               
 +
    Booting using the fdt blob at 0x8300000                                                                                               
 +
    Loading Ramdisk to e99e3000, end e9dc5317 ... OK                                                                                     
 +
    Loading Device Tree to 00000000e98e0000, end 00000000e99e2fff ... OK                                                                 
 +
  Adding bank: 0x00200000 - 0xf8000000 (size: 0xf7e00000)                                                                                 
 +
  Total: 717296.593 ms                                                                                                                     
 +
                                                                                                                                           
 +
  Starting kernel ...                                                                                                                     
 +
                                                                                                                                           
 +
                                                                                                                                           
 +
  [    0.000000] Booting Linux on physical CPU 0x0                                                                                         
 +
  [    0.000000] Initializing cgroup subsys cpuset
 +
 +
y ahora tu núcleo está iniciado
  
  
 
</div>
 
</div>

Revision as of 17:10, 3 December 2019


       ROCK Pi 4 >  Desarrollando >  U-boot PXE 

PXE boot, Preboot eXecution Environment es una especificación que describe un entorno estándar cliente servidor que inicia software ensamblado, desde una red. U-boot del ROCK Pi soporte boot PXE y está activo por defecto. Esta página describe como usar el boot PXE del ROCK Pi 4.

Configuración del Servidor

Este documento es usado por el servidor tftp para probar boot pxe en ramdisk, a continuación, instalamos y configuramos el servidor tftp con Ubuntu 16.04LTS, y preparamos algunos archivos de inicio.

Paso 1: Instalar TFTP y el servidor TFTP

 sudo apt-get install tftp-hpa tftpd-hpa

Paso 2: Configurar el servidor TFTP

1.Crear una carpeta, así:

 mkdir /data/tftp_server

2.Modifica el fichero de configuración, así:

 $ 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"

Paso 3: Reiniciar tftp

 service tftpd-hpa restart

Paso 4: Preparar el fichero de inicio

copiamos todos los archivos de debian en la partición boot, de esta forma:

 #:/data/tftp_server$ tree
 .
 ├── config-4.4.154-88-rockchip-00030-g90239a6      //copia de debian
 ├── dtbs                                           // el fichero .dtb, que necesitamos rockpi-4b-linux.dtb, copiar de debian
 │   └── 4.4.154-88-rockchip-00030-g90239a6
 │       └── rockchip
 │           ├── ficus-linux.dtb
 │           ├── px30-evb-ddr3-lvds-v10.dtb
   .
   .
   .
 │           └── rockpi-4b-linux.dtb
 ├── extlinux                                            //copia de debian
 │   ├── extlinux.conf
 ├── hw_intfc.conf                                       //copia de debian                          
 ├── initrd.img-4.4.154-88-rockchip-00030-g90239a6       //ramdisk,copia de debian
 ├── overlays                                            //.dtbo files,copia de debian
 │   ├── at24c02.dtbo
 │   ├── console-on-ttyS2.dtbo
 │   ├── console-on-ttyS4.dtbo
   .
   .
   .
 │   ├── spi1-waveshare35c.dtbo
 │   └── two-color-led.dtbo
 ├── pxelinux.cfg                                    //this folder is important,you can make the folder by yourself
 │   ├── 01-be-73-e6-4e-04-2b                        //named it by env ethaddr of uboot.i will introduce this file
 │   └── extlinux.conf
 └── vmlinuz-4.4.154-88-rockchip-00030-g90239a6      //this is a kernel image,copy from debian or build by yourself

Pxelinux.cfg

Fichero de configuración pxe, ejecutar uboot e imprimir ethaddr:

 ...
   hclk_perilp1 100000 KHz                                                                                                                 
   pclk_perilp1 50000 KHz                                                                                                                  
 Net:   eth0: ethernet@fe300000                                                                                                            
 Hit key to stop autoboot('CTRL+C'):  0                                                                                                    
 => print ethaddr                                                                                                                          
 ethaddr=be:73:e6:4e:04:2b

así llamé a mi fichero de configuración pxe 01-be-73-e6-4e-04-2b, o puedes nombrarlo por defecto

 :/data/tftp_server/pxelinux.cfg$ cat 01-be-73-e6-4e-04-2b
 label kernel-4.4.154-88-rockchip-00030-g90239a6
     kernel /vmlinuz-4.4.154-88-rockchip-00030-g90239a6           //choose your kernel image
     devicetreedir /dtbs/4.4.154-88-rockchip-00030-g90239a6      //choose your dtb folder
     initrd initrd.img-4.4.154-88-rockchip-00030-g90239a6       //choose your ramdisk
     append earlycon=uart8250,mmio32,0xff1a0000 swiotlb=1 coherent_pool=1m earlyprintk console=ttyFIQ0,1500000n8 rw root=PARTUUID=b921b045-1d   rootfstype=ext4 init=/sbin/init rootwait        //this is bootargs for kernel

Rock Pi 4

debemos instalar uboot en flash spi o en emmc o microSD, este documento usa spi flash, así que mira spi-install para instalar uboot en spi flash

Paso 2: Configurar direccion ip

enter uboot,and set some env:

 => setenv ipaddr xx.xx.xx.xx         //establecer la direccion ip rockpi4
 => setenv serverip xx.xx.xx.xx        //establecer la ip a tftp

Paso 3: ejecutar comando pxe boot

cuando ejecute el comando pxe, uboot obtendrá algunos ficheros de su servidor tftp, así:

 =>pxe get  
 missing environment variable: pxeuuid                                                                                                     
 missing environment variable: bootfile                                                                                                    
 Retrieving file: pxelinux.cfg/01-be-73-e6-4e-04-2b                                                                                        
 Speed: 1000, full duplex                                                                                                                  
 Using ethernet@fe300000 device                                                                                                            
 TFTP from server 192.168.2.140; our IP address is 192.168.2.205                                                                           
 Filename 'pxelinux.cfg/01-be-73-e6-4e-04-2b'.                                                                                             
 Load address: 0x600000                                                                                                                    
 Loading: #                                                                                                                                
          391.6 KiB/s                                                                                                                      
 done                                                                                                                                      
 Bytes transferred = 401 (191 hex)                                                                                                         
 Config file found
 =>pxe boot                                                                                                                                                                                                                                          
 missing environment variable: bootfile                                                                                                    
 Retrieving file: /hw_intfc.conf                                                                                                           
 Speed: 1000, full duplex                                                                                                                  
 Using ethernet@fe300000 device                                                                                                            
 TFTP from server 192.168.2.140; our IP address is 192.168.2.205                                                                           
 Filename '/hw_intfc.conf'.                                                                                                                
 Load address: 0x700000                                                                                                                    
 Loading: #                                                                                                                                
          840.8 KiB/s                                                                                                                      
 done                                                                                                                                      
 Bytes transferred = 1722 (6ba hex)                                                                                                        
 dtoverlay number: 0, name:/overlays/console-on-ttyS2.dtbo                                                                                 
 hw_conf.valid = 1                                                                                                                         
 hw_conf.pwm0 = 0                                                                                                                          
 hw_conf.pwm1 = 0                                                                                                                          
 hw_conf.uart2 = 0                                                                                                                         
 hw_conf.uart4 = 0                                                                                                                         
 hw_conf.spi1 = 0                                                                                                                          
 hw_conf.spi2 = 0                                                                                                                          
 hw_conf.i2c2 = 0                                                                                                                          
 hw_conf.i2c6 = 0                                                                                                                          
 hw_conf.i2c7 = 0                                                                                                                          
 hw_conf.dts_overlay_count = 1                                                                                                             
 hw_conf.dts_overlay[0] = /overlays/console-on-ttyS2.dtbo                                                                                  
 1:      kernel-4.4.154-88-rockchip-00030-g90239a6                                                                                         
 missing environment variable: bootfile                                                                                                    
 Retrieving file: initrd.img-4.4.154-88-rockchip-00030-g90239a6                                                                            
 Speed: 1000, full duplex                                                                                                                  
 Using ethernet@fe300000 device                                                                                                            
 TFTP from server 192.168.2.140; our IP address is 192.168.2.205                                                                           
 Filename 'initrd.img-4.4.154-88-rockchip-00030-g90239a6'.                                                                                 
 Load address: 0xa200000                                                                                                                   
 Loading: ########......                                                                                                                        
          ##################                                                                                                               
          5.2 MiB/s                                                                                                                        
 done                                                                                                                                      
 Bytes transferred = 4072215 (3e2317 hex)                                                                                                  
 missing environment variable: bootfile                                                                                                    
 Retrieving file: /vmlinuz-4.4.154-88-rockchip-00030-g90239a6                                                                              
 Speed: 1000, full duplex                                                                                                                  
 Using ethernet@fe300000 device                                                                                                            
 TFTP from server 192.168.2.140; our IP address is 192.168.2.205                                                                           
 Filename '/vmlinuz-4.4.154-88-rockchip-00030-g90239a6'.                                                                                   
 Load address: 0x280000                                                                                                                    
 Loading: ################# ......                                                    
          ########################                                                                                                         
        5 MiB/s                                                                                                                          
 done                                                                                                                                      
 Bytes transferred = 19427336 (1287008 hex)                                                                                                
 append: earlycon=uart8250,mmio32,0xff1a0000 swiotlb=1 coherent_pool=1m earlyprintk console=ttyFIQ0,1500000n8 rw root=PARTUUID=b921b045-1dt
 missing environment variable: bootfile                                                                                                    
 Retrieving file: /dtbs/4.4.154-88-rockchip-00030-g90239a6/rockchip/rockpi-4b-linux.dtb                                                    
 Speed: 1000, full duplex                                                                                                                  
 Using ethernet@fe300000 device                                                                                                            
 TFTP from server 192.168.2.140; our IP address is 192.168.2.205                                                                           
 Filename '/dtbs/4.4.154-88-rockchip-00030-g90239a6/rockchip/rockpi-4b-linux.dtb'.                                                         
 Load address: 0x8300000                                                                                                                   
 Loading: #######                                                                                                                          
          5 MiB/s                                                                                                                          
 done                                                                                                                                      
 Bytes transferred = 93561 (16d79 hex)                                                                                                     
 fdt addr 0000000008300000                                                                                                                 
 fdt magic number edfe0dd0                                                                                                                 
 fdt size 1048576                                                                                                                          
 merge_dts_overlay                                                                                                                         
 missing environment variable: bootfile                                                                                                    
 Retrieving file: /overlays/console-on-ttyS2.dtbo                                                                                          
 Speed: 1000, full duplex                                                                                                                  
 Using ethernet@fe300000 device                                                                                                            
 TFTP from server 192.168.2.140; our IP address is 192.168.2.205                                                                           
 Filename '/overlays/console-on-ttyS2.dtbo'.                                                                                               
 Load address: 0x8200000                                                                                                                   
 Loading: #                                                                                                                                
          755.9 KiB/s                                                                                                                      
 done                                                                                                                                      
 Bytes transferred = 774 (306 hex)                                                                                                         
 overlay dtb(0x0000000008200000) is valid                                                                                                  
 fdt_overlay_apply 0000000008300000 0000000008200000                                                                                       
 ## Flattened Device Tree blob at 08300000                                                                                                 
    Booting using the fdt blob at 0x8300000                                                                                                
    Loading Ramdisk to e99e3000, end e9dc5317 ... OK                                                                                       
    Loading Device Tree to 00000000e98e0000, end 00000000e99e2fff ... OK                                                                   
 Adding bank: 0x00200000 - 0xf8000000 (size: 0xf7e00000)                                                                                   
 Total: 717296.593 ms                                                                                                                      
                                                                                                                                           
 Starting kernel ...                                                                                                                       
                                                                                                                                           
                                                                                                                                           
 [    0.000000] Booting Linux on physical CPU 0x0                                                                                          
 [    0.000000] Initializing cgroup subsys cpuset

y ahora tu núcleo está iniciado