Tuesday, April 16, 2013

First PC Build: Software - Setting Up Ubuntu 12.10

I had already decided that I wanted to install Linux, but I didn't realize until I started researching a bit just how broad the options were, and how passionate people are about which distribution is the best.  I read a lot of articles (this one on Lifehacker was pretty good), but didn't really have a good reason to select anything in particular.  I considered Fedora pretty heavily for a couple of reasons.  First, I use Red Hat at work, so the connection there seemed like it might be a good reason.  Second, there is a "spin" (repackaged distribution with extra software included) called Fedora Electronic Lab that includes an impressive collection of software for electronics design that was tempting.  However, some places I looked made it seem like Fedora tends to be a little less stable due to its emphasis on getting updates out as soon as possible.  I ended up choosing Ubuntu instead, mainly because I didn't have a great reason to pick anything else and it seemed to have a very large community in case I ran into issues.

The downloading and installation process was very straightforward.  I downloaded an ISO from the main download page and used the Windows Disc Image Burner on Windows 7 to create the install DVD.  I am using Ubuntu 12.10 "Quantal Quetzal" 64-bit.  There is a release page that has the common download options available if you want to see the other choices.  During the installation process there is an option to install restricted extras, which I selected, giving you the ability to playback some media formats without having to install additional software later.

Below, I am listing the different additional software I installed after getting the computer up and running.  I may add to this in the future, and this is mostly a log for myself in case I have to do this again later.

The Unity desktop that comes standard on Ubuntu 12.10 is going to take some getting used to.  I may stick with it, but I decided to download a few other desktop environments to try out as well before settling.  These command will install the classic Gnome desktop, the KDE desktop, and the LUbuntu desktop (which is supposed to be lighter weight).


sudo apt-get install gnome-panel
sudo apt-get install kubuntu-desktop
sudo apt-get install lubuntu-desktop

Ubuntu installs with open source graphics drivers that worked fine with the APU I have, but AMD releases a proprietary driver that I installed instead.  There is an unofficial wiki from AMD that contains installation instructions.  Make sure you find the page for your specific distribution.  I initially followed the directions for Ubuntu 12.04 and things did not go well.  I followed the manual installation instructions, which are listed below.  You could also download the zip file from the AMD website instead of the wget line below.

sudo apt-get install build-essential cdbs dh-make dkms execstack dh-modaliases linux-headers-generic fakeroot
sudo apt-get install lib32gcc1
wget http://www2.ati.com/drivers/linux/amd-driver-installer-catalyst-13.1-linux-x86.x86_64.zip
unzip amd-driver-installer-catalyst-13.1-linux-x86.x86_64.zip
chmod +x amd-driver-installer-catalyst-13.1-linux-x86.x86_64.run
sudo ./amd-driver-installer-catalyst-13.1-linux-x86.x86_64.run --buildpkg Ubuntu/quantal
sudo dpkg -i fglrx*.deb
sudo amdconfig --initial -f

After all of these steps, reboot the computer. Then run the following commands to test out the installation and make sure everything works.  The first one should print some information about your GPU, and the second should start a spinning box graphic and report out some information.

fglrxinfo
fgl_glxgears

I have Amazon Prime, which gives you access to stream a lot of TV shows and movies, and when I went to check if it worked....it didn't.  I was using Firefox and my Flash player was up-to-date, but it kept saying I needed to update the player.  I did some searching, and eventually found a solution.

sudo apt-get install libhal1 hal

That worked for a couple weeks, but soon after I did an update in the Ubuntu Software Center...and Amazon Instant Video stopped working.  Apparently there was an update to the flash plug-in that broke it.  A post on the Ubuntu forums describes the fix.

64-bit Download: https://fpdownload.macromedia.com/ge....x86_64.tar.gz

tar -xzf install_flash_player_11_linux.x86_64.tar.gz
sudo cp libflashplayer.so /usr/lib/mozilla/plugins

I don't play computer games, so I don't have anything to compare it to, but I went to Steam, which recently started putting out some Linux games, and downloaded Team Fortress 2 (free to play) to see how it runs on the APU.  It looked like it was working fine to me, and I didn't notice any slowing down or anything.

This one makes me feel a little dumb.  After leaving my computer running for a while, I would check "top" in the terminal and it looked like all of my RAM was being used when the computer was basically idling.  I got pretty frustrated trying to figure out what was going on until I found this site that explains it.  Linux uses unused memory for caching  but it gives it right back to applications when its needed.  My computer is really idling at about 1GB of RAM used, not 3GB+, which is what had me worried.  The "free" command shows how much memory is being used for caching and home much you really have used.

Now, on to the software I really care about.  I mostly want to use this computer to work on my microcontroller projects and C++/Python projects.  GCC and Python came pre-installed, so there's nothing needed to use those.  There are several IDE's available in the Ubuntu Software Center, but for now I plan on just using a text editor and terminal.

Some microcontroller vendors release their tools for Windows only, but there are several officially supported Linux tools.

I use Cadsoft Eagle for PCB layout, and they offer a Linux version.  It comes as a .run file that opens an installer and was very straightforward to install.  I opened up some of their sample project files and it seemed like everything was working correctly. 

Microchip's relatively new MPLAB-X IDE is available for Linux and it also comes as a .run file that is easy to install.  It looks like debugging in Linux is only supported on the PICKIT3, not the PICKIT2, so I'll probably end up getting on of those before I pick back on up one of my stalled PIC18 projects.  I have a storybook reader project and a RC/drone controller project that are both PIC based that haven't made much progress in a while, but hopefully I'll get back to them at some point and transition them over to my Linux development box.

I downloaded the version of the Arduino IDE that is in the Ubuntu repository.  It installed version 1.0.1, while the download page for Arduino is at 1.0.4 for a zipped tar file for Linux.  I'll see once I start working with it if I need to upgrade.  My next/current project will likely use Arduino because I'm helping out a friend with a homebrewing controller who doesn't really have any background in programming/electronics and want to learn through the project and it seemed like the best choice for that.

sudo apt-get install arduino

Atmel also releases an AVR Toolchain for Linux that includes a compiler, assembler, linker and Standard C & math libraries for AVR microcontrollers. I would imagine that the Arduino installation includes some (or all) of this, but it seemed like a useful link to keep track of as well.

Texas Instruments has also provided Linux support for their MSP430 series of microcontrollers with CSS version 5.  The free version is limited to 16kB, but that is larger than most of the low end MSP430's anyway.

Sunday, April 7, 2013

First PC Build: Hardware

I recently finished building my first PC.  My main goal here was to learn something new, because I've never really done much inside my computer and I figured the best way to learn more about it was to put one together myself.  On a more practical level, my wife's laptop is 6 years old and starting to act up, so I want to replace it.  My wife does some photo/video editing, so she needs a reasonably powerful machine, while I could get by with a much less powerful machine than my current desktop for most of what I do.  I decided to give her my current desktop as her main computer (she has a small netbook too for portability and looking up recipes in the kitchen) and build myself a cheaper computer as a learning experience.

My goal for learning here is two-fold.  First, I am interested in learning how to go about finding parts for a computer and physically assembling it.  I'm not trying to build a high-power computer for gaming or anything like that.  Second, I am trying to increase my proficiency and understanding of Linux.  I use Linux daily at work, but my capabilities are mostly limited to shell scripting and C++/Python development work, and a lot of what I would like to learn how to do is restricted to only IT people, so I have no way to learn at work.  My current desktop is set up to boot into either Windows 7 or Ubuntu, but I leave it in Windows basically all of the time because of some Windows only software I need for school.  I recently got a Raspberry Pi with intentions of using it to learn more about Linux...but it's just painfully slow for daily computing tasks.  I'll still use it in projects in the future, but I need something else for daily work.  Making my main computer into a Linux-only desktop seems like a good way to force myself to learn more.

