Examples

The following examples are for the EDOSK7780 reference platform, based on an SH4A 400 MHz CPU.

Kernel restoration

The sample buildfile for kernel restoration on the EDOSK7780 reference platform is as follows:

#################################################################
## START OF BUILD SCRIPT for Renesas EDOSK7780 Board
#################################################################
[image=0x88010000]
[virtual=shle/binary +compress] .bootstrap = {
    startup-edosk7780 -Dscif..115200.1843200.16 -f400000000 -vv -I1

    PATH=/proc/boot LD_LIBRARY_PATH=/proc/boot procnto -vvvv
}

[+script] .script = {
    procmgr_symlink ../../proc/boot/libc.so.2 /usr/lib/ldqnx.so.2

    display_msg Welcome to QNX Neutrino on the Renesas EDOSK-7780

    devc-sersci -e -F -x -b115200 -c1843200/16 scif0 scif1 &
    reopen /dev/ser1

    SYSNAME=nto
    TERM=qansi

    [+session] PATH=:/proc/boot LD_LIBRARY_PATH=/proc/boot ksh &
}

[type=link] /dev/console=/dev/ser1
[type=link] /tmp=/dev/shmem
libc.so

[data=c]
devc-sersci
ls
ksh
pidin
###################################################################
## END OF BUILD SCRIPT
###################################################################

To build the image:

# mkifs -v edosk7780.build edosk7780.ifs

The sample output is as follows:

QNX Neutrino IPL for the EDOSK-7780                 
Press 'd' to download an OS image serially              
Press any other key to boot from flash 

Press a key other than d; the output continues:

Downloading from Flash                                  
Restore IFS searching for valid IFS in RAM...
         
rifs_info PADDR = 0x08008000                            
rifs_info ADDR = 0x88008000                             
INVALID IFS signature                                   
Restore IFS failed - Reload entire IFS.
               
PT_LOAD RW: 0004b000 size is 000030b0                   
Found procnto Elf header                                
bootable exec data: offset 0004b000, size 000030b0      
Compressed image, store data                            
Calculate restore info checksum    

System page at phys:081d1000 user:081d1000 kern:881d1000                
Starting next program at v8803c258                                      
Welcome to QNX Neutrino on the Renesas EDOSK-7780

The board has booted; run an application:

#                                                
# ls
dev     proc    tmp     usr     

Press the reset button to simulate wake-up:

# QNX Neutrino IPL for the EDOSK-7780                                   
Press 'd' to download an OS image serially                              
Press any other key to boot from flash        

Press a key other than d. The output continues:

Downloading from Flash                                                  
Restore IFS searching for valid IFS in RAM...
                         
rifs_info PADDR = 0x08008000                                            
rifs_info ADDR = 0x88008000                                             
FOUND valid IFS signature                                               
FOUND valid RIFS signature                                              
FOUND valid RIFS info                                                   
FOUND valid IFS signature and RIFS info in RAM.
                       
IFS pre checksum = 0x7bbb7898 (shouldn't be 0x0)                       
bootable exec 0 offset: 0x0004bef8                                      
bootable exec 0 size: 0x000030b0                                        
Compressed image src = 0x0800a000                                       
IFS post checksum = 0x00000000 (should be 0x0)                          
PT_LOAD RW: 0004b000 size is 000030b0                                   
Found procnto Elf header                                                
bootable exec data: offset 0004b000, size 000030b0                      
Compressed image, store data                                            
Calculate restore info checksum                                         
                                                                        
System page at phys:081d1000 user:081d1000 kern:881d1000                
Starting next program at v8803c258                                      
Welcome to QNX Neutrino on the Renesas EDOSK-7780  
# ls                                                                   
dev     proc    tmp     usr                    

To disable the checksum verification on the IFS after it has been restored, modify the buildfile to:

startup-edosk7780 -Dscif..115200.1843200.16 -f400000000 -vv —I0

On subsequent boots, you will see the additional output (with debug enabled):

WARNING: Skipped image checksum verification  
Note: With debugging enabled, the checksum value is still calculated so that it can be displayed. However, the checksum value isn't used to determine if the IFS has been restored properly (it's assumed that it was).

If you're working with uncompressed images, the buildfile looks like:

[virtual=shle/binary] .bootstrap = {
    startup-edosk7780 -Dscif..115200.1843200.16 -f400000000 -vv -I1

    PATH=/proc/boot LD_LIBRARY_PATH=/proc/boot procnto -vvvv
}

The sample output looks something like:

