background image

 

Linux Software Developers Kit (SDK) User Guide 

68 

1

1

3

3

.

.

 

 

F

F

i

i

r

r

m

m

w

w

a

a

r

r

e

e

 

 

U

U

p

p

d

d

a

a

t

t

e

e

s

s

 

 

Introduction  

Firmware updates of embedded Linux devices are usually a compromise of your requirements:  

‹

‹

 

 

Are online updates within Linux needed?  

‹

‹

 

 

Is there enough flash space to store the whole update file before starting the update?  

‹

‹

 

 

Is it acceptable to force the unit into an upgrade mode in which it is not responsive 
otherwise?  

‹

‹

 

 

What should happen if the upgrade fails?  

There is no one approach that fits all needs. The most desirable approach, to mimic the online 
update process of Linux desktops and servers via a package management system like rpm or 
dpkg does not work because those systems tend to require more resources (memory and hard 
drive space for metadata) than are available on this platform.  

Ipkg (

http://handhelds.org/moin/moin.cgi/Ipkg

and Opkg (

http://wiki.openmoko.org/wiki/Opkg

try 

to provide similar tools for embedded devices. But they focus on handhelds and cell phones with 
much more memory than our platform has to offer.  

Firmware Updates by File System  

Firmware update processes for embedded Linux devices usually are based on the idea of 
replacing entire file systems at once. This comes with various pros and cons.  

Pros 

‹

‹

 

 

Updates and their validation are easier to predict and test because complete file systems are 
replaced.  

‹

‹

 

 

Updates can be performed offline through the boot loader.  

Cons 

‹

‹

 

 

Changing file system sizes via updates can be complicated if not impossible. Updating active 
file systems can be difficult because mounted files systems cannot be overwritten without 
potentially causing harm. 

Lantronix’ Sample Update Process Implementation  

Overview  

The firmware update process highly depends on the flash memory layout you have chosen for 
your build. Lantronix provides an implementation with the following features and restrictions:  

Содержание MatchPort

Страница 1: ...Linux Software Developer s Kit SDK User Guide Part Number 900 548 Revision D March 2011 EDS1100 2100...

Страница 2: ...current list of our domestic and international sales offices go to the Lantronix Web site at www lantronix com about contact Disclaimer This product has been designed to comply with the limits for a...

Страница 3: ...viations 10 2 Installing the SDK 11 Host Requirements 11 Linux Distributions 11 Host TFTP Server Configuration 14 CD Contents 15 Installation 16 Installed Directories 18 3 dBUG Boot loader 19 Introduc...

Страница 4: ...34 kernel ROMFS root blank JFFS2 36 kernel ROMFS root preserving the JFFS2 partition 37 kernel JFFS2 root 38 kernel ROMFS root JFFS2 AUFS 39 Custom Layout 39 6 Building Clinux 42 Configuration Profil...

Страница 5: ...dding a New Application 62 11 VIP Access Software 63 Introduction 63 Enable VIP Access Software 63 Register the device on DSM 63 Bootstrap 63 Demo application 63 12 Profiling Debugging 66 Introduction...

Страница 6: ...onfigurations Window 45 Figure 6 5 uClinux Distribution Configuration Window 45 Figure 9 1 uClinux Distribution Configuration Window 51 Figure 9 2 uClinux Kernel Library Defaults Selection Window 52 F...

Страница 7: ...Table 2 1 CD Files 15 Table 2 2 Pre built Images 16 Table 3 1 dBug Command Summary 24 Table 3 2 dBug Set Command Options 24 Table 6 1 Configuration Profiles 42 Table 12 1 Other Profiling and Debugging...

Страница 8: ...ules Detailed instructions for installing the SDK on your host Linux system are provided in this guide It also describes the embedded module its boot loader flash partitioning schemes and the build en...

Страница 9: ...ud rate 921600 bps default 115200 bps Ethernet 10 100 base TX with Auto Negotiation GPIO 3 pins 2 shared with serial driver EDS1100 Specs Memory RAM 8MB FLASH 8MB Serial Interface One COM port Max bau...

Страница 10: ...s and Abbreviations Table 1 1 Terms and Abbreviations Term Description dBUG Linux boot loader host Machine onto which the SDK gets installed and is used for cross compiling for the embedded platform S...

Страница 11: ...dhat based distributions Fedora 9 10 11 12 Fedora Core 5 6 CentOS 5 2 5 3 5 4 groupinstall Development Tools installs a lot of additional development tools not necessary for the SDK or gcc make glibc...

Страница 12: ...GTK based graphical configuration utility libqt3 mt dev for the Qt3 based graphical configuration utility Other distributions OpenSUSE 11 2 pattern install devel_C_C pattern install devel_kernel pyth...

Страница 13: ...he sudo package is installed Configure it so your user can run sudo command without having to provide root s password This can be achieved by adding an entry for your login in the example below sally...

Страница 14: ...configure this server may vary among platforms Consult your distribution s documentation for further information To run the following commands as root or with sudo 1 Install the tftp server package r...

Страница 15: ...the original files linux_sdk_host tar bz2 SDK host tools netcon terminal tar bz2 UDP terminal for dBUG network console avahi 0 6 25 tar gz free Zeroconf implementation axTLS 1 2 4 tar gz small SSL ena...

Страница 16: ...ssed linux bin linux without_header linux bin without header This is for dBUG of Linux SDK 1 0 0 5 or before romfs img romfs image This is just the romfs image image bin Linux kernel romfs Linux kerne...

Страница 17: ...cdrom cdrom directory 4 Choose an install directory wherever you want and have write access to This will also be your development directory cd install directory cdrom directory install sh If you run...

Страница 18: ...ntation documents host host tools hostsrc source code for host tools linux Clinux directory images kernel romfs and jffs2 images linux 2 6 x Linux kernel uClibc C library user Applications lantronix L...

Страница 19: ...installed with the Linux development kits Replacing the boot loader image should not be necessary but instructions for doing so are given below 1 Connect an RS232 cable between a Windows PC COM Port...

Страница 20: ...o or EDS1100 2100 6 Click Browse to select the path to the dBUG image file For example the path for the MatchPort AR would be c install directory dBUG dbug R ver romz Figure 3 2 Firmware Upgrade Windo...

Страница 21: ...igure 3 5 Serial Recovery Results Window Basic Configuration 1 Connect an RS232 cable between your host computer COM1 and any of the MatchPort AR CON1 on the eval board XPort Pro Port A on the demo bo...

Страница 22: ...he specified address dBUG set watchdog off dBUG set base hex dBUG set baud 115200 dBUG set autoboot net dBUG set server TFTP server address e g 192 168 0 10 dBUG set client target IP address e g 192 1...

Страница 23: ...set the maxbootfc parameter to the desired numeric value Set maxbootfc to 0 or off to disable the boot failure counter Silent Boot Option The dBUG silent boot option disables both the display of dBUG...

Страница 24: ...iguration option show display dBUG configuration reset reset device dBUG Set Command Options Table 3 2 dBug Set Command Options Option Values Description watchdog on off Enable disable watchdog timer...

Страница 25: ...ommands erase Kernel command line options romfs_flash on off Enable disable XIP for ROMFS bootbank single 1 2 Enable disable Dual bank safebank reset Firmware upgrade status dbug config Linux Utility...

Страница 26: ...ets 6 Press the ESC key to exit the netcon session Disabling netcon In some situations it may be desirable to disable netcon access for security reasons To disable netcon issue the following command a...

Страница 27: ...nd SQUASHFS are read only file systems that support compression They are not currently supported in this SDK since they are not part of the standard Linux kernel as of version 2 6 30 It should be rela...

Страница 28: ...nk Single safebank 0 netcon on tftpsrv on base 16 baud 115200 autoboot Stop at prompt server 172 19 239 1 client 172 19 239 77 gateway 172 19 0 1 netmask 255 255 0 0 filename tftpboot image bin filety...

Страница 29: ...ave data permanently e g for logging or backing up data to a server Be aware that most sample profiles provided by Lantronix do not include support for NFS to save precious RAM Depending on the chosen...

Страница 30: ...dBUG set kcl noinitrd rw root dev nfs ip 192 168 3 88 255 255 0 0 192 168 3 1 eth0 nfsroot 192 168 3 1 install dir linux nfs Dynamic IP If a DHCP server is running on host it can be used by performin...

Страница 31: ...ease ensure that the following two options are enabled in your build CONFIG_USER_BUSYBOX_FEATURE_MOUNT_NFS CONFIG_USER_PORTMAP_PORTMAP The kernel configuration options CONFIG_IP_PNP_DHCP and CONFIG_IP...

Страница 32: ...system nice to have ones on a separate read only file system so they can be updated independently variable files on a compressed write enabled file system and volatile files on a RAM disk This luxury...

Страница 33: ...r Space Flash Layout MatchPort AR EDS1100 EDS2100 Single Bank Dual Bank Bank 1 Dual Bank Bank 2 dev mtd4 3 75 MB dBUG Image Header 128 Bytes Linux Kernel Optional ROMFS 0x00000000 0x00040000 0x0003000...

Страница 34: ...ckup dev mtd7 384 KB User Extra Space dev mtd0 128K Lantronix BootLoader dev mtd1 128K Factory Unit Configuration dev mtd2 128K dBUG Secondary Bootloader dev mtd3 128K dBUG Configuration Reserved Dual...

Страница 35: ...MTD_WRITEABLE force read only static struct mtd_partition m520x_romfs_in_flash_partition name Romfs size 0 needs to be adjusted dynamically offset 0 needs to be adjusted dynamically mask_flags MTD_WRI...

Страница 36: ...M is that the flash area where it resides on can be easily overwritten during a firmware update without interrupting normal operation of the device since the changes won t come into effect until after...

Страница 37: ...maxbootfc off kcl rootfstype romfs 3 Otherwise issue dBUG set kcl rootfstype romfs 4 Initialize Erase the JFFS2 file system with For all platforms Single bank configuration dBUG fl e 0x00400000 0x0040...

Страница 38: ...bin from 172 19 39 1 TFTP transfer completed Read 1605760 bytes 3137 blocks Must erase complete sectors 0x00040000 to 0x001CFFFF Continue yes no yes Flash Erase complete 0x190000 bytes erased Program...

Страница 39: ...tory on the JFFS2 partition For applications it looks like etc is a regular write enabled file system But the big difference to the JFFS2 only solution we discussed in a previous section is that we al...

Страница 40: ...B 128KB on XPort Pro In this example the minimum address we can use would be 0x00200000 though in many cases it is a good idea to leave extra room for future upgrades of the kernel For now we ll just...

Страница 41: ...6KB on XPort Pro The size of the jffs2 partition is 0x600000 bytes 6144KB Note that a flash partition may be larger than its corresponding image because they must begin and end on flash erase block bo...

Страница 42: ...es PROFILE ROMFS JFFS2 NFS IPv6 BUSYBOX default yes yes no yes normal compact yes yes no no compact no_ipv6 yes yes no no normal develop yes yes yes yes normal aufs yes yes root only no normal shared...

Страница 43: ...menuconfig ncurses terminal window make xconfig graphical GTK make qconfig graphical QT3 does not work to change kernel Although the look and feel for these options differ they are identical in functi...

Страница 44: ...select Exit and press Enter Repeat this process for the parent window 5 When prompted to save your new kernel configuration select Yes and press Enter Figure 6 3 uClinux Save Configurations Window 6 T...

Страница 45: ...ize the application library settings selected earlier navigate through the configuration the menu and enable or disable the desired options When finished select Exit and press Enter Figure 6 5 uClinux...

Страница 46: ...t_Pro DEFAULTS_LANTRONIX_XPORT_PRO NEW 2 MatchPort_AR DEFAULTS_LANTRONIX_MATCHPORT_AR NEW 3 EDS2100 DEFAULTS_LANTRONIX_EDS2100 NEW 4 EDS1100 DEFAULTS_LANTRONIX_EDS1100 NEW choice 1 4 1 Configuration P...

Страница 47: ...rootfs img To make the images available for transfer to the target copy the contents of the linux images directory to your tftp boot directory Your tftp boot directory must have write permissions enab...

Страница 48: ...nit process It is here that the various startup and shutdown scripts are configured and the console device is specified The default etc inittab file is setup so that etc init d rcS will be called at s...

Страница 49: ...hichever one is present starting with udhcpc Select the client that best suits your needs Static Address Configuration By default Linux will attempt to get an IP address through DHCP To set a static a...

Страница 50: ...mall footprint SSH server and client The SSH protocol allows for secure shell connections over the network axhttpd The axhttp daemon is a small footprint web server that is part of the axTLS package I...

Страница 51: ...utility binaries as busybox uses the calling link to determine which command to invoke Enabling Disabling Utilities The simplest way to modify the list of utilities included by busybox is to run one...

Страница 52: ...x Kernel Library Defaults Selection Window 3 At the bottom of the screen select Exit and press Enter Repeat this process for the parent window which opens 4 When prompted to save your new kernel confi...

Страница 53: ...e menu for each category of utilities to be modified At each utility option to be modified select Y to enable or N to disable When finished select Exit and press Enter The BusyBox options will now be...

Страница 54: ...e SDK These applications show examples of how to access the network serial port and CPs The Lantronix sample applications are found in the SDK under linux user lantronix The libcp CP API library is al...

Страница 55: ...when the s2e and boa processes are running use your web browser to connect to http target_ip Figure 10 2 Serial To Ethernet Converter Screen To setup a serial to Ethernet tunnel click Tunnel Setup un...

Страница 56: ...Note that this program requires a large amount of memory so you have to reduce memory usage which is used by any other applications Figure 10 4 Serial To Ethernet Tunnel Setup Screen with SSH To setup...

Страница 57: ...SA PRIVATE KEY MIIBuwIBAAKBgQC89M2rttMbT5azCaxmY0szUPWlWK1T2Z2ewihJ68PoS wqNPun FyuhK3qSn3cvdvDoUdQ4 END DSA PRIVATE KEY s2e ssl The s2e ssl program demonstrates serial to Ethernet tunneling with ssl...

Страница 58: ...A1UEBhMCSlAx MUiNfOVv END CERTIFICATE Private Key BEGIN RSA PRIVATE KEY MIICXQIBAAKBgQC2QJSCGFUjsegEQbZl1ylVOi48ZcTJG1wRfyJ854V5 wpk2r7r vjkwxbSeE Qj5L3hJPrnBap5qqPBfZhe8WIqdMXxKrma END RSA PRIVATE KE...

Страница 59: ...figuration file is used to group CPs into bit patterns Note that the MatchPort AR has seven GPIO pins whereas the XPort Pro has three of which 2 are shared with the serial driver The cpm conf file is...

Страница 60: ...tput state enable invert disable group LED type output state enable bit0 CP1 bit1 CP2 bit2 CP3 bit3 CP4 The cpm program can then be invoked to light all four LEDs with the following cpm N LED V 15 The...

Страница 61: ...e Process Stack The check the process stack chkstk is a tool which enables you to see the using stack size of working process like following chkstk PID STACK SIZE USED MARGIN CODESZ DATASZ 1 404c8180...

Страница 62: ...n void printf Testing 1 2 3 n return 0 End test c 1 Create make file as linux user lantronix app_dir Makefile Use linux usr lantronix hello_world Makefile as a reference and adjust for your applicatio...

Страница 63: ...enable the CONFIG_USER_LANTRONIX_VIP_ACCESS option and then rebuild Clinux with make distclean followed by make from the installation directory Register the device on DSM To register your device on DS...

Страница 64: ...1 Lantronix Applications Configuration Window 2 Make the Linux image and boot it 3 Connect to http target_ip_address by Web Browser 4 Click VIP from Menu select the bootstrap xml from the directory wh...

Страница 65: ...nux Software Developers Kit SDK User Guide 65 Figure 11 2 Serial To Ethernet VIP Setup Screen Your device can accept connections on TCP ports e g HTTP TELNET s2e via VIP after the VIP session is visib...

Страница 66: ...has an associated app_name gdb file in its build directory typically linux user app_name You must use the gdb executable that is compiled for the Coldfire architecture Under install_directory toolcha...

Страница 67: ...d Syntax Server Mode iperf s Client Mode iperf c server_ip Other Profiling and Debugging Utilities Below is a list of other profiling and debugging utilities supported on the target Table 12 1 Other P...

Страница 68: ...moin moin cgi Ipkg and Opkg http wiki openmoko org wiki Opkg try to provide similar tools for embedded devices But they focus on handhelds and cell phones with much more memory than our platform has...

Страница 69: ...ike TFTP FTP or HTTP makeimage2 py makeimage2 py provided under install_dir host usr sbin and on the installation CD under the firmware_update directory wraps file system images in headers with inform...

Страница 70: ...d a JFFS2 partition is not mounted tftp target ip 2 From within the TFTP client program set the file transfer mode to octet tftp mode octet 3 Now set the timeout value to a high value The TFTP upgrade...

Страница 71: ...g via a WEB Browser To update the target via WEB Browser with an image file generated by makeimage2 py see the previous section perform the following steps 1 From your host system launch an HTTP sessi...

Страница 72: ...d technical support staff and may be used to ask questions regarding any aspect of the SDK Complete the registration process to obtain a logon ID and post your question If enabled in your user profile...

Страница 73: ...CONFIG_ROOT_NFS KERN File systems Network File Systems Root file system support on NFS Enables NFS mount as RFS CONFIG_LTRX_CPDRV KERN Processor type and features CP driver support Enables CP driver d...

Страница 74: ...ns gdbserver Build gdbserver CONFIG_USER_CONSOLE_DEFA ULT USER Console Login Configuration Use console depends on linux vendor Lantronix platform ro mfs_extra etc inittab CONFIG_USER_CONSOLE_NONE USER...

Страница 75: ...emantics no daemon it is usually implemented on top of fork and cannot be easily replaced without changing the semantics fixed stack size the stack of an application is set at execution time and canno...

Страница 76: ...rmany Only Email eu_techsupp lantronix com or eu_support lantronix com Firmware downloads FAQs and the most up to date documentation are available at www lantronix com support When you report a proble...

Отзывы: