170 likes | 425 Views
AT91SAM Linux Introduction. U-Boot Introduction. Morning Agenda. Environment Setup. Hands-on 01. U-Boot Introduction. Use TFTP on U-Boot. Hands-on 03. NFS Use. Hands-on 04. Kernel Building. Hands-on 05. AT91 Linux Introduction. Linux Getting Started. Hands-on 02. Outlines.
E N D
AT91SAM Linux Introduction U-Boot Introduction
Morning Agenda Environment Setup Hands-on 01 U-Boot Introduction Use TFTP on U-Boot Hands-on 03 NFS Use Hands-on 04 Kernel Building Hands-on 05 AT91 Linux Introduction Linux Getting Started Hands-on 02
Outlines U-Boot Overview Why U-Boot is needed? U-Boot Commands U-Boot Variables Examples Summary
U-Boot Overview Name Das U-Boot Universal Bootstrap Loader Support platform ARM, 32-bit AVR, MIPS, X86, PPC and other Source code http://git.denx.de/ License: GNU GPL AT91 U-Boot patch U-Boot source + AT91 patches = U-Boot for AT91 Many AT91 patches are already committed in U-Boot source
Why U-Boot is needed? - Benefits In developing phase, help to deploy the kernel, driver, rootfs via network Provide network support No need to erase the flash when kernel or rootfs are deployed Provide command UI Support flash read/write and memory read/write Hardware operations Pass the parameters to kernel for boot up
U-Boot & Local Boot sequence InternalMemories NAND flash offset: Root FS 0x00400000 Linux Kernel Linux Kernel 0x00200000 SAMBA Boot U-Boot U-Boot 0x00020000 NandFlash-Boot NandFlash-Boot NVM Boot AT91Bootstrap AT91Bootstrap 0x00000000 ROM NAND FLASH Physical Addr: Linux Kernel 0x72200000 AT91Bootstrap U-Boot 0x73F00000 0x00300000 DDRAM SRAM 9X5 addr is 0x2xxxxxxx Current running Application in Red
Why U-Boot is needed? - Network Ubuntu 11.04 Target board 10.0.0.10 Linux kernel TFTP server Zipped Linux kernel Linux image (/var/lib/tftpboot/uImage) DDRAM u-boot NFS server OpenEmbedded rootfs(/opt/rootfs/) MyIP: 10.0.0.20 Server IP: 10.0.0.10 Kernel Name: uImage NFS position: /opt/rootfs
U-Boot Commands Help • ? – list all the available commands • help <command> – list detail information of the command Network configuration • ping – test the network Execution Control Commands • bootm - boot application image from memory • go - start application at address 'addr‘
U-Boot Commands Memory • cmp – compare two memory ranges (cmp staddr1 staddr2 size (hex)) • cp – copy memory ( cp source targer size (hex)) • md – display memory ( md (.b,.w,.l) addr size (hex)) • .b-byte , .w-word, .l-long • mm – modify memory (mm (.b,.w,.l) addr (hex)) will prompt for new value • mw – memory write (mw [.b, .w, .l] address value [count] (hex))
U-Boot Commands Flash operation • cp – copy memory (cp [.b, .w, .l] source target count (hex)) • flinfo – print Flash memory information • erase – erase flash memory (see help for options) • protect – enable or disable flash protection Download Commands • bootp - boot image via network using BOOTP/TFTP protocol • dhcp - invoke DHCP client to obtain IP/boot params • loadb - load binary file over serial line (kermit mode) • tftpboot, tftp- boot image via network using TFTP protocol
U-Boot Commands – Variables Commands Environment variables related to commands • print – print all the environment variables • setenv – set environment variables • saveenv - save all the environment variables into flash • run - run commands in an environment variable • bootd - boot default, i.e., run 'bootcmd‘ • boot – same as above
U-Boot Variables What is a variable in U-Boot? • Variable can be configuration • Variable can be commands script • U-Boot commands for variables Variable as configuration • Network configuration • ipaddr – board’s IP address • serverip – server’s IP address. Using by TFTP or NFS • netmask – net mask address • Boot parameters • bootargs – arguments that will be passed to the kernel when kernel starts Variable as commands • bootcmd – list of commands that will be run by the boot command
Examples - Commands tftp 0x72200000 linux.bin • Download linux.bin file from tftp server to target address 0x72200000 md 0x72200000 • Display content of memory address 0x72200000 nand read 0x72200000 0x200000 0x100 Read 256 bytes from nand flash to RAM. • 0x72200000 is the target RAM memory address. • 0x00200000 is the offset in target flash • 0x00100 is the size of data to read print - display all the current variables setenv ipaddr 10.0.0.20 - setup target IP address setenv ipaddr ‘10.0.0.20’ - same as above setenv ipaddr - delete variable
Examples Setup a variable as one command, then run it • setenv mycmd nand read 0x72200000 0x00200000 0x00100 • run mycmd • Execute “mycmd” command • Same as command: nand read 0x72200000 0x00200000 0x00100 Setup a variable as a multiple commands, then run it • setenv mycmd ‘nand read 0x72200000 0x00200000 0x100; md 0x200000’ • run mycmd • Execute “mycmd” script. • “mycmd” includes two commands • Multiple commands need to be included between ‘’ • Use ; to separate commands
Boot Arguments setenv bootargs ‘mem=128M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2’ • Memory size: mem=128M • Serial port parameters: console=ttyS0,115200 • Root path: root=/dev/mtdblock1 rw • Flash partitions: mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) • Root file system type: rootfstype=jffs2 setenv bootargs 'mem=128M console=ttyS0,115200 root=/dev/nfs rw nfsroot=10.0.0.10:/opt/rootfs nfsaddrs=10.0.0.20:10.0.0.10:10.0.0.1:255.0.0.0‘ • Memory size: mem=128M • Serial port parameters: console=ttyS0,115200 • Root path: root=/dev/nfs rw • NFS root file system location: nfsroot=10.0.0.10:/mnt/rootfs • IP address: nfsaddrs=10.0.0.20:10.0.0.10:10.0.0.1:255.0.0.0 • Target board IP: 10.0.0.20, Server IP: 10.0.0.10, Gateway: 10.0.0.1, net mask: 255.0.0.0 The Boot arguments MUST be set up correctly according to the kernel settings to allow the system to boot correctly
More information AT91SAM OS Ecosystem: • AT91SAM Linux Ecosystem http://linux4sam.org • AT91SAM WinCE Ecosystem http://www.at91.com/windows4sam • AT91SAM Android Ecosystem http://www.at91.com/android4sam • AT91SAM community forum: http://www.at91.com