image_setup()
Copy the startup code and OS image into RAM and prepare it for execution
Synopsis:
int image_setup (unsigned long address)
Arguments:
- address
- The address of the image that is to be copied into RAM
Description:
The image_setup() function prepares an image for execution. It
copies the startup code from ROM into RAM where it can execute. It takes the image's
address in ROM as its parameter, and always returns 0
.
This function:
Copies the startup header from the OS image to a startup_header structure.
This copy is necessary to ensure that the correct header information is in the structure, because image_scan() may find multiple images, and may return without updating the header structure with the data for the image which will be passed to image_setup().
- Calculates the address in RAM to which startup is to be copied, based on the ram_paddr and paddr_bias structure members from the startup header.
Fills in the imagefs_paddr structure member, based on where the image is stored.
The startup program doesn't necessarily know where the bootable image is stored, so it relies on the value in imagefs_paddr correctly specifiying the final location in RAM to where the OS image filesystem must be copied.
- Copies the final startup structure to the address in RAM specified by ram_paddr.
- Copies the startup program itself to RAM.
Returns:
- 0
- Always returned