This shows you the differences between two versions of the page.
— |
sw:debianembedded [d-m-Y H:i] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Embedded Debian ====== | ||
+ | [[http://www.nope.tv/article225.html|This page]] was used as a starting point, and then heavily modified. | ||
+ | |||
+ | ===== Installation ===== | ||
+ | |||
+ | Do a standard [[Debian]] installation to the drive. The kernel argument **ide=nodma** may be required, depending on the CF device used. | ||
+ | |||
+ | ===== Ram Disks ===== | ||
+ | |||
+ | Some filesystems should be mounted as ramdisks to minimize writes to the CF device. Add these lines to **/etc/fstab**. | ||
+ | |||
+ | tmpfs /var/run tmpfs defaults 0 0 | ||
+ | tmpfs /var/lock tmpfs defaults 0 0 | ||
+ | tmpfs /var/log tmpfs defaults 0 0 | ||
+ | tmpfs /tmp tmpfs defaults 0 0 | ||
+ | |||
+ | ==== preinit ==== | ||
+ | |||
+ | Since these filesystems need to be mounted before **/sbin/init** starts launching services which need to access them, we need to run a helper script before **/sbin/init**. Create the following file as **/sbin/preinit** and set it's permissions to **755**. | ||
+ | |||
+ | #!/bin/bash | ||
+ | | ||
+ | echo "Disable DMA" | ||
+ | hdparm -d0 /dev/hda | ||
+ | echo "Enable some power management and disable spindown" | ||
+ | hdparm B64 -S0 /dev/hda | ||
+ | echo "Enable 32-bit I/O" | ||
+ | hdparm -c3 /dev/hda | ||
+ | | ||
+ | echo "Creating tmpfs in /var/log" | ||
+ | mount -n -t tmpfs tmpfs /var/log | ||
+ | echo "Copy /var/log" | ||
+ | cp -a /var/log_persistent/* /var/log | ||
+ | | ||
+ | echo "Creating tmpfs in /var/run" | ||
+ | mount -n -t tmpfs tmpfs /var/run | ||
+ | echo "Copy /var/run" | ||
+ | cp -a /var/log_persistent/* /var/log | ||
+ | | ||
+ | echo "Done, resume normal operations..." | ||
+ | exec /sbin/init | ||
+ | |||
+ | ==== GRUB ==== | ||
+ | |||
+ | Add **init=/sbin/preinit** to the kernel options in **/boot/grub/menu.lst** to tell the kernel to run the preinit script at boot. | ||
+ | |||
+ | |||
+ | |||
+ | ===== ACPI ===== | ||
+ | |||
+ | The ACPI subsystem will try to turn DMA back on, which will cause intermittent issues. | ||
+ | |||
+ | Edit **/etc/acpi/sleep.sh** and change the hdparm lines with **-d 1** to **-d 0**. |