My main uses for the computer will be web browsing, microcontroller projects, and C++/Python software development.  Some microcontroller vendors only release tools for Windows, but I'm not too worried about it.  I still have my old computer if I really need it for something, but I know that I should be able to do what I need to in Linux and I want to force myself to learn.

There is a series of articles on Lifehacker on how to build a computer from scratch that I read through, and then I headed over to Newegg to start looking for parts.  I also noticed that Tigerdirect has some pretty cheap barebones kits, but I wanted to go through the process of picking out the parts myself.  I had a couple of friends look over what I was getting, and they made some suggestions on brands to avoid, and basically made sure everything I picked out would be compatible together.

I re-used an old case from a friend, but the rest of the parts I got from Newegg.  My goal was to keep the cost under $300, and it came in at $320, so I was close.
  • Processor- AMD A8-5500 Trinity APU.  I went with AMD over Intel because it seemed to offer a better deal in the lower end processors.  This is a quad-core APU with Radeon HD 7560D integrated graphics.  I was not planning on getting a graphics card, so the choice was a regular CPU with integrated graphics on the motherboard, or an APU.  I picked the APU.  This is one of the areas I upgraded, because I was initially considering the A4-5300 Trinity APU (which is dual core instead).
  • Motherboard- MSI FM2-A75MA-E35. The AMD Trinity APUs use a FM2 socket, which is not compatible with any of their previous processors (including their first generation APU, Llano), although I believe the series to replace Trinity will share the same socket.  I would probably not recommend this motherboard.  It's working fine, but my board has a glitchy BIOS, and reading around more after purchasing I see that others have had issues as well.  Basically whenever I enter the BIOS menu, it lets me change whatever I want (in my case, upping the RAM speed), but completely freezes when I try to save the settings and I have to then reboot the computer and none of the settings are saved.  I found a forum entry by someone else who had the same issue, and the workaround is to hit the "X" instead of trying to save settings.  It will then prompt you to save, and it commits properly and then reboots.  Everything works, but it's an annoyance, and I'd rather just have it work properly.
  • RAM- G.SKILL Ripjaws X Series 4GB.  A friend suggested the 4GB of faster RAM would probably be a better choice than 8GB of slower RAM if I don't think I'll be really memory intensive, so I went with that.  When I went into the BIOS to up the RAM speed to 1866 (it defaulted to 1600 when I first booted) I had to manually change the timing to what was listed on the Newegg product page (9-10-9-28) because the "auto" setting did not work and everything froze when I tried to just increase the speed without modifying the timing (although it worked fine at 1600 with the auto timing).
  • Hard Drive- Seagate Barracuda 7200RPM 500GB.  Nothing special here.  There was a good sale when I was buying, so I got it.  I would have been fine with a much smaller drive.  I was surprised by how little the price difference was between the different levels of storage.  I also considered getting an SSD instead (because I didn't need a lot of storage space), but even the small ones were expensive and I read a few articles on things to do when running an SSD in Linux, and I decided that sticking with a regular hard drive would be simplest for now.
  • Power Supply- CORSAIR Builder Series CX430.  The power supply was another one that I upgraded based on a friend's recommendation.  Apparently there are brands with bad reputations and I had picked one of those.
  • Optical Drive- LG 24X DVD Burner.  Again, nothing special.  Just a cheap DVD drive.  I almost didn't even include this, because you can install Linux from a thumb drive and I'll probably use thumb drives for any file transfers between computers.
Assembling the computer was surprisingly simple.  Between the Lifehacker article mentioned above and a video from Newegg I had a general idea of what I needed to do, and it was all very straightforward.  There were a couple of snags, but nothing too serious.  First, the main ATX power cable would not "snap" into place.  The motherboard was flexing, so I stopped pushing, but it definitely did not click in, though it is on snug enough and appears to be working fine.  The other issue I had was figuring out what to connect for the front panel connectors on the case.  Only about half of the cables were labelled, but I eventually figured out where they all went.  One of the things I had read about being a challenge is cable management, but my case was pretty empty at the end and there was plenty of room to pull all the excess cable into the empty drive bays.

My next post will talk about setting up the software now that the hardware is assembled.