LogicLoader

LogicLoader is the proprietary bootloader that LogicPD puts on all of its LiteKits. The source code is not available, although it is possible to contact LogicPD if you need help.

Building from Source

LogicLoader is closed-source software, so it is not possible to build it from source.

Bootloader Initialization

Upon bootup, LogicLoader emits the following to the serial port console:

*****************************************************************               

                         LogicLoader                                            

 (c) Copyright 2002-2006, Logic Product Development, Inc.                       
 All Rights Reserved.                                                           
 Version 2.3.5-IMX31_10 0001                                                    
*****************************************************************               

losh> 

If a boot script exists, you can press the q key on power-up to prevent the script from executing.

Configuring the Network Interface

Finding and Changing the MAC Address

Most boards will have a predefined MAC address out-of-the-box. In some cases, it may be necessary to change the MAC address (e.g. conflicts with another device). To do so, you can use the ifmac command. It takes one of the two following formats:

ifmac <interface> [byte 4:byte 5:byte 6]
ifmac <interface> [byte 1:byte 2:byte 3:byte 4:byte 5:byte 6]

<interface> is the name of the interface, usually sm0. If you specify only the last three bytes, the first three default to the values 0x00:0x08:0xEE. It is recommended that you use the first format, since this is Logic's official MAC prefix and will be least likely to conflict with another machine.

If the [byte] fields are left empty, then it simply displays the current MAC address.

Example:

losh> ifmac sm0 0x01:0x02:0x03
error: ifmac: unable to set mode (/dev/config)                                  

        MAC Address will be: 00:08:ee:01:02:03                                  

        The board must be Reset for the Ethernet                                
        Chips to detect new addresses                                           
losh> ifmac sm0
        Current MAC Address: 00:08:ee:01:02:03                                  
losh> 

This changes the MAC address of the board to 00:08:EE:01:02:03.

Changing the IP Address

With LogicLoader, the IP information can be configured manually or using DHCP using the ifconfig command. This command takes one the following formats:

ifconfig [interface]
ifconfig <interface> <ip> <netmask> <gw>
ifconfig <interface> [up|down|dhcp|def|/dev/config]

The first format shows the IP information of the given interface. The second manually sets the IP address, netmask, and gateway of the interface to the given values. The third format performs other functions on the interface, such as bringing it up or down, or configuring it automatically in some way.

Examples:

The following command configures the interface sm0 with the IP address 10.10.0.22, netmask 255.255.255.0, and gateway router 10.10.0.1.

losh> ifconfig sm0 10.10.0.22 255.255.255.0 10.10.0.1
losh> 

This next example configures the interface automatically using DHCP. You must have a DHCP server running on your network to use this option.

losh> ifconfig sm0 dhcp
Starting DHCP on sm0 .                                                          
losh> 

Downloading the Secondary Bootloader

NOTE: This step is unnecessary as of version 2.4 of LogicLoader.

Older versions of LogicLoader lack the ability to boot a Linux kernel. In order to boot a kernel, you must run a secondary bootloader that can pass the proper parameters along. You can download this bootloader, and any other elf files, using the load command as follows:

load elf [source]

The source is the location of the image, and takes the following format:

/tftp/<server:filename>

Where server is the IP address/DNS name for the server, and filename is the path of the file relative to the TFTP root.

Example:

The following example downloads the elf image loader, the secondary bootloader, from server 10.10.0.3 and loads it in the proper area as determined by the elf header:

