tag:blogger.com,1999:blog-133869452024-03-14T16:33:34.677+02:00idle();Some things I do when I am not working...Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.comBlogger18125tag:blogger.com,1999:blog-13386945.post-12162122546064446582020-07-17T00:10:00.002+03:002020-07-17T15:25:47.603+03:00Splitting .gitconfig based on project<div>I keep my personal projects separate from my work-related projects in git. This requires remembering what I'm currently working on and applying that <i>profile</i> to the commits, git_template, etc.</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhjPnD71IgSK1VNWosU2-Brsnh5JvDfHs0ATh3IeHLegrHBRaGHtun93eFdKnU-ALKrW6TMPz2-40umgdVdVhLgRuw7kLsD8OGst7RJS3083rQ4LKeA4XPQGdZZH5e-a3Cnp3c/s4032/IMG_20191223_142412.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="4032" data-original-width="3024" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhjPnD71IgSK1VNWosU2-Brsnh5JvDfHs0ATh3IeHLegrHBRaGHtun93eFdKnU-ALKrW6TMPz2-40umgdVdVhLgRuw7kLsD8OGst7RJS3083rQ4LKeA4XPQGdZZH5e-a3Cnp3c/s320/IMG_20191223_142412.jpg" /></a></div><div><br /></div><div><br /></div>I recently learned about a new git configuration feature called <a href="https://git-scm.com/docs/git-config#_conditional_includes" target="_blank">conditional includes</a>. It allows one to split out project/folder/branch-specific git configuration into its own .gitconfig fragment.<div><br /></div><div>This allowed me to get rid of bash functions that setup my git configuration (e.g. GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL) depending on what I was working on.</div><div><br /></div><div>So I ended up with the following <font face="courier">~/.gitconfig</font>:</div><div><br /></div><div><div><font face="courier">[user]</font></div><div><font face="courier"> name = Amit Kucheria</font></div><div><font face="courier">[includeIf "gitdir:~/work/sources/"]</font></div><div><font face="courier"> path = ~/.gitconfig-linaro</font></div><div><font face="courier">[includeIf "gitdir:~/work/sources/personal/"]</font></div><div><font face="courier"> path = ~/.gitconfig-personal</font></div></div><div><br /></div><div><br /></div><div>My ~/.gitconfig-linaro looks like this:</div><div><div><font face="courier">[user]</font></div><div><span style="font-family: courier;"> email = "amit.kucheria@work.com"</span></div></div><div><div><br /></div><div>My ~/.gitconfig-personal looks like this:</div><div><div><font face="courier">[user]</font></div><div><span style="font-family: courier;"> email = "amit.kucheria@personal.com"</span></div></div><div><br /></div></div><div>One thing to remember, the order of the <font face="courier">includeIf</font> statements matter! They should be ordered from generic to more-specific directories if like me, all your sources live in a single folder. If the order in the above snippet were reversed, you'd always end up using the <font face="courier">.gitconfig-linaro</font> configuration.</div><div><br /></div><div>One less thing to remember to set as I switch between work and personal projects.</div>Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com0tag:blogger.com,1999:blog-13386945.post-46609281278089044192020-02-11T12:46:00.002+02:002020-02-11T12:46:42.929+02:00Rabbit holes in HW Lab automation<div dir="ltr" style="text-align: left;" trbidi="on">
This post is a reminder about rabbit holes one goes down when working on technical problems.<br />
<br />
Some time ago, I received an Inforce IFC6410 to add to my testing while I modernize the thermal sensor driver found on many Qualcomm platforms. This is a fairly old Snapdragon 600 SoC and isn't being tested in any of the <a href="http://kernelci.org/">kernelci.org</a> labs leading to a patch recently getting merged that broke the thermal sensor on the board.<br />
<br />
I figured I'd wire it up to my board automation setup - a glorified mess of an ATX PSU, a <a href="https://www.yepkit.com/product/300110/YKUSH3">switchable USB hub</a> and an 8-port <a href="https://www.robot-electronics.co.uk/htm/eth008tech.htm">relay</a> - that automates the toggling of power and vbus to a board to allow for automated kernel flashing and testing.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj04KWfX6zaXarPH_ECmxt_9qG1q6Evoehsmeuj3U7DSGFwf2EqlKTyN-3YFbflgk7gQ7n6MgeXZU0FAjnrZGDESWk15rMVeWw4g_pITHvZAiivYMMBXb5E9Fy4s1YhPr0yj-fP/s1600/IMG_20200113_141454.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="HW Lab" border="0" data-original-height="1600" data-original-width="1185" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj04KWfX6zaXarPH_ECmxt_9qG1q6Evoehsmeuj3U7DSGFwf2EqlKTyN-3YFbflgk7gQ7n6MgeXZU0FAjnrZGDESWk15rMVeWw4g_pITHvZAiivYMMBXb5E9Fy4s1YhPr0yj-fP/s640/IMG_20200113_141454.jpg" title="HW Lab" width="473" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">HW Lab automation - work in progress</td></tr>
</tbody></table>
So I wired up the IFC6410, connected a USB-serial cable for console and added the requisite port numbers to my <a href="https://gitlab.com/git-kernels/imagebuilder/-/blob/master/build-kernel.sh">scripts</a> to toggle power to the board when I built a kernel to test on that target.<br />
<br />
Except that the board didn't enter fastboot mode to flash a new kernel. The messages on the serial console stopped at<br />
<blockquote class="tr_bq">
<br />
<span style="background-color: #f7f7f9; color: #303030; font-family: "monaco" , "andale mono" , "courier new" , "courier" , "mono"; font-size: 11.7px;">Android Bootloader - UART_DM Initialized!!!</span><br />
<span style="background-color: #f7f7f9; color: #303030; font-family: "monaco" , "andale mono" , "courier new" , "courier" , "mono"; font-size: 11.7px;">[0] welcome to lk</span><br />
<br style="color: #303030; font-family: Monaco, "Andale Mono", "Courier New", Courier, mono; font-size: 11.7px; margin: 0px; padding: 0px; user-select: auto !important;" />
<span style="background-color: #f7f7f9; color: #303030; font-family: "monaco" , "andale mono" , "courier new" , "courier" , "mono"; font-size: 11.7px;">[10] platform_init()</span><br />
<span style="background-color: #f7f7f9; color: #303030; font-family: "monaco" , "andale mono" , "courier new" , "courier" , "mono"; font-size: 11.7px;">[10] target_init()</span><br />
<span style="background-color: #f7f7f9; color: #303030; font-family: "monaco" , "andale mono" , "courier new" , "courier" , "mono"; font-size: 11.7px;">[20] display_init(),target_id=3948.</span></blockquote>
After ensuring that the DIP switch settings were correct, I started suspecting my wiring. After triple checking the wiring and the voltages at the barrel plug, I was no closer to finding out what was happening.<br />
<br />
After a break, I got the idea to try out another power supply, so I plugged it into a Rigol power supply. The board booted up to fastboot mode!<br />
<br />
Hmm, still some issues in the wiring? Or perhaps the <a href="https://www.amazon.in/Cyruss-20-pin-Supply-Breakout-Module/dp/B07KNBCSLY">ATX Breakout Board</a>? After checking if all my boards might be drawing more current that the breakout out board could supply and checking my wire guage, I was still stumped.<br />
<br />
The only other thing that stuck out now was that the board was being powered through a relay. Connecting the board directly to the output of the ATX PSU made it boot up. Finally, a clue!<br />
<br />
At this point, I'd spent more time than I had budgeted on this little automation project. So I shelved it for a few days. In the meanwhile, I happened to speak to a <a href="https://twitter.com/sh_aks91">friend</a> who suggested checking the voltage on a scope. So the next day, he brought over his scope.<br />
<br />
We first attached a capacitor across the voltage to the board and that made things work, even through the relay - only half the time. Same thing with a capacitor at the output of the ATX breakout board.<br />
<br />
Finally it was time to connect the oscilloscope to the output of the relay. The first picture sent me back to the theory of relays taught during Computer Engineering - the settling time for voltage in an electromechanical relay.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdHo4lKboi2MvSbzt-4kc8UQFsHPlw1BUM65mL6UsxaScJN3pCQedAMHD5KMqywlNz97qAvnpV73n8SIpC5OPGB6Tvz-wvqqji3dzdHSGlIbrJyoRu5_gd2p4CoMhJyMe2AVmz/s1600/DS1Z_QuickPrint4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="480" data-original-width="800" height="384" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdHo4lKboi2MvSbzt-4kc8UQFsHPlw1BUM65mL6UsxaScJN3pCQedAMHD5KMqywlNz97qAvnpV73n8SIpC5OPGB6Tvz-wvqqji3dzdHSGlIbrJyoRu5_gd2p4CoMhJyMe2AVmz/s640/DS1Z_QuickPrint4.png" width="640" /></a></div>
<br />
That's a fair amount of vibration before the relay switches and settles down to its new position and outputs 5 Volts. So we start booting up the SoC and then the voltage drops precipitously causing boot to freeze. Other relays on the relay board showed similar characteristics. So it isn't a bad relay. And other boards work fine, so it isn't necessarily an issue with using relays.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9ZVyiy56evUx7vJLJI8fv7PgoTz9TEy-H5pPnyy6b5F_3laEqy4sRcXSr-kXRcpHQ2IoPJnUdBcE3eQN63KhZws0Q0XUEP0Jw43C1_6B461dbC0W9OkA-SIGGtiMODCd3satp/s1600/DS1Z_QuickPrint1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="480" data-original-width="800" height="384" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9ZVyiy56evUx7vJLJI8fv7PgoTz9TEy-H5pPnyy6b5F_3laEqy4sRcXSr-kXRcpHQ2IoPJnUdBcE3eQN63KhZws0Q0XUEP0Jw43C1_6B461dbC0W9OkA-SIGGtiMODCd3satp/s640/DS1Z_QuickPrint1.png" width="640" /></a></div>
<br />
Adding a capacitor adds a delay to the relay switching while the capacitor charges up but doesn't really fix the problem.<br />
<br />
In the end, I've concluded that this is actually a PMIC issue. Most PMICs have some sort of a <i>POWER GOOD</i> signal that needs to be stable for some time before it tries to power on the rest of the SoC. IMO, on this board, the firmware is trying to boot the SoC too soon. My suspicion is that this could be fixed in firmware but given the age of the SoC and board, I'm not going to spend too much time on this. The rest of the boards from Qualcomm work just fine with this relay board, so things did get fixed in future PMICs and firmware. Perhaps I'll find time to verify the waveform on a scope for the other boards.<br />
<br />
I also found a <a href="https://www.inforcecomputing.com/Inforce_forums/viewtopic.php?p=89">forum post</a> from 2015 alluding to the same problem with a similar setup. Note the ATX power supply - I bet they were using relays too. :-)<br />
<br />
Time to climb out of the rabbit hole.<br />
<br />
What do you think? Have I reached a valid conclusion?</div>
Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com0tag:blogger.com,1999:blog-13386945.post-30576127015900184562010-12-09T15:50:00.043+02:002010-12-14T08:45:52.601+02:00Prolonging the battery life on your laptop/netbook running Ubuntu<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><a href="http://mdzlog.alcor.net/">mdz</a> pointed me to </span></span><a href="http://brainstorm.ubuntu.com/idea/24782/"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Idea 24782</span></span></a><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"> over at Ubuntu Brainstorm that urges the Ubuntu community to increase focus on making Ubuntu run longer on devices with batteries. I support the idea wholeheartedly. Since the advent of laptops and netbooks, users have wanted to stretch the battery to last that extra 15 minutes it'll require for them to finish up their email or their documents.</span></span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">In fact, the </span></span><a href="http://brainstorm.ubuntu.com/idea/94/"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">most popular idea ever</span></span></a><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"> on Brainstorm is about fixing suspend and hibernate. Unfortunately, it ended up becoming a whirlpool of several different ideas, albeit with a common theme - </span></span><i><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">making the battery last longer</span></span></i><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">.</span></span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">There are several things that can be done to make the battery on a mobile device last longer - some under user control, others under OS/firmware control and some others dependent on HW capabilities. </span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">I am going to attempt to summarize the various use profiles and what Ubuntu does (or can do) to prolong battery life in those profiles. Power management, when done right, should not require the user to make several (difficult) choices. It should just work - providing a good balance of performance and battery life.</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:x-large;">Battery Maintenance</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Let's start with the most basic fact of mobile devices - most have batteries made with Lithium technology (LI-ON mostly). These have a typical life of 2-3 years because then have a limited number of charge/discharge cycles (between 300-1000, check your manual)[1][2]. Keeping your mobile battery in good shape will make it last longer. Hence,</span></span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"></p><ol><li><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Don't keep the mobile device plugged into mains all the time; letting the battery discharge is important for it's longevity. If you must do leave it in all the time, consider removing the battery (at the risk of losing your work on power failure).</span></span></li><li><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Don't expose the battery to high temperatures. The cooler your working environment (including your laptop chassis), the longer your battery will keep its charge.</span></span></li></ol><p></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Toward this end, solution 3 is a very good suggestion. gnome-power-manager, for instance, could tell us when to unplug the power cord.</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:x-large;">When not using the device for long periods (greater than 4 hours)</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-size:medium;"><span class="Apple-style-span" style="font-family:'times new roman';"></span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Turning off the device when not in use for long periods is an obvious way to improve your battery life. </span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">With Ubuntu booting in under 30 seconds on most machines now and ~15 seconds on machines with SSDs[3] this is a good option.</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Using </span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">suspend (to RAM) here continues to drain the battery (about 25% per day on most machines I've had). That means 4 days of suspend just reduced the remaining charge/discharge cycles by one.</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Hibernate (suspend to disk) is a better option than suspend here since the state will be saved to disk and the machine turned off completely. But in practice, with the current implementation of hibernate in Linux, we take almost as long to restore the disk image on resume as a fresh boot up. So hibernate really isn't my preference. If hibernate could be made a lot faster, it could become more attractive than a fresh boot.</span></span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:x-large;">When not using the device for short periods (under 4 hours)</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">This is a very common case when you're using your device on the go - at the airport or a conference or a coffee-shop or a meeting. You use the mobile device for a while, then close the lid to move to a new location or to concentrate on the discussion, etc. </span></span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">You do one of two things: </span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">let the device idle with the lid open or </span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">close the lid and let the device suspend. We need to ensure that both these cases draw the least possible power. This requires co-operation from the applications and Linux drivers.</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:large;">Idling device</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">When a device is left to idle (no keystroke or mouse/touchpad movement), power saving policy kicks in through gnome-power-manager and dims the backlight and turns off the display. Other devices should autoidle themselves when not in use. This needs in this mode are identical needs in the active mode discussed below - shutting down unused hardware.</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:large;">Suspend</span></span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">The default action for Ubuntu when the laptop lid is closed it to try to suspend the device. </span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">New batteries can last several days in this state if it all works correctly.</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">However, it requires every device in the laptop to be put into a low-power/off state. These include the camera, backlight display, lcd display, wireless, bluetooth, usb ports, ethernet ports, mmc controller, graphics chip and cpu. In other words, </span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">each device driver has to do the right thing. If driver is buggy, a device/peripheral won't go in to a low power state and the high consumption could drain your battery quickly. Hence this work to fix drivers </span></span><i><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">never really ends</span></span></i><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"> with hundreds of new components being introduced into the market each year that need drivers to work in Linux. Only a very small proportion of them, however, cause problems with suspend.</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">The most common problems related to suspend seen in Ubuntu are related to the backlight or LCD staying on or the </span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">graphics chip getting wedged. Video drivers are the cause of a large proportion of these problems, but one that we can't always fix by ourselves since documentation is not always available. Canonical works with graphics card vendors to ensure the new versions of the drivers support suspend and don't cause regressions with older graphics cards.</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span style="font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">The Ubuntu Kernel Team provides a </span></span><a href="https://wiki.ubuntu.com/KernelTeam/SuspendResume"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">script</span></span></a><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"> </span></span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">to stress test suspend/resume on your machine.</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">One </span></span><i><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">c</span></span></i><i><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">orner case</span></span></i><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"> we don't handle gracefully in Ubuntu is the case of running out of battery while suspended. </span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">We should detect this condition, automatically wakeup and hibernate the system to save state rather than just let the laptop die with unsaved state.</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:x-large;">When we're actively using the device</span></span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Suspend/hibernate are only interesting when we're not actively using the mobile device. But we need to minimize power consumption during active use as well. This is often called r</span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">untime or dynamic power management. It involves turning off all unnecessary hardware or at least running it in low power mode.</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Common examples include:</span></span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"></p><ul><li><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Turn off audio chip when not playing sounds (pm-utils enables powersave mode for Intel audio chips)</span></span></li><li><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Turn off bluetooth chip when not paired</span></span></li><li><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Turn off WLAN when not used for networking</span></span></li><li><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Scale down the CPU voltage/frequency when you don't need the highest performance (cpufreq with ondemand governor enabled).</span></span></li><li><span class="Apple-style-span" style="font-size:medium;"><span class="Apple-style-span" style="font-family:'times new roman';"></span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Idle the CPU when not in use for short periods of time (</span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">cpuidle and menu governor enabled)</span></span></li></ul><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Further enhancements being investigated and worked on upstream</span></span></p><p></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"></p><div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; "></p><ul><li><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Reducing display refresh rates (</span></span><a href="http://mjg59.livejournal.com/122010.html"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">reclocking</span></span></a><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">)</span></span></li><li><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Clock gating (cutting clocks to parts of the graphics chip) to save power. </span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">This is a very common technique on ARM-based devices e.g. on your mobile phone</span></span></li><li><a href="https://blueprints.launchpad.net/linux-linaro/+spec/other-turn-off-dram"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Memory hotplugging</span></span></a><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"> to switch off parts of the memory banks</span></span></li><li><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">USB autoidling (n</span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">ot supported on all usb devices)</span></span></li><li><span class="Apple-style-span" style="font-size:medium;"><span class="Apple-style-span" style="font-family:'times new roman';"></span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Turning off unused ports e.g. External VGA</span></span></li></ul><p></p></div><p></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><a href="http://www.lesswatts.org/"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Lesswatts.org</span></span></a><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"> has several interesting articles on the topic of power management on Linux. </span></span><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Powertop is a tool that can be used to see what frequencies (p-states) and idle states (c-states) your cpu supports and what applications are responsible for waking up the CPU.</span></span></p><div><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></div><div><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:x-large;">Miscellaneous optimisations</span></span></div><div><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:x-large;"><br /></span></span></div><div><span class="Apple-style-span" style=" ;font-family:'times new roman';font-size:medium;"><a href="http://linux-phc.org/">Undervolting</a> allows us to reduce the voltage on certain processors as mentioned in <a href="http://brainstorm.ubuntu.com/idea/24782/">Solution #6</a>. But the patches have been <a href="http://lkml.org/lkml/2006/7/4/246">rejected</a> upstream because there is no easy way to tell which processors have these capabilities and which don't. Hence they won't be considered in Ubuntu.</span></div><div><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:x-large;"><br /></span></span></div><div><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:x-large;">Non-Intel platforms</span></span></div><div><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></div><div><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">While x86 processors rule the PC/laptop market, the mobile phone market is ruled by ARM processors. These processors are popular for their extremely low power consumption compared to x86 processors. In the past, they had limited performance, but lately you can find dual-core 1GHz ARM processors that would be able to handle the basic computing tasks of web browsing, email, chat, video/voice calls with ease.</span></span></div><div><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></div><div><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">While there aren't many netbook-like ARM-based devices in the market at present, many are expected to start showing up next year. Currently, one can get a <a href="http://www.genesi-usa.com/products/smartbook">Genesi smartbook</a> that uses an older generation single-core Cortex-A8-based Freescale i.MX51 processor that can get ~5hours of battery on a 31Wh battery or a <a href="http://eu.computers.toshiba-europe.com/innovation/generic/b2c-toshiba-ac100">Toshiba AC100</a> that uses a new dual-core Cortex-A9-based Nvidia Tegra 250 processor that gets ~8h on a tiny 25Wh battery.</span></span></div><div><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></div><div><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Organisations such as <a href="http://www.linaro.org/">Linaro</a> are working to speed up development of such devices on the ARM platform. Linaro partners such as Freescale, TI, IBM, ST-E and Samsung are working to make ARM a first-class Linux platform, not just for mobile phones, but for general-purpose computing devices too.</span></span></div><div><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></div><div><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Disclaimer: I lead the Power Management working group in Linaro.</span></span></div><div><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:x-large;">Topics of Interest</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">In conclusion, Ubuntu could focus efforts in the following areas to prolong the battery life on mobile devices and generally improve the Ubuntu experience on battery-powered devices:</span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"></p><ol><li><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Teach g-p-m to prompt user when to plug/unplug power cord based on charging history (including deep discharges once in a while)</span></span></li><li><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Investigate ways to speed up hibernate to be faster than a fresh boot</span></span></li><li><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Allow graceful handling of the case where the battery runs out while suspended by waking up and hibernating the system</span></span></li><li><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Turn off bluetooth hardware by default, activate it only when user requests it and remember the active/inactive setting</span></span></li><li><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Turn off external VGA ports by default and activate it only upon user request</span></span></li><li><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Investigate whether graphics toolkits stop drawing to screen when screen is off</span></span></li><li><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">Make sure Ubuntu on ARM-based chips runs as well as, if not better than the mobile OSes that've been traditionally used on these chips.</span></span></li></ol><div><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;"><br /></span></span></div><div><span class="Apple-style-span" style=" ;font-family:Georgia, serif;font-size:16px;"><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; "><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">[1] http://batteryuniversity.com/learn/article/how_to_prolong_lithium_based_batteries</span></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; "><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">[2] http://www.apple.com/batteries/notebooks.html</span></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style="font-size:medium;">[3] https://wiki.ubuntu.com/FoundationsTeam/BootPerformance/</span></span><span class="Apple-style-span" style="font-size:medium;"><span class="Apple-style-span" style="font-family:'times new roman';"></span></span></p><div><span class="Apple-style-span" style="font-family:'times new roman';"><span class="Apple-style-span" style=" ;font-size:medium;"><br /></span></span></div></span></div><p></p>Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com10tag:blogger.com,1999:blog-13386945.post-58841116142876283362010-09-09T10:53:00.004+03:002010-09-09T10:59:13.610+03:00cross-compilation re-redux<span style="font-style: italic;">Sigh!</span><br /><br />I don't think I'm going to get the cross-compilation <a href="http://idlethread.blogspot.com/2010/09/cross-compilation-redux.html">article</a> right, ever!<br /><br />The repository has now moved to a Launchpad <a href="https://edge.launchpad.net/%7Ehrw/+archive/arm-cross-compiler">PPA</a>.<br /><br />So, for Maverick, you can do the following:<br /><ul style="font-family: courier new;"><li>sudo apt-add-repository ppa:hrw/arm-cross-compiler<strong></strong></li><li>sudo apt-get update</li><li><span><span>sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabigcc</span></span></li></ul>Eventually, the idea is to replace this PPA as well, because the cross-compiler will be available in Ubuntu.Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com0tag:blogger.com,1999:blog-13386945.post-69972697065932092912010-09-08T12:17:00.008+03:002010-09-08T16:42:27.042+03:00cross-compilation reduxIt has been a while since my last blog post about developing for ARM platforms. We last looked at how to <a href="http://idlethread.blogspot.com/2009/01/recipe-of-day-cross-compiling-armel.html">cross-compile</a> the kernel. It is time to revisit that recipe.<br /><br /><span style="font-size:130%;"><span style="font-weight: bold;">Linaro</span></span><br /><br />I've been working with <a href="http://www.linaro.org/">Linaro</a> for the last few months to improve the toolchain, kernel and other components of Linux plumbing on ARM. There is also work to refactor the partner BSPs so that they can co-exist peacefully i.e. single kernel source tree, single u-boot tree, etc. We're just getting started but you can see the <a href="https://wiki.linaro.org/Releases/1011/DeliverablesVersusRequirements">status</a> for the first Linaro release in November.<br /><span style="font-weight: bold;font-size:130%;" ><br />Cross-compile toolchains</span><br /><br />One of the first things that an embedded project has had to do is roll their own toolchain. This is obviously wasted time and effort. Linaro is attempting to fix this problem by pushing fixes into gcc upstream and by providing a standard toolchain for ARM development. This toolchain will take advantages of features of the ARMv7 architecture (NEON acceleration, various performance optimisations, SMP support, etc.). Some of this work in already available in the next release of Ubuntu (10.10 aka Maverick). Tarballs are available for other distributions.<br /><span style="display: block;" id="formatbar_Buttons"><span class=" on down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"><br /><span style="color: rgb(102, 255, 255);">If you're compiling your software for ARM, you should consider switching to this toolchain.</span><br /><br /><span style="font-size:100%;"><span style="font-weight: bold;">Cross-compile toolchain for Ubuntu 10.10 aka Maverick</span></span><br /><br />The Toolchain working group at Linaro has made available a gcc-4.4 and gcc-4.5-based cross toolchains. For Maverick, just type the following in your terminal:<br /></span></span><ul><li><span style="font-size:85%;"><span style="font-family:courier new;">echo "deb http://people.canonical.com/~hrw/ubuntu-maverick-armel-cross-compilers/ ./" | sudo tee -a /etc/apt/sources.list.d/cross-compile.list</span></span></li></ul><ul><li><span style="font-size:85%;"><span style="display: block;font-family:courier new;" id="formatbar_Buttons" ><span class=" on down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);">sudo apt-get update</span></span></span><span style="font-size:85%;"><span style="display: block;font-family:courier new;" id="formatbar_Buttons" ><span class=" on down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"></span></span></span></li><li><span style="font-size:85%;"><span style="display: block;font-family:courier new;" id="formatbar_Buttons" ><span class=" on down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);">sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi</span></span></span></li></ul><span style="display: block; font-weight: bold;" id="formatbar_Buttons"><span class=" on down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"></span></span><span style="font-size:100%;"><span style="display: block;" id="formatbar_Buttons"><span class=" on down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"><span style="font-weight: bold;">Cross-compile toolchain for Ubuntu 10.04 LTS aka Lucid</span></span></span></span><br /><span style="display: block;" id="formatbar_Buttons"><span class=" on down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);">If you're not brave enough to run Maverick beta, the same toolchain can be made to work on Ubuntu 10.04 LTS with some additional steps.<br /></span></span><span style="display: block;font-family:georgia;" id="formatbar_Buttons" ><span class=" on down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"></span></span><ul><li>Install the maverick versions of two libraries: <a href="http://packages.ubuntu.com/maverick/libmpfr4">libmpfr4</a>, <a href="http://packages.ubuntu.com/maverick/libcloog-ppl0">libcloog-ppl0</a></li><li>Follow the steps for Maverick above<br /></li></ul><span style="font-size:100%;"><span style="font-weight: bold;">Cross-compiling the Ubuntu Kernel</span></span><br /><br />Time to take the shiny cross-toolchain for a testdrive:<br /><ul style="font-family: courier new;"><li>git clone git://kernel.ubuntu.com/ubuntu/ubuntu-maverick.git</li><li><del>debuild -eCROSS_COMPILE=arm-linux-gnueabi- -b -aarmel<br /></del> Unfortunately this command breaks because of perf, I believe. It complains about libelf/libdw missing. I'll try to update with a dpkg-cross command when i get a chance.<br /></li></ul><br /><span style="font-weight: bold;">Cross-compiling other stuff</span><br /><br />And here is how you could use it to compile non-debian packages:<br /><ul style="font-family: courier new;"><li>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-</li></ul><br /><br />Enjoy!Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com0tag:blogger.com,1999:blog-13386945.post-32690700904747404192009-08-06T11:55:00.005+03:002009-08-06T12:38:23.687+03:00Touchscreen = fail?<span style="font-family:georgia;">Do you have a touchscreen that isn't working in Ubuntu? We need your help!<br /><br />We are trying to get as many touchscreens working as possible for Karmic.</span> <a style="font-family: georgia;" href="https://bugs.edge.launchpad.net/ubuntu/+source/xf86-input-evtouch/+bug/317094">Bug #317094</a><span style="font-family:georgia;"> is attempting to collect hardware information about these them. As a first step, we'd like to enable the ones that can use the in-kernel usbtouchscreen driver.</span><br /><ul><li><span style="font-family:georgia;">Do you have a touchscreen?</span></li><li><span style="font-family:georgia;">Is it connected over USB? (<span style="font-family:courier new;">lsusb</span> is your friend)</span></li><li>Get the <span style="font-family:courier new;">vendor</span> and <span style="font-family:courier new;">product id</span> of the USB touchscreen (lsub)<br /></li><li>Load the <span style="font-family:courier new;">usbtouchscreen</span> module and add the new id to it through sysfs</li></ul>A made-up example follows (I don't have a touchscreen handy, sorry!)<br /><ul><li>example output from lsusb</li></ul><span style="font-family:courier new;">Bus 005 Device 002: ID 0483:2016 SGS Thomson Microelectronics Fingerprint Reader</span><ul><li>0483 is the vendor id, 2016 is the product id</li><li style="font-family: courier new;">sudo modprobe usbtouchscreen</li><li style="font-family: courier new;">sudo sh -c "echo 0483 2016 > /sys/bus/usb/drivers/usbtouchscreen/new_id"</li></ul>Replace the vendor and product id with what you found from lsusb.<br /><br />If this makes your touchscreen work in Karmic, please reply on the bug with the ids and name of the touchscreen.Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com3tag:blogger.com,1999:blog-13386945.post-37322316319196722252009-06-24T17:33:00.003+03:002009-06-25T09:33:02.335+03:00Speeding up boot on an upgraded system<span style="font-family:georgia;">So I have a laptop that I've been upgrading since Hardy (currently on Karmic Alpha) that I would like to boot faster. It has probably accumulated a lot of crufty daemons along the way that probably aren't being pre-loaded into memory.</span> <span style="font-family:georgia;">I picked up this tidbit from the </span><a style="font-family: georgia;" href="https://lists.ubuntu.com/archives/ubuntu-devel/2009-June/028308.html">fast boot expert</a><span style="font-family:georgia;">. Add </span><span style="font-family:courier new;">profile<span style="font-family:georgia;"> to your kernel command-line (at the grub prompt, press <span style="font-family:courier new;">Esc e</span> and then edit the line)</span>.<span style="font-family:georgia;"> This will update your system's readahead file list after a <span style="font-style: italic;">lot</span> of disk churn. On my machine, it sped up boot by only about 5 seconds, but YMMV.<br /><br />Also, if you have a machine or netbook with SSD (flash) disks, sreadahead might give you a boost. Again, <span style="font-family: courier new;">apt-get install sreadahread<span style="font-family: georgia;"> is your friend</span></span></span>.<span style="font-family: georgia;"> sreadahead also schedules profiling of the system every month-or-so, so it keeps those boot-essential programs in the readahead cache always.</span><br /><br /></span>Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com5tag:blogger.com,1999:blog-13386945.post-47281501849782252792009-02-13T13:10:00.007+02:002009-02-13T13:23:16.811+02:00Ubuntu kernels, vanilla kernels, kerneloops<span style="font-size:130%;"><span style="font-family:georgia;">First, go read Pete's </span><a style="font-family: georgia;" href="http://blog.redvoodoo.org/2009/02/jaunty-kernel-bits.html">summary</a><span style="font-family:georgia;"> about the going-ons in Jaunty kernel-land.</span><br /><br /><span style="font-family:georgia;">The only bit I would like to add is to install the <span style="font-family:courier new;">kerneloops</span> package. This nifty little application will scan your logs for any crashes/warnings in the kernel and report them upstream as well as to Launchpad. This helps upstream and Ubuntu developers get an idea of what bugs a vast majority of their users sees and allows them to prioritize their time.</span><br /><br /></span><span style="font-family:georgia;"><span style="font-size:130%;">We are working toward getting it installed by default for beta, but for those of you that upgrade and keep a tight rein on what's installed please consider installing <span style="font-family:courier new;">kerneloops</span>.<br /><br /><span style="font-family:courier new;">sudo apt-get install kerneloops</span></span><br /></span>Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com0tag:blogger.com,1999:blog-13386945.post-26316125938501101212009-01-23T10:52:00.010+02:002009-01-29T12:54:24.504+02:00Recipe of the day: Cross-compiling armel kernels<span style=";font-family:georgia;font-size:130%;" >ARM kernels can be very slow to bake because:<br /></span><ol style="font-family: verdana;"><li>ARM HW can be memory constrained so Native compilation is slow</li><li>Setting up Native compilation for several boards is rather painful, if you, like me, have to compile several flavours everyday.<br /></li><li>Compiling under QEMU is mind-numbingly slow</li></ol><span style="font-family:verdana;">Here, we bake all the Ubuntu ARM kernels using a single command on you x86 PC using a cross-compiler.</span><br /><span style=";font-family:georgia;font-size:130%;" ><br /><span style="font-weight: bold;">Ingredients</span><br /></span><ol style="font-family: verdana;"><li>A x86 machine running Ubuntu</li><li>A ready-to-use cross-compilation toolchain</li><li>Something software to compile, say, a kernel</li></ol><span style="font-weight: bold;font-family:georgia;font-size:130%;" >Instructions</span><br /><ul style="font-family:verdana;"><li><span style="font-size:130%;">Get an ARM toolchain and set it up</span></li></ul><span style="font-family:georgia;">I was too lazy to compile mine and got one </span><a style="font-family: verdana;" href="http://www.codesourcery.com/gnu_toolchains/arm/portal/subscription3057">from CodeSorcery</a><span style="font-family:georgia;">. I used the 2008q3-72 tarball.</span><br /><br /><span style="font-family:georgia;">Untar it someplace in your $HOME, say $HOME/work/toolchains. You should now have a directory <span style=";font-family:courier new;font-size:130%;" >$HOME/work/toolchains/2008q3-72/bin</span> with your cross-toolchain binaries.</span><br /><ul style="font-family:verdana;"><li><span style="font-size:130%;">Download the Ubuntu kernel</span></li></ul><span style="font-family:georgia;"><span style="font-size:130%;">cd $HOME/work<br />git clone git://zinc.ubuntu.com/ubuntu/ubuntu-jaunty.git<br />cd ubuntu-jaunty</span><br /></span><ul style="font-family:verdana;"><li><span style="font-size:130%;">Compile the kernel</span></li></ul><span style=";font-family:courier new;font-size:130%;" >debuild -eCROSS_COMPILE=arm-none-linux-gnueabi- --prepend-path=$HOME/work/toolchains/arm-2008q3/bin -b -aarmel</span><br /><ul style="font-family:verdana;"><li><span style="font-size:130%;">Bake it</span></li></ul>Let it bake for an hour or two, depending upon the speed of you oven^Wprocessor. If everything goes according to plan, you should have several .deb cookies for the various ARMel flavours of the Ubuntu kernel. Enjoy and share with friends and family.<span style="color: rgb(255, 204, 102);font-family:verdana;" ><br /></span>Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com0tag:blogger.com,1999:blog-13386945.post-42861061392754854572008-11-14T15:04:00.007+02:002008-11-15T14:04:12.772+02:00Ubuntu on ARMSo the wraps are off on this one - Ubuntu will soon come to a ARMv7-based SoC near you. Here are the press releases from <a href="http://arm.com/news/23761.html">ARM</a> and <a href="http://www.ubuntu.com/news/arm-linux">Canonical</a> if you are into reading those.<br /><br />I'm going to be adding support for several popular ARM-based devices to the Ubuntu kernel soon.<br /><br />Please refer to my other post to get familiar with <a href="http://idlethread.blogspot.com/2008/11/nomenclature-in-arm-world_14.html">nomenclature in the ARM world</a> if you need.<br /><br />If you've followed Debian, they've had an armel port (ARM-endian-little), based on the new ARM ABI for a while now. A link to the excellent <a href="http://wiki.debian.org/ArmEabiPort">Debian EABI</a> is in order for people interested in the nitty-gritty of ABIs. The Debian armel port is compiled for armv4t to support every ARM EABI-capable processor.<br /><br />Ubuntu is going to concentrate on ARMv7-based processors, including the <a href="http://www.arm.com/products/CPUs/ARM_Cortex-A8.html">Cortex-A8</a> and Cortex-A9. In practice, that would mean bootstrapping the distro for ARMv5 architecture and then optimizing critical libraries and applications for the ARMv7 architecture.Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com3tag:blogger.com,1999:blog-13386945.post-86426927326249468262008-11-13T23:04:00.000+02:002008-11-14T15:07:37.465+02:00Nomenclature in the ARM worldThe ARM processor architecture naming/numbering scheme is confusing.<br /><br /><table border=1><tbody><tr><th>Architecture version</th><th>Family</th><th>Sample devices</th></tr><tr><td>ARMv4</td><td>ARM7 (and some ARM 9s)</td><td>iPod, Lego NXT</td></tr><tr><td rowspan=2>ARMv5</td><td>ARM9</td><td>OMAP1 (Nokia 770), Nintendo DS</td></tr><tr><td>Xscale</td><td>Sharp Zaurus, Palm Tungsten, Gumstix</td></tr><tr><td>ARMv6</td><td>ARM11</td><td>OMAP2(N95, N800, N810), iPhone</td></tr><tr><td>ARMv7</td><td>Cortex-A8/A9</td><td>OMAP3, no major devices yet</td></tr></tbody></table><br /><br />The table above is a cheatsheet that I use to get my numbers straight. For all the gory details refer to <a href="http://en.wikipedia.org/wiki/ARM_architecture">wikipedia</a>. Each family above has several <i>cores</i> each, differentiated by the various feature sets they offer such as Jazelle, DSP, Thumb, etc. The devices listed are ones that I have owned/worked on.Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com2tag:blogger.com,1999:blog-13386945.post-36510153068583102412008-11-02T12:52:00.004+02:002008-11-14T03:57:00.647+02:00Ubuntu Intrepid Ibex 8.10 is out6 months of work ended with the release of Ubuntu 8.10 (codenamed Intrepid Ibex).<br /><br />We've tried to be a little more ambitious with our kernel this time by switching to 2.6.27 that was released only a few weeks before our freeze. On the whole it has been a good move, especially since Adrian Bunk has decided to make 2.6.27 a <a href="http://lkml.org/lkml/2008/10/11/235">long term support release</a><br /><br />I would like to ask people to install the kerneloops package in order to help upstream gather and fix any crashes in the kernel. I will be working toward making kerneloops part of the default Ubuntu install for 9.04.<br /><br />On now towards 9.04 or Jaunty Jackalope...Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com0tag:blogger.com,1999:blog-13386945.post-1153830752832542372006-07-25T15:26:00.001+03:002008-11-17T17:16:37.110+02:00OLS 2006I was at the OLS again this year. It is a great way to meet with people you are usually working with only over email. There were some great talks this year as well, the most notable ones being:<br /><br /><ul><br /><li> <a href="http://www.kroah.com/log/linux/ols_2006_keynote.html">Keynote by GregKH</a><br /><li> <a href="http://download.linuxmontreal.com/projects/usb/reveng/tutorial/ols_2006_usbreveng_tutorial.pdf">USB Reverse Engineering by Eric Preston</a><br /><li> <a href="http://lwn.net/Articles/192214/">Why Userspace Sucks? by Dave Jones </a><br /></ul>Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com0tag:blogger.com,1999:blog-13386945.post-1144399531770281012006-04-07T11:36:00.000+03:002006-10-23T22:39:32.401+03:00Are you afraid of the unexpected?Neat article about <span style="font-style:italic;">Architecture against Death</span>. The premise being that an active mind and body lives longer. I have to visit the <a href="http://www.yoro-park.com/e/rev/index_a_en.html">Site of Reversible Destiny</a> (and <a href="http://pruned.blogspot.com/2006/03/site-of-reversible-destiny.html">some more pics</a>) by the same architect.Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com0tag:blogger.com,1999:blog-13386945.post-1141814483446504362006-03-08T12:39:00.000+02:002006-10-23T22:39:31.671+03:00Reading listA bunch of interesting books I plan on reading someday:<br /><br />Clayton Christensen - The Innovator's dilemma<br />Clayton Christensen - The Innovator's solution<br />Tao of Physics<br />Mathematics and sex<br />Mapping the mind - Rita Carter, Christopher Frith<br />Freakonomics - Steven D. Levitt & Stephen J. DubnerAmithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com1tag:blogger.com,1999:blog-13386945.post-1141588963136094232006-03-05T22:02:00.000+02:002006-10-23T22:39:31.576+03:00Categories using labelrOn the top of my wishlist for Blogger was support for categories or labels to organize my posts. Came across this service, <a href="http://www.labelr.com">www.labelr.com</a>, that lets me do that seamlessly. Check it out.Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com0tag:blogger.com,1999:blog-13386945.post-1125444111025613672005-08-31T02:17:00.001+03:002008-11-14T17:30:30.826+02:00Nokia 770I used the <a href="http://www.nokia.com/770">Nokia 770</a> on a recent vacation trip to BeNeLux. I have to admit is was very handy to have a small device for quick web access without having to lug around my laptop. And the fact that I could play a few games while travelling on the trains or listen to music just adds to its utility.<br /><br />This device is beginning to look better by the day. So now back to work on it for the Q3 launch as promised.Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com0tag:blogger.com,1999:blog-13386945.post-1118532069821804512005-06-12T02:10:00.000+03:002006-10-23T22:39:30.697+03:00Version numbering 1.2Interesting article about the inconsistencies in version numbering conventions in open source software. I have heard a lot of <span style="font-style: italic;">marketing-</span>speak about version numbering theories. Here are a few:<br /><ul> <li>Version numbers shouldn't go too high, else it seems like the product has many problems that are fixed with every version. Microsoft marketing seems to think this way, Adobe doesnt.</li> <li>Certain version numbers convey better software than others. <span style="font-style: italic;">Point-oh</span> releases are a case in point, but odd numbers convey instability.</li> <li>Your version numbers should be higher than your competitors' to signify a better product.</li> </ul> So obviously there is no panacea here. Personally, I would prefer version numbers to be an increasing sequence - for the lifetime of the product.Amithttp://www.blogger.com/profile/02864588269429215554noreply@blogger.com0