<?sphp $this->text('pagetitle') ?>
 
Home of the Squeezebox™ & Transporter® network music players.

SqueezeOS Internals

From SqueezeboxWiki

Revision as of 04:25, 28 March 2011 by Soulkeeper (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Firmware Layout & Upgrade

Flash partitions

Begin	        End           Partition
0x00000000	0x00028000    uboot
0x00028000	0x0002c000    uboot env 1
0x0002c000	0x00030000    uboot env 2
0x00030000	0x00200000    zimage A
0x00200000	0x01600000    cramfs A
0x01600000	0x017d0000    zimage B
0x017d0000	0x02bd0000    cramfs B
0x02bd0000	0x03fd0000    yaffs

Uboot

This is the bootloader binary. It is installed in the factory and won't be upgraded in the field. This partition is not visible from Linux.

Uboot env 1 & 2

This is the bootloader environment variables. Dual partitions are used to provide redundancy for this data. This data is accessible in linux using the fw_printenv and fw_setenv commands.

zimage A / cramfs A

The bootable kernel and filesystem in the lower area of the flash. These images are always used together.

zimage B / cramfs B

The bootable kernel and filesystem in the upper area of the flash. These images are always used together.

yaffs

A read/write flash filesystem. This is mounted using an overlay filesystem over the current cramfs root filesystem allowing any files to modified. A factory reset will clear the yaffs filesystem restoring the Controller to an unmodified state.

Boot Process

The uboot environment variables control which image gets booted. The ‘kernelblock’ variable points to the flash block containing the kernel (c or 850) and the ‘mtdset’ variable is passed to the kernel to control the flash partitions. The running kernel and filesystem are mounted in the flash as read-only partitions. The spare kernel and filesystem are mounted as read-write partitions.

Upgrade process

  1. Parse /proc/mtd and /proc/cmdline to find the correct partitions for upgrading and to see which mtdset has been booted.
  2. Download the firmware using a url, either over the net or from sd card. The jive.bin file is really a zip file, this is decompressed and the files stored in /tmp.
  3. Using md5 checksum the downloaded images.
  4. Disabled the VOL+ function in the bootloader.
  5. Write the zImage and root.cramfs files to flash.
  6. Update ‘kernelblock’ and ‘mtdset’ to switch to the other partition map.
  7. Enable the VOL+ function to boot to the current running kernel and filesystem.
  8. Reboot
  9. On reboot detect that the jive version has changed and clean up the yaffs filesystem (this is still a TODO).

The u-boot bootloader looks for keys presses on boot. If any keys are pressed it trys to run the command “run swX” where X is the key number. By defining “swX” in the bootloader environment different commands can be run.

By default pressing ADD on boot will perform a factory reset.

Pressing VOL+ is enabled by the upgrader.

MAC Address & Serial Number

The device’s MAC address and serial number can be stored in the uboot environment variables. U-boot and the fw-setenv programs only allow these values to be written once. The MAC address is passed to the kernel on boot, and the /etc/init.d/wifi-init script parses this address from /proc/cmdline and reconfigures the wlan card.

To set a MAC address in u-boot use:

setenv ethaddr 00:12:34:xx:xx:xxsaveenv

To set a MAC address in linux use:

fw-setenv ethaddr 00:12:34:xx:xx:xx

To clear all addresses to allow the board to be reprogrammed then in u-boot do:

nande a 4096

Controller Power Saving Modes