losh> load elf /tftp/10.10.0.3:loader                                           
loading from /tftp/10.10.0.3:loader:                                            
............................................................................    
ELF section 0: download address: 0x8027a0b4 load address: 0x802020b4            
ELF section 1: download address: 0x80208000 load address: 0x800d0000            
ELF section 2: download address: 0x80278000 load address: 0x80200000            
ELF section 4: download address: 0x8027a0b4 load address: 0x802020b4            
ELF section 5: download address: 0x8027a78c load address: 0x8020278c            
ELF section 6: download address: 0x80278784 load address: 0x80200784            
warning: guessing combined program header size as 449856                        
warning: guessing combined program header size as 451796                        
warning: guessing combined program header size as 451812                        
warning: guessing combined program header size as 453596                        
warning: guessing combined program header size as 455348                        
loaded 455380 @ 0x800d0000 Ram                                                  
...done                                                                         
file loaded  

Downloading the Kernel

LogicLoader downloads the kernel using a raw file format. The load command is used to download the kernel using tftp, and it takes the following arguments:

load raw <dest_addr> <length> [source]

The destination address is generally somewhere high in memory, such as 0x81000000. The length is the exact length of the kernel image, in bytes. The source is the location of the image, and takes the following format:

/tftp/<server:filename>

Where server is the IP address/DNS name for the server, and filename is the path of the file relative to the TFTP root.

Example:

The following example downloads the image zImage.mx31lite, which is 1661352 bytes, from server 10.10.0.3 and stores it in the address 0x81000000:

losh> load raw 0x81000000 1661352 /tftp/10.10.0.3:zImage.mx31lite               
loading from /tftp/10.10.0.3:zImage.mx31lite:                                   
loading raw binary to 0x81000000 (ram) len 001959a8:                            
................................................................................
................................................................................
..............................................done                              
file loaded                                                                     
losh> 

Booting the Kernel

Version 2.4

You can use the exec command directly to boot the kernel on newer versions of LogicLoader.

exec -t -i [mach-id] [Linux Command Line]

Where mach-id is the machine ID found in the kernel source tree at arch/arm/tools/mach-types, and Linux Command Line is an optional string containing the kernel command line options.

Example:
The following line is used to execute a kernel on the OMAP35x Torpedo, using the mach-id for the omap_lv_som:

exec -t -i 1773 "console=ttyS0,115200 root=/dev/nfs rw ip=dhcp" 

Example:
The following line is used to execute a kernel on the MX31 Litekit:

exec -t -i 1236 "console=ttymxc0,115200 ip=dhcp root=/dev/nfs rw" 

Versions 2.3 and older

Once the images have been loaded into memory, you can now begin execution. LogicLoader executes the secondary bootloader, which in turn boots the kernel. The kernel command line parameters are hard-coded into the secondary bootloader. To run an executable from LogicLoader, use the following command:

exec [addr] -

Where addr is the entry point of the exectuable file. For an elf file, you can use the Linux tool readelf to view the headers and find the entry address.

Example

The following example shows how to execute a file with an entry point at 0x800D0494:

losh> exec 0x800d0494 -                                                         
Uncompressing Linux.............................................................
................................................. done, booting the kernel. 

Boot Scripts

It is possible to create scripts that will run at boot-up in order to avoid re-typing instructions. You can store these scripts in a number of places, although the two most likely locations are serial eeprom or the configuration block. The configuration block is generally located on the same flash chip as LogicLoader, so it is always available.

You can use the echo command to write the script to the given memory device. It takes the following format:

echo <data> <destination>

Where destination is either /dev/config or /dev/serial_eeprom. Note that the configuration block must have been initialized using the config CREATE command.

Example:

The following command puts a script that loads and executes the secondary bootloader and kernel. It is stored in the configuration block.

losh> echo "LOLOifconfig sm0 dhcp; load elf /tftp/10.10.0.3:loader; \
            load raw 0x81000000 1661764 /tftp/10.10.0.3:zImage.mx31lite; \
            exec 0x800d0494 - ; \
            exit;\n" /dev/config

You can print the current config by running:

losh> cat /dev/config 

NOTE: The boot script will always run automatically when the board is powered on or reset. Hold down the q key on the keyboard during a power cycle to keep the script from running.

YAFFS

The YAFFS version support by lolo is incompatible with the linux kernel.

References