TS-4710 Initrd / Busybox: Difference between revisions

From embeddedTS Manuals
No edit summary
No edit summary
Line 32: Line 32:
|-
|-
| 5
| 5
| Disable Network Autoconfiguration
| Disable Network Autoconfiguration <ref> Default will bring up the network interface with link-local addressing (ipv4ll), and a virtual interface (eg, eth0:0) with a dhcp address.  The ipv4ll address will come up almost immediately and resolve as long as zeroconf is working.  The DHCP interface can take several seconds to resolve depending on the DHCP server present on the network.</ref>
|-
|-
| 6
| 6
Line 54: Line 54:
tshwctl --removejp=1
tshwctl --removejp=1
</source>
</source>
Many applications are capable of running from the initramfs.  Even though the full Linux root has not booted at this point, $PATH and symlinks make it possible to run many applications.  The default initramfs startup script will execute "/ts/init" in the Linux Root which can be used for any initialization that is required.  When executing in this environment there are several differences from Debian:
* The second partition is mounted at /mnt/root/ as read only
** You can mount this as read/write with:
<source lang=bash>
mount -o remount,rw /mnt/root/
# Write data
mount -o remount,ro /mnt/root/
sync
</source>
** Make sure the SD card is mounted read only when the write is complete to avoid corruption caused by unplanned power outages.  Interrupting a write to the SD card can cause corruption.
* $PATH is set up to use /bin:/sbin:/mnt/root/bin:/mnt/root/sbin:/usr/bin:/usr/sbin.
* Do not use apt-get in this environment.  This is not where the Debian/OE install scripts are intended to run and will have unintended side effects.  You can type "exit" to do a full boot to run these utilities.
* The shell is using busybox sh which is optimized for size so many utilities do not implement all options as the GNU alternative.  Many times the best documentation for these utilities is in the comments in the utilitys' [http://git.busybox.net/busybox/tree/ source code].  The other option is to call the full Linux utility by full path.  For example, to call Debian's "ls" utility you would use /mnt/root/bin/ls.

Revision as of 11:32, 22 April 2013

When the board first boots up you should have a console such as:

>> TS-BOOTROM - built Jan 21 2013 16:17:55
>> Copyright (c) 2012, Technologic Systems
.
.
Uncompressing Linux... done, booting the kernel.
Booted in 0.67 s
Type 'tshelp' for help

This is a minimalistic initial ram filesystem that includes our specific utilities for the board, and is then used to bootstrap the Linux root. The initramfs is built into the kernel image so it cannot be modified without rebuilding the kernel, but it does include 8 bits for common configuration option we call soft jumpers.

Soft Jumpers
Jumper Function
1 Boot automatically to Debian [1]
2 Baseboard Specific
3 Baseboard Specific
4 Read Only mode [2]
5 Disable Network Autoconfiguration [3]
6 Reserved
7 Reserved
8 Skip full DRAM test on startup [4]
  1. initramfs boot is default
  2. The read only mode creates a unionfs where the full Linux root is mounted read only, and a tmpfs is mounted read/write. This allows services to run that require write access, but doesn't commit any changes to disk. This can be used to protect your application from corruption caused by sudden poweroffs.
  3. Default will bring up the network interface with link-local addressing (ipv4ll), and a virtual interface (eg, eth0:0) with a dhcp address. The ipv4ll address will come up almost immediately and resolve as long as zeroconf is working. The DHCP interface can take several seconds to resolve depending on the DHCP server present on the network.
  4. The DRAM test can be used to verify the RAM, but adds approximately 20 seconds to the boot time. This should normally only be enabled when diagnosing problems.

There are 2 ways to manipulate soft jumpers on the board. The web interface at "http://ts4710-<last 6 chars of the MAC" has a list of checkboxes that will immediately change the values. You can also use tshwctl:

# Boot automatically to Debian:
tshwctl --setjp=1

# Or revert to the initramfs:
tshwctl --removejp=1

Many applications are capable of running from the initramfs. Even though the full Linux root has not booted at this point, $PATH and symlinks make it possible to run many applications. The default initramfs startup script will execute "/ts/init" in the Linux Root which can be used for any initialization that is required. When executing in this environment there are several differences from Debian:

  • The second partition is mounted at /mnt/root/ as read only
    • You can mount this as read/write with:
mount -o remount,rw /mnt/root/
# Write data
mount -o remount,ro /mnt/root/
sync
    • Make sure the SD card is mounted read only when the write is complete to avoid corruption caused by unplanned power outages. Interrupting a write to the SD card can cause corruption.
  • $PATH is set up to use /bin:/sbin:/mnt/root/bin:/mnt/root/sbin:/usr/bin:/usr/sbin.
  • Do not use apt-get in this environment. This is not where the Debian/OE install scripts are intended to run and will have unintended side effects. You can type "exit" to do a full boot to run these utilities.
  • The shell is using busybox sh which is optimized for size so many utilities do not implement all options as the GNU alternative. Many times the best documentation for these utilities is in the comments in the utilitys' source code. The other option is to call the full Linux utility by full path. For example, to call Debian's "ls" utility you would use /mnt/root/bin/ls.