SqueezeOS Internals
From SqueezeboxWiki
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
- Parse /proc/mtd and /proc/cmdline to find the correct partitions for upgrading and to see which mtdset has been booted.
- 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.
- Using md5 checksum the downloaded images.
- Disabled the VOL+ function in the bootloader.
- Write the zImage and root.cramfs files to flash.
- Update ‘kernelblock’ and ‘mtdset’ to switch to the other partition map.
- Enable the VOL+ function to boot to the current running kernel and filesystem.
- Reboot
- 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
Docked Modes
- Active - everything on
- Charging - display backlight on, keypad backlight off
- Entered after 10 seconds of inactivity when docked.
Battery Modes - UnDocked
Screen Dimming: will lower the amount of backlight displayed. When you set it to never, that turns off the 'low' backlight setting only.
Sleep Timeout: when the SBC is out of the Charging Dock, we shut off the backlight in (Max 60) XX seconds. We do this to conserve as much battery life as possible, if we didn't the battery would be dead in a matter of hours. Picking up the device will immediately turn on the backlight. CPU and WiFi are not turned off
Suspend Timeout: can be set higher, (Max 3600 seconds) this setting will put the SBC into the lowest possible power setting. Turning off the CPU and WiFi controllers. The device must be 'woken' from this state.
Suspend Enabled: ON will put the CPU into suspend mode at XX seconds from setting above. OFF will ignore this setting, never putting the CPU to suspend mode.
Wireless Power Save: ON will put the WiFi into suspend mode. OFF will ignore this setting, never putting the WiFi to suspend mode. NOTE: A few Access Points (Home Routers) have issues when WiFi Power Save is enabled if you experience connectivity issues, try turning this setting to OFF. Enabling this setting (default) will result in the best possible battery life for your SBC
- Active - everything on
- Dimmed - display dimmed and keypad backlights off
- Entered after 10 seconds of inactivity when not charging
- Wakes to Active by motion, key event
- Sleep - backlights, screen and audio off. CPU reduced to 50MHz.
- Entered after 1 minute of inactivity when not charging
- Wakes to Active by motion or key event
- Suspend - backlights, screen, wireless and audio off. CPU suspended.
- Entered after 40 minutes of inactivity (no motion, keys) when playing music, 20 minutes when not playing.
- Resumes to Active by motion, key event or docking. The wireless drivers are reloaded, and the network connection restored.
- Power off - everything off.
- Entered when battery level is dangerously low (voltage TODO), following Battery Low warning screen
- Wakes to Active only by charging and pressing the Power (home) key.
- Locked - backlights, screen off
- Entered when user presses special key sequence (VOL+ and VOL- together).
- Screen comes on when GO button is pressed to display instructions for unlocking
- Wakes to Active by special key sequence (VOL+ and VOL- together) to unlock
- Battery check - Controller will partially wake from suspend and check battery status every hour (on the hour) and either suspend or shut down based on battery voltage.
Battery Measurements
Infrastructure Mode
This measurements are when using a wireless Access Point or router.
| Mode | Average mA (1) | Battery life (2) |
| Active | 210 | 5 Hours |
| Dimmed | 120 | 9 Hours |
| Sleep | 59 | 19 Hours |
| Suspended | 10 | 4.6 Days |
| Power off | 0.7 | 2 Months |
(1) Wireless LAN is in power save mode, associated and only background traffic
(2) Calculated, with 90% battery charge
Bridged or Ad-Hoc Mode
This measurements are when bridging using Squeezebox Receiver, an Ad-Hoc network or while not configured to a network.
| Mode | Average mA | Battery life (1) |
| Active | 380 | 3 Hours |
| Dimmed | 290 | 3 Hours 50 Minutes |
| Sleep | 232 | 4 Hours 50 Minutes |
| Suspended | 10 | 4.6 Days |
| Power off | 0.7 | 2 Months |
(1) Calculated, with 90% battery charge
Screenshots
Battery Low warning screen, displayed for a few seconds before the Controller goes into “hibernate”.
Power off screen.



