Overview of Balsa on a Windows Host

From LSDevLinux
Jump to: navigation, search


This page tells you how a Balsa Prototype is set up on a Windows system. It contains information for a someone in a technical support role. There is a similar page for Linux: Overview of Balsa on a Linux Host.

There is a separate page with instructions for setting up a machine to run Balsa.

The Working Balsa System

Once the Balsa system is booted (#The Balsa Boot Process is described below), the Balsa SD card is the main system device. The card contains the operating system and all the Balsa applications, comparable to the C:\Program Files, C:\ProgramData and C:\Windows directories on a Windows system. The Balsa system is on the BalsaRoot partition on the SD card. This partition is not visible to Windows. Also, it is not a bootable partition.

The Balsa data and configuration files (similar to C:\ProgramData; C:\Users and C:\Documents and Settings in Windows) are contained within a loop mounted file, C:\balsafiles.img. A loop mount in Linux is a process where a single file contains a file system. This is similar to a Virtual Hard Disk in Windows 7.

Files and Directories that Balsa sets up on a Windows Host

Files created by Balsa Set-up

When Balsa is set up, it copies or creates a number of files and directories on the Windows host:

  1. C:\grldr, C:\grldr.mbr and C:\menu.lst are used in the Balsa booting process. C:\grldr and C:\grldr.mbr contain a Grub4dos boot loader. C:\menu.lst is a customized configuration file that tells the Grub4dos boot loader where the needed files are on the Windows host.
  2. C:\BalsaBoot is the directory that contains files used in the Balsa booting process, and snapshots to restore the original Windows boot. Specifically:
    1. C:\BalsaBoot\vmlinuz and C:\BalsaBoot\initrd are files that the Balsa boot process uses to reboot to the SD card.
    2. C:\BalsaBoot\ConfigureBalsaBoot.cmd is an interactive script to toggle the Balsa menu item in the Windows boot menu or remove it entirely.
    3. C:\BalsaBoot\drive2id.exe is a program that the Balsa set-up uses to identify drives on the Windows host. Some antivirus programs will block this program.
    4. C:\BalsaBoot\Bcd_Backup_before_Balsa contains a snapshot of the boot configuration before the Balsa set-up. This snapshot is restored when Balsa is removed or turned off.
    5. C:\BalsaBoot\Bcd_Backup_after_Balsa contains a snapshot of the boot configuration after the Balsa set-up. This snapshot is restored when Balsa is turned on.
    6. C:\BalsaBoot\Bcd_Backup_before_Balsa.LOG*, C:\BalsaBoot\Bcd_Backup_after_Balsa.LOG* are log files created by the BCDEDIT program.

Data Files Created by Balsa

The first time Balsa runs on Windows it creates a data file and a directory. By default, it is on C:\. see Setting Up Balsa on a Windows Computer to place it elsewhere.

  1. C:\balsafiles.img is a Windows file containing a Linux file system that has the user's data and configuration information. The balsafiles.img file is created when you run Balsa for the first time.
  2. C:\balsafiles\ is a mount point for the Linux file system contained in the file C:\balsafiles.img. It will always be empty.
  3. C:\balsaswap.img is a swap file for the Balsa system. It is 512 Mbytes by default.

Contents of C:\balsafiles.img

For details of what changes inside C:\balsafiles.img, read this section of the Linux Host Overview.

The Balsa Boot Cycle on a Windows Host

The Balsa set-up a Windows is designed to make minimal changes to the Windows system. Neither the BIOS settings, nor the MBR are changed by a Balsa set-up.

The Balsa Boot Process

The Balsa boot takes place in three phases, a) booting to the Windows Boot; b) executing the GRUB4DOS boot; c) reboot using the Balsa SD card. Here are the gory details:

  1. Boot to the Windows Boot program. If you choose the Windows entry, The boot continues to a regular Windows boot.
  2. When you choose the Balsa entry, it boots using the GRUB4DOS files C:\grldr and C:\glrld.mbr
  3. C:\grldr reads C:\menu.lst to find the location of the Balsa initial boot files. These are normally C:\BalsaBoot\vmlinuz and C:\BalsaBoot\initrd, as specified in the first parameters of the kernel and initrd.img lines of C:\menu.lst.
  4. Boot using vmlinuz & initrd.img. The following boot parameters are passed on the kernel line:
    1. The BalsaRoot partition is specified by its partition label.
    2. The location of the balsafiles.img is specified by the UUID as found by drive2id.exe.
    3. A panic=20 parameter tells the boot process to reboot after 20 seconds if the boot process is aborted. This usually happens because the Balsa SD card is not present, so the BalsaRoot partition isn't found. It can also happen if the C:\BalsaBoot\vmlinuz & C:\BalsaBoot\initrd.img don't contain the proper driver for the SD card.
  5. vmlinuz & initrd.img will transfer control to the vmlinuz-... & initrd.img-... files in the /boot directory of the BalsaRoot partition on the SD card. The kernel line parameters are passed on. The boot process from this point on is a regular Ubuntu boot using the SD card as the system device.
  6. Loop mount balsafiles.img onto the C:\balsafiles mount point. In the Balsa file system, this point is /run/balsahost/balsafiles.
  7. If it doesn't already exist, create /run/balsahost/balsafiles/uuid a file containing a unique identifier for the set of files contained in balsafiles.
  8. If it doesn't already exist, create a swapfile named balsaswap.img of 512 Mbytes at /run/balsahost/balsaswap.img This translates into C:\balsaswap.img.
  9. Bind mount /run/balsahost/balsafiles/home to /home, making the files in the /home directory of balsafiles.img the home directory.
  10. Do other hardware specific configuration, based on screen size and machine architecture.
  11. Display the Balsa log-in screen and allow the a log-in into either the Balsa User account or Advisor account. You can perform a terminal session at this point (or later) by typing <CTRL-ALT-F1> through <CTRL-ALT-F6>.
  12. Execute the shortcuts in the ~/.config/autostart directory.

Modifying the Boot Process

Turning Balsa On/Off and Removing Balsa from the Window Host

Running C:\BalsaBoot\ConfigureBalsaBoot.cmd as Administrator displays a menu:

1. Remove Balsa from the Windows Boot Sequence.
2. Remove Balsa User Data and Configuration.
      (If you want both #1 and #2, choose #2 first)
3. Turn Off Balsa in the Windows Boot (but available to turn on)
4. Turn On Balsa (Undo #3)
5. Adjust Boot Timeout

Select which one you want to do.

If you want to remove the user data and mount point (#2) do that before you remove Balsa (#1).

When you remove Balsa, the script deletes the GRUB4DOS files and the C:\BalsaBoot\ directory. It leaves the C:\balsafiles.img and the C:\balsafiles mount point.

Other Advanced Configurations

More information is available on the page Other Advanced Balsa Configurations