Showing posts with label flash. Show all posts
Showing posts with label flash. Show all posts

20080708

Prebootmisc for the EEE

I thought I would share a few more of my tricks for utilizing as much of the RAM on my EEE as possible in order to spare the flash memory from excessive write cycles.

So here they are!

In order to minimize writes to flash I would advise adding this line to your /etc/fstab:
tmpfs /tmp tmpfs nodev,nosuid,noexec 0 0
Accordingly, to utilize the ram-based filesystem in /tmp, you can also make some adjustments to portage in /etc/make.conf:
PKGDIR="/tmp/binpkgs"
PORTAGE_TMPDIR="/tmp"
DISTDIR="/tmp/distdir"
Now, in order to prevent certain daemons and applications from vomiting all over you on boot, it's necessary to build a bit of structure in /tmp that such apps expect to find. For that we'll need an init.d entry that starts right after the local filesystems are mounted, but before anything else!

/etc/init.d/prebootmisc:
#!/sbin/runscript
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
need localmount
before logger
before bootmisc
}

start() {
ebegin "Starting prebootmisc"

if [[ -e /etc/conf.d/prebootmisc.start ]] ; then
source /etc/conf.d/prebootmisc.start
fi

eend $? "Failed to start prebootmisc"
}

stop() {
ebegin "Stopping prebootmisc"

if [[ -e /etc/conf.d/prebootmisc.stop ]] ; then
source /etc/conf.d/prebootmisc.stop
fi

eend $? "Failed to stop prebootmisc"
}


# vim:ts=4
/etc/conf.d/prebootmisc.start:
if [ ! -h /var/cache/edb ]; then
rm -Rf /var/cache/edb && cd /var/cache && ln -sf ../../tmp/cache/edb edb
fi
mkdir -p /tmp/cache/edb
mkdir -p /tmp/{portage,binpkgs,distdir}
if [ ! -h /var/log ]; then
rm -Rf /var/log && cd /var && ln -sf ../tmp/log log
fi
mkdir -p /tmp/log/{gdm,samba,sandbox,news,cups}
Now just run the following commands to add prebootmisc to the boot runlevel
chmod +x /etc/init.d/prebootmisc
rc-update add prebootmisc boot
There is 1 catch that I've found after months of use - if your bootmisc is set to WIPE_TMP (wipe_tmp for openrc users), then it will destroy the directory structure that prebootmisc created. My suggestions are 1) disable wipe_tmp which is useless anyway if /tmp is a ram filesystem, 2) rename the service postbootmisc and change depends to have after bootmisc, if you really want /tmp to be wiped before it is mounted tmpfs.

After rebooting the machine you should find that many applications run faster and do much fewer write cycles to flash, preserving the longevity of your flash root filesystem.

To get Firefox to utilize /tmp as your cache (you will lose your cache after /tmp is unmounted), open firefox, navigate to about:config, and set this line:
browser.cache.disk.parent_directory /tmp
If you're a gnome user, you might also find it helpful to add the System Monitor applet to your panel and activate the disk monitor utility. I've changed my read indicator to a safe green colour and my write indicator to red. That way, whenever I'm using an application that is abusing my flash filesystem I'll see a red spike in the System monitor and I'll I know that I'll have to adjust the preferences for that app to use /tmp.

I hope this has helped speed up applications and spare the life of your flash and speed up your EEE!

20080707

Running C and Python Code on The Web

Although I'm not a big fan of programming or web applications, this post sounds quite interesting.

20071020

My Ideal Laptop

It's come to the point that I'm considering upgrading my laptop - but I haven't seen anything on the market that's ideal for me. If you know me personally, you would know that I have been a bit of an environmental nut since I was 10 years old, and that I am also an electrical engineer, embedded systems engineer, and completely obsessed with Linux. As such, I have some pretty interesting ideas of what the 'ideal laptop' would mean to me.

My ideal laptop would be one that is highly portable, environmentally friendly, and energy efficient but with a fair bit of number-crunching and graphics processing power. It should not be assembled or manufactured by poorly treated employees either. My final and least-likely-to-be-realized preference is that my ideal laptop would also be one that could be tracked if stolen[2]. It also goes without saying, that my ideal laptop would utilize hardware with open-source drivers so that one would not be stuck with any inferior, proprietary operating systems.

Throwing all of those ingredients into one pot makes for a fairly difficult main course. The question is, which company will possess the techno-culinary expertise to prepare the appetizers?

There has been much more debate and demand for environmentally friendly computing products than someone from an older generation would think[1]. However, many of the Y-Generation were brought up during the 80's when the environmental movements really began to boom and, therefore, have a much more intrinsic concern about environmental impacts.

On the other hand, the anti-theft system (ATS) is still a relatively new concept. I have personally taken it opon myself to design an personal area network (PAN) ATS for valuables such as electronics or cycles, but between my engineering job, my master's education, and now my baby on the way, I no longer have a plethora of free time for dreaming up gadgets and new designs.

