Design Issues and Solutions for Embedded Linux Systems - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

Design Issues and Solutions for Embedded Linux Systems

Description:

Fully integrated and customisable desktop environment. Java Runtime Environment ... var/, /home, man pages, doc, unused wallpapers, themes etc ... – PowerPoint PPT presentation

Number of Views:89
Avg rating:3.0/5.0

less

Transcript and Presenter's Notes

Title: Design Issues and Solutions for Embedded Linux Systems


1
Design Issues and Solutions for Embedded Linux
Systems
  • Shanker Balan
  • Exocore Consulting
  • Bangalore
  • http//shankerbalan.com/

2
Client Hardware
  • Intel PIII/PIV Processor
  • Mini-ITX Motherboard (VIA/Intel Chipset)
  • 256MB SDRAM
  • 128MB / 256MB DiskOnChip Storage Module
  • AC97 Compatible Sound Chipset
  • Conexant Soft Modem
  • CDROM / DVD Drive
  • USB Pen Drive

3
Feature Request
  • Fully integrated and customisable desktop
    environment
  • Java Runtime Environment
  • Browser, Messenger and Word Processor
  • Media Player
  • File Manager with SMB Browsing Support
  • XDMCP and RDP Support

4
The Big Plan
  • Choose a distribution
  • Find a suitable Compression method (cramfs,
    cloop)
  • rootfs on ramdisk
  • Build custom kernel and write bootup scripts
  • Create a core distribution and build around it

5
Debian The Distribution Of Choice
  • Mix of testing And unstable
  • Testing for base packages (libs and tools)
  • Unstable for user applications (GNOME)
  • Advantages
  • Powerful package management tools (dpkg, apt-get)
  • Low cruft and minimalistic approach to package
    creation
  • Customisable - dpkg reconfigure,
    /etc/alternatives etc
  • Exhaustive package collection (8000)

6
Building the core
  • Do 2 Debian installs on seperate partitions on
    the target hardware
  • Regular install for a build environment with
    compiler
  • Base only install for core
  • Under build
  • mount /mnt/core chroot /mnt/core /bin/sh
  • apt-get update apt-get install foo
  • Configure GRUB to boot build and core
  • Boot into core for testing

7
Building Custom Kernel
  • Target platform is x86, not much effort needed
  • From build, cd /usr/src/linux/
  • make menuconfig. Note ext2 and iso9660
    should not be modules
  • Use make-kpkg to build kernel package and extra
    modules (if any)
  • Build cloop as module
  • Install new kernel in core and build
  • dpkg -i custom_kernel.deb
  • Boot into new kernel and test

8
Image Compression
  • Compress core to lt size of flash device
  • Cramfs has file size limitation. Use cloop
  • apt-get install cloop-utils
  • cd /mnt/core
  • mkisofs -R -l -V "Debian -hide-rr-moved -v
    -exclude-list mkisofs.exclude .
    create_compressed_fs - 65536 gt ../CORE
  • Test compressed image
  • insmod cloop file/mnt/CORE
  • mount -r /dev/cloop /mnt/cloop

9
Space Saved is Space Earned
  • mkisofs.exclude
  • /var/, /home, man pages, doc, unused wallpapers,
    themes etc
  • Use localepurge to remove superfluous locale
    data
  • Keep only misc and TrueType font packages

10
Make Flash Device Bootable
  • Appears as a regular IDE drive
  • mke2fs -m0 /dev/hdc1
  • mount /dev/hdc1 /mnt/flash
  • mkdir /mnt/flash/boot
  • cp /vmlinuz /mnt/flash/boot/
  • Install boot record using GRUB/LILO
  • Configure splash screen for eye candy

11
The Ramdisk
  • Ramdisk provides
  • Provides a / like environment
  • R/W /home area, /tmp and /var
  • /linuxrc init script for setting up a suitable
    environment
  • Mounts cloop image
  • Create symlinks to /cloop for all binaries (/etc,
    /bin, /sbin/, /usr etc)
  • Run init
  • Transfer control to compressed Debian

12
Creating The Ramdisk
  • dd if/dev/zero oframdisk bs1k count2880
  • mke2fs -m0 -Fq -b 1024 -N 8192 ramdisk
  • mkdir /mnt/ramdisk
  • mount -o loop,rw ramdisk /mnt/ramdisk
  • Copy static sh and linuxrc script, cloop module
    etc
  • umount /mnt/ramdisk
  • gzip -9 ramdisk

13
Things to put into the Ramdisk
  • /dev entries, /static/sh,init (BusyBox),
    /modules/cloop.o
  • /linuxrc
  • Set PATH /static
  • Mount proc and devpts
  • Mount -t ext2 -r /dev/hdc1 /mnt/flash
  • Insmod cloop and mount compressed CORE
    /compressed
  • Copy the library cache ld.so.cache and set
    symlinks to /compressed

14
/linuxrc
  • Set PATH to "/sbin/bin/usr/sbin/usr/bin/usr/X1
    1R6/bin." hash -r
  • Clean Up! rm -rf /modules /static
  • Create a nMB tmpfs RamDisk
  • mount -t tmpfs -o "size10000k" ramdisk /ramdisk
  • Point /home, /var etc to /ramdisk
  • exit 0 to start init
  • Init now follows /etc/inittab

15
RamDisk Gotchas
  • Use small block size and high inode count when
    formatting
  • Certain services wont work with symlinked /etc/.
    Use cp for those.
  • Bigger ramdisk less free RAM

16
Automate! Automate! Automate!
  • Create Makefile targets
  • make kernel
  • make ramdisk
  • make boot
  • make compressed ...

17
The Desktop Experience
  • Desktop Environment
  • GNOME2/Gtk2 or KDE3/Qt3?
  • We chose GNOME2
  • Clean desktop interface
  • Usual eye candy
  • Most of the apps (Gaim, Abiword) uses Gtk
  • I am biased towards Gtk applications
  • Gconf2 based framework makes setting user
    defaults very easy

18
USB HotPlug Support
  • apt-get install hotplug
  • Add Disk Mounter applet to GNOME2 Panel
  • Clicking on the applet would mount the drive as
    vfat and open the file manager
  • User uses the USB drive for permenant storage

19
The Final Product
  • Original Size 500MB
  • Compressed Size 90MB
  • Kernel 2.4.22 Xfree86 4.3.0
  • GNOME 2.4.1 Gaim 0.71
  • Mozilla 1.5 Abiword 2.0.0
  • Rdesktop
  • core is now feature frozen

20
What Next?
  • Value Add
  • core Java
  • core OpenOffice
  • core Insert Application Here
  • cp -r /mnt/core /mnt/corejava
  • chroot /mnt/corejava /bin/sh
  • apt-get install jre exit
  • make compressed
  • TaDa!

21
Resources
  • http//www.debian.org
  • Thank you!
Write a Comment
User Comments (0)
About PowerShow.com