Restore IFS searching for valid IFS in RAM...
        
rifs_info PADDR = 0x08008000                           
rifs_info ADDR = 0x88008000                            
INVALID IFS signature                                  
Restore IFS failed - Reload entire IFS.
              
PT_LOAD RW: 0004b000 size is 000030b0                  
Found procnto Elf header                               
bootable exec data: offset 0004b000, size 000030b0     
Calculate restore info checksum            

Press the reset button to simulate wake-up. The output continues:

Restore IFS searching for valid IFS in RAM...
         
rifs_info PADDR = 0x08008000                            
rifs_info ADDR = 0x88008000                             
FOUND valid IFS signature                               
FOUND valid RIFS signature                              
FOUND valid RIFS info                                   
FOUND valid IFS signature and RIFS info in RAM.
       
IFS pre checksum = 0x7a82a8f2 (shouldn't be 0x0)       
bootable exec 0 offset: 0x0004bef8                      
bootable exec 0 size: 0x000030b0                        
Uncompressed image paddr_src = 0x00059000               
IFS post checksum = 0x00000000 (should be 0x0)          
PT_LOAD RW: 0004b000 size is 000030b0                   
Found procnto Elf header                                
bootable exec data: offset 0004b000, size 000030b0      
Calculate restore info checksum                                     

Secondary IFS restoration

To build a multiple IFS image, you must create a primary and a secondary IFS. The primary IFS includes only the startup and procnto (kernel). The secondary IFS includes all other libraries and binaries including libc, drivers, and applications.

Here's a sample primary buildfile:

#################################################################
## START OF PRIMARY IFS BUILD SCRIPT for Renesas EDOSK7780 Board
#################################################################
[image=0x88010000]
[virtual=shle/binary +compress] .bootstrap = {
startup-edosk7780 -Dscif..115200.1843200.16 -f400000000 -i0x700000 -vv

PATH=/proc/boot:/ifs2 LD_LIBRARY_PATH=/proc/boot:/ifs2 procnto -vvvv
}

[+script] .script = {
# Default libc symbolic link
#procmgr_symlink ../../proc/boot/libc.so.2 /usr/lib/ldqnx.so.2
# Symbolic link to libc in secondary IFS
    procmgr_symlink ../../ifs2/libc.so.2 /usr/lib/ldqnx.so.2

    display_msg Welcome to QNX Neutrino on the Renesas EDOSK-7780   
    devc-sersci -e -F -x -b115200 -c1843200/16 scif0 scif1 &
    reopen /dev/ser1

    SYSNAME=nto
    TERM=qansi

    [+session] PATH=:/proc/boot:/ifs2 LD_LIBRARY_PATH=/proc/boot:/ifs2 ksh &
}

[type=link] /dev/console=/dev/ser1
[type=link] /tmp=/dev/shmem
###################################################################
## END OF PRIMARY IFS BUILD SCRIPT
###################################################################
Note: The size 0x700000 passed to the -i option was chosen to be much larger than the size of the secondary IFS. Don't make it too large, since memory will be reserved according to this size, and a copy will be made from flash.

The sample secondary buildfile is as follows:

#################################################################
## START OF SECONDARY IFS BUILD SCRIPT for Renesas EDOSK7780 Board
################################################################# 
# Specify the search path, otherwise defaults to x86
[search=${QNX_TARGET}/shle/bin:${QNX_TARGET}/shle/usr/bin:${QNX_TARGET}/shle/sbin:${QNX_TARGET}/shle/usr/sbin:${QNX_TARGET}/shle/lib:${QNX_TARGET}/shle/lib/dll:${QNX_TARGET}/shle/usr/lib]

# Windows mkifs needs to be reminded of permissions
[perms=+x]

# Where the files will be mounted at boot time
[prefix=/ifs2]   

# Libraries to include
[data=copy]
libc.so

# Binaries to include
[+raw data=copy]
cat
devc-sersci
ls
pidin
ksh
echo
###################################################################
## END OF SECONDARY IFS BUILD SCRIPT
###################################################################

Unless the physical address for the source location for the secondary image is specified, IFS Restoration will automatically look for the secondary IFS in flash directly following the primary IFS.

To create an image consisting of both primary and secondary IFS:

# mkifs -v primary.build primary.ifs
# mkifs -v secondary.build secondary.ifs
# cat primary.ifs secondary.ifs > edosk7780.ifs
# mkflashimage

The above example loads a primary IFS and a secondary IFS mounted at /ifs2. The output will look something like:

Press 'd' to download an OS image serially                               
Press any other key to boot from flash    

Press a key other than d.

Downloading from Flash                                                   
ifs2_paddr_dst: 0x0806d000                                               
ifs2_paddr_src: 0x0003a9b0                                               
ifs2_paddr_src (auto): 0x0003a9b0                                        
                                                                         
System page at phys:0800a000 user:0800a000 kern:8800a000                 
Starting next program at v8803c258                                       
Welcome to QNX Neutrino on the Renesas EDOSK-7780 
# ls /proc/boot                                                         
.script    procnto                                                       
                                                                         
# ls /ifs2                                                               
cat     ksh         ls 
echo        libc.so         pidin
devc-sersci     libc.so.2                                                                                

To restore the secondary IFS, modify the options to startup in the primary buildfile (enable secondary IFS restoration, enable checksum):

startup-edosk7780 -Dscif..115200.1843200.16 -f400000000 -i0x700000,K -vv

After rebuilding and burning the updated multiple IFS image to flash, the output will look like:

QNX Neutrino IPL for the EDOSK-7780                                    
Press 'd' to download an OS image serially                                
Press any other key to boot from flash         

Press a key other than d.

Downloading from Flash                                                    
ifs2_paddr_dst: 0x0806d000                                                
Restore IFS2 searching for valid IFS in RAM...
                          
rifs2_info PADDR = 0x08008000                                             
rifs2_info ADDR = 0x88008000                                              
INVALID IFS signature                                                     
Restore IFS2 failed - Reload entire IFS2.
                               
ifs2_paddr_src: 0x0003a9b0                                                
ifs2_paddr_src (auto): 0x0003a9b0                                         
                                                                          
System page at phys:0800b000 user:0800b000 kern:8800b000                  
Starting next program at v8803c258                                        
Welcome to QNX Neutrino on the Renesas EDOSK-7780
#                                                                         

Press the reset button to simulate wake-up:

# QNX Neutrino IPL for the EDOSK-7780                                   
Press 'd' to download an OS image serially                              
Press any other key to boot from flash  

Press a key other than d:

Downloading from Flash                                                  
ifs2_paddr_dst: 0x0806d000                                              
Restore IFS2 searching for valid IFS in RAM...
                        
rifs2_info PADDR = 0x08008000                                           
rifs2_info ADDR = 0x88008000                                            
FOUND valid IFS signature                                               
FOUND valid IFS2 signature and RIFS2 info in RAM.
                     
                                                                        
System page at phys:0800b000 user:0800b000 kern:8800b000                
Starting next program at v8803c258                                      
Welcome to QNX Neutrino on the Renesas EDOSK-7780           
#

To disable the checksum verification on the secondary IFS after it has been restored, modify the buildfile to:

startup-edosk7780 -Dscif..115200.1843200.16 -f400000000 -i0x700000,R -vv

On subsequent boots, you will see the additional output (with debug enabled):

WARNING: Skipped IFS2 checksum verification                                                   

If you don't want to put the primary and secondary IFS together in flash (by using the cat utility), you can put the secondary IFS anywhere in the flash you wish and manually specify its location. Additionally, you can manually specify the location to copy the secondary IFS to in RAM if you don't wish to use the default location. Use the optional arguments to specify the physical address for the secondary IFS source and destination:

To calculate the destination in RAM:

paddr_dst = paddr_start_of_RAM + paddr_location_in_RAM

For example, on the EDOSK7780, there is 128 MB of RAM starting at the address 0x08000000. To put the secondary IFS at the 120 MB location in RAM:

paddr_dst = 0x08000000 + 120 * 1024 * 1024 = 0x0F800000

Note: The destination location in RAM must lie on a 4 KB page boundary. The address passed in is automatically adjusted to ensure this:

paddr_dst = paddr_dst & 0xFFFFF000.

To manually specify the source of the secondary IFS located in flash at 0x00040000:

startup-edosk7780 -Dscif..115200.1843200.16 -f400000000 -i0x700000,0x00040000

To manually specify the source of the secondary IFS located in flash at 0x00040000, and the destination of the secondary IFS in RAM at 0x0F800000:

startup-edosk7780 -Dscif..115200.1843200.16 -f400000000 -i0x700000,0x00040000, 0x0F800000

To manually specify the source of the secondary IFS located in flash at 0x00040000, the destination of the secondary IFS in RAM at 0xF8000000, and enable restoring with checksum:

startup-edosk7780 -Dscif..115200.1843200.16 -f400000000 -i0x700000,K,0x00040000, 0x0F800000