If you can suggest a laptop that is currently on the market today that has similar specifications to those below, please let me know.
If you would like to see a company producing laptops with the specifications below, let your voice be heard & submit a comment.

Mechanical Specs:
  • 12 or 13" Display, ACPI-compliant, with multi-level dimming capabilities
  • Light-weight, aluminum chassis
  • Very quiet, as quite as a MacBook
  • Overall maximum weight of 3.5 lbs ( without AC adapter)
  • Magnetic AC power connector
  • Light-weight, biodegradeable, non-plastic casing.
Core Features:
  • Dual-Core Processor ~ anywhere from 1 to 2 GHz (frequency stepping is a must)
  • 1GB of DDR SDRAM, expandable to perhaps 4GB
  • A graphics chip w/ 64 MB of dedicated DDR SDRAM
Storage:
Networking:
  • 802.11 a/g Wireless
  • 2.1 Bluetooth
  • 10/100 Mbit or Gigabit Ethernet
Peripheral Ports:
  • 4 USB 2.0 connections, with 2 having power distribution capabilities
  • s-video (or something similar) for input / output
  • audio input / output connections
Sensors:
  • Built-in microphone
  • Built-in 2 mega pixel camera
  • GPS receiver
Green Characteristics:
  • Full ACPI Compliance and sleep states for all devices
  • Longer battery life ( please, no optical or magnetic drives )
  • Biodegradeable, non-plastic casing ( corn-based ?)
  • Lead-free chipsets ( possibly free of other toxins as well )
  • AC power adapter with auto-off capabilities and magnetic connector
  • Built-in RFID chip for easy component identification during recycling
Security Features:
  • Built-in biometric sensor (BMS) for secure user authentication (i.e. thumb print)
  • Built-in RFID chip, for anti-theft-system (ATS) / tracking
  • Built-in GPS receiver, for ATS and user application
  • Built-in GPRS data-only transceiver for ATS and user application
  • Secure-bus lines (internal PCB layer, covered vias) for ATS, DRM[3], BMS

If you have any suggestions of something that is currently on the market that closely matches these specifications, aside from the OLPC[4], please submit a comment.

Alternatively, if you would like to hire me as an engineer to design such a laptop please let me know.

[ Update: 20071118 ]
Here is some info from the IEEE regarding standards for greener consumer electronic devices.

List of Similar Laptops & Shortcomings

Dell Latitude D430:

If one navigates to the Dell site and selects the small business / notebook links, one would notice that there is a small image that says 'Windows XP Optional'. When the visitor proceeds to customize the notebook, Windows XP is, in fact, non-optional. Dell, take off whatever the price is of Windoze these days and offer an operating system free and / or Linux installation. Then I might consider buying this notebook.

Dell, I do very much respect the step forward by offering solid-state media instead of magnetic storage. Although the $1000 jack in price seems unfounded, especially when
Transcend has such excellent deals on a solid state disk at the moment, like the ones here and here. At any rate, if I could purchase this notebook without Windows and without an internal optical drive, then it would be a done deal, and I would just buy the flash disk from Transcend.

Apple MacBook:

I really like the MacBook, although the case material is plastic and I've heard horrible things about the Nazi-esque factories where Apple assembles the iPods in China... of course that hasn't stopped thousands upon thousands of people from buying Apple products in the past. I bought my iPod used ;-)

The MacBook is good because it has a dual-core Intel chip running at 2GHz. The screen-size is also a modest 13", which makes for a very portable notebook computer. A few friends of mine have one of these babies, and I very rarely ever feel the machine get hot, and the fan is as quiet as a mouse. The MacBook has a very decent battery life and also has great power management.

Putting Gentoo Linux on a MacBook is also very possible, but can cause conflicts with the Mac OS X. What I would most likely do, is completely remove the Mac Hard disk, and add a Trancend SATA solid-state-disk of 32 GB in size instead. Then I would have the original Mac disk image available if I ever needed to use it and I could format the original magnetic SATA disk and use it externally.
I think that I remember reading a rumor about Apple launching a product targeting at the Japanese market with an SDD and no optical drive. Hopefully that happens soon and they decide to expand to western markets as well.

Since I am attending a university in Germany, I would receive a 10% discount at the Apple.de Educational Store. The student discount in Germany is even more of a deal than that in Canada, after considering taxes.


[1] Some articles about environmentally friendly computing, going as far back as 1998:
Toshiba Satellite 2510, Asus U5, Wal-Mart & Toshiba, OLPC, Consumer Demands

[2] I claim prior art to some of these device specifications going back for several years if a patent lawsuit ever arises.

[3] In full awareness of the current anti-DRM movement, I still feel that artists should be able to protect their works in an open, but still technologically secure manner. My position on DRM is that publically free media should still function on a system that is DRM-compatible, as should DRM-impaired media.

[4] I am in no way knocking the OLPC project, and feel that it's a pioneering endeavor that all manufacturers should strive to match, in terms of energy efficiency. The plastic casing, on the other hand, is a bit of a minus.