Friday, September 26, 2014

Upgrade Beaglebone Black (BBB) kernel

An excellent post was written up by Marcos Miranda from element 14 instructing users on how to upgrade the kernel on the BBB.
http://www.element14.com/community/blogs/mirandasoft/2014/04/02/beaglebone-black-upgrading-the-linux-kernel

In a nutshell, it's 3 basic scripts.  Before starting, make a directory to put all your scripts.  You may name the following files and scripts however you want to.  I use generic file names for readability.


1. Create your scripts:
I am naming mine test.sh, upgrade.sh, and clean.sh.

Use vim and save the separate scripts into a directory of your choosing.
mkdir ~/upgradekernel
cd ~/upgradekernel

vim test.sh
_____________________________________________________________________________
#!/bin/bash
wget -nd -p -E https://rcn-ee.net/deb/sid-armhf/LATEST-omap-psp -O ./LatestBBBKernels.txt
cat ./LatestBBBKernels.txt
_____________________________________________________________________________

vim upgrade.sh
_____________________________________________________________________________
#!/bin/bash
# TO BE EXECUTED UNDER ROOT ACCOUNT
# STANDARD DISCLAIMER APPLIES.
set -e
wget -nd -p -E https://rcn-ee.net/deb/sid-armhf/LATEST-omap-psp -O ./LatestBBBKernels.txt
echo -e "#!/bin/bash" > download.sh
echo -ne "wget -c " >> download.sh
sed -n -e 's/ABI:1 STABLE //p' LatestBBBKernels.txt >> download.sh
echo "sh ./install-me.sh" >> download.sh
chmod +x download.sh
sh ./download.sh
rm LatestBBBKernels.txt
_____________________________________________________________________________

vim clean.sh
_____________________________________________________________________________
#!/bin/bash
set -e
# rm -r /root/install-me.sh
# rm -r /root/download.sh
# rm -rf /boot/*-bone41
# rm -rf /boot/uboot/*bak
# rm -f /boot/uboot/tools/restore_bak.sh
# rm -rf /lib/modules/3.8.13-bone41
# apt-get remove --purge -y linux-image-3.8.13-bone41
# apt-get clean all
_____________________________________________________________________________

1. Decide on which kernel you would like to install.  The keywords are STABLE, TESTING, or EXPERIMENTAL

Run the following to determine which kernel version are available to you.

cd ~/scriptdir
vim test.sh

(copy and paste the following into test.sh):


type in vim to quit and save - :wq

chmod +x test.sh

./test.sh
_____________________________________________________________________________

You should receive an output resembling the following:
--2014-09-26 15:06:58--  https://rcn-ee.net/deb/sid-armhf/LATEST-omap-psp
Resolving rcn-ee.net (rcn-ee.net)... 69.163.222.213
Connecting to rcn-ee.net (rcn-ee.net)|69.163.222.213|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 234 [text/plain]
Saving to: `./LatestBBBKernels.txt'

100%[=======================================================================================================>] 234         --.-K/s   in 0s    

2014-09-26 15:07:03 (659 KB/s) - `./LatestBBBKernels.txt' saved [234/234]

FINISHED --2014-09-26 15:07:03--
Total wall clock time: 4.7s
Downloaded: 1 files, 234 in 0s (659 KB/s)
root@beaglebone:~/Projects#     cat ./LatestBBBKernels.txt
ABI:1 TESTING https://rcn-ee.net/deb/sid-armhf/v3.16.3-bone6/install-me.sh
ABI:1 EXPERIMENTAL https://rcn-ee.net/deb/sid-armhf/v3.17.0-rc6-bone4/install-me.sh
ABI:1 STABLE https://rcn-ee.net/deb/sid-armhf/v3.8.13-bone67/install-me.sh
_____________________________________________________________________________

Notice the TESTING, EXPERIMENTAL, and STABLE.  Also notice their associated kernel versions.

2.  Run the scripts and modify accordingly.

Run test.sh

You should receive output that resembles the following:
_____________________________________________________________________________
--2014-09-26 15:06:58--  https://rcn-ee.net/deb/sid-armhf/LATEST-omap-psp
Resolving rcn-ee.net (rcn-ee.net)... 69.163.222.213
Connecting to rcn-ee.net (rcn-ee.net)|69.163.222.213|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 234 [text/plain]
Saving to: `./LatestBBBKernels.txt'

100%[=======================================================================================================>] 234         --.-K/s   in 0s    

2014-09-26 15:07:03 (659 KB/s) - `./LatestBBBKernels.txt' saved [234/234]

FINISHED --2014-09-26 15:07:03--
Total wall clock time: 4.7s
Downloaded: 1 files, 234 in 0s (659 KB/s)
root@beaglebone:~/Projects#     cat ./LatestBBBKernels.txt
ABI:1 TESTING https://rcn-ee.net/deb/sid-armhf/v3.16.3-bone6/install-me.sh
ABI:1 EXPERIMENTAL https://rcn-ee.net/deb/sid-armhf/v3.17.0-rc6-bone4/install-me.sh
ABI:1 STABLE https://rcn-ee.net/deb/sid-armhf/v3.8.13-bone67/install-me.sh
_____________________________________________________________________________

Analyzing the output, choose which type of kernel installation you would like.  Personally I like TESTING so I will modify the upgrade script to replace "STABLE" with "TESTING"

Once you modify upgrade.sh, run it.

./upgrade.sh

Once the upgrade is complete, run clean.sh

Reboot your system and the kernel is now updated! Enjoy!

Props to Marcos for the nice scripts.

Thursday, September 11, 2014

Removing or Editing File Associations through the Windows 7/8 registry

The registry is an incredibly sensitive file that contains a vast amount of highly unorganized data in the form of folders and keys.  My patience was really tested when a user decided to open a special file extension in MS word.  Now the file's properties displays an undesired program as the default.  Also, I've seen people try to open a file but the program doesn't open properly signifying that the parameters are incorrect.  If anyone has made this mistake before and would like to resolve it, I have some instructions and places to look.
I will be using the file extension ".ext" as an example for the steps below"

First, everyone should know about the "default programs" section in control panel.  Unfortunately, it doesn't paint the whole picture.

In command prompt, type "assoc .ext".  This will display the name of a program that it is associated with this extension.  This data comes from the "classroot" section in the registry.

Also in command prompt, type "ftype nameofprogram".  The "nameofprogram" is taken from the output of the command "assoc .ext".  This will display the command used to describe the behavior about how the file is opened.  Normally you will have a %1 next to it letting you know that it is taking in the file that is associated with it as a parameter.

If you don't get any clues from above and need to go deeper, then here is where the registry comes in.

***BACKUP THE REGISTRY BEFORE MODIFYING THE REGISTRY***

There are numerous places to look for a misbehaving file extension, all are taken from this very well written article:
 http://www.mydigitallife.info/how-to-unassociate-remove-or-delete-programs-from-open-with-or-recommended-programs-list/

The following places to look are:

HKEY_CURRENT_USER\Software\Microsoft\Windows\
CurrentVersion\Explorer\FileExts\.<extension>\OpenWithList

HKEY_CURRENT_USER\Software\Microsoft\Windows\
CurrentVersion\Explorer\FileExts\.<extension>\OpenWithProgIDs

HKEY_CLASSES_ROOT\.<extension>\OpenWithList

HKEY_CLASSES_ROOT\.<extension>\OpenWithProgIDs

HKEY_LOCAL_MACHINE\SOFTWARE\Clients\<Program Type>\
<Program Name>\Capabilities\FileAssociations

HKEY_CLASSES_ROOT\Applications\<application executable name>\SupportedTypes

HKEY_CLASSES_ROOT\SystemFileAssociations\<Perceived Type>\OpenWithList
HKEY_CLASSES_ROOT\SystemFileAssociations\.<extension>\OpenWithList

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths

The most popular one would be this: HKEY_CURRENT_USER\Software\Microsoft\Windows\
CurrentVersion\Explorer\FileExts\.<extension>\OpenWithList

Remove the OpenWithList should fix the default "Open With" program listed in the file's properties.

If a file is not opening properly or if you're crafty and would like to modify how your specific program opens, this is in the "classroot" section of the registry.  This section will also modify this for every user of the computer, not just yourself.
HKEY_CLASSES_ROOT\.<application name>\Shell\Open\Command
Then edit the (default) key data.

Remember, every time you edit the registry, restarting the explorer.exe process doesn't always work as it depends on where you edit the registry that would be taking effect.  For all of the above, save yourself the headache and just reboot the computer.