Difference between revisions of "ECE497 Tips and Tricks"
(→Mounting dfs/afs: Added Ubuntu) |
(→Installing Ubuntu: Added resizing a partition) |
||
Line 121: | Line 121: | ||
The second link references instructions for installing another image. This image is very minimal, and doesn't have a gui. There are instructions for installing a gui, which I did, with good success. As far as I can tell, even with the gui, this is the fastest image so far. | The second link references instructions for installing another image. This image is very minimal, and doesn't have a gui. There are instructions for installing a gui, which I did, with good success. As far as I can tell, even with the gui, this is the fastest image so far. | ||
+ | |||
+ | == Resizing an SD card partition via the Beagle == | ||
+ | |||
+ | The following is a slick way to boot the Beagle so it isn't using the SD, then repartition the SD card. It came from [http://groups.google.com/group/beagleboard/browse_thread/thread/3be77bc54feb08a6/b792e092e3c48989?lnk=gst&q=resize+partition#b792e092e3c48989] | ||
+ | |||
+ | Jason Kridner says ... | ||
+ | I got a related question from Mark about how to perform the partition | ||
+ | resizing, so I figured I'd address that here. I don't believe you'd | ||
+ | be able to resize a mounted partition and that this operation would | ||
+ | require another file system to mount. Because this image does not | ||
+ | have the ramdisk, I downloaded the one used being shipped with the xM | ||
+ | boards today [http://www.google.com/url?sa=D&q=http://beagleboard-validation.s3.amazonaws.com/deploy/201008201549/sd/ramdisk.gz]. | ||
+ | <pre> | ||
+ | root@beagleboard:~# wget | ||
+ | http://www.google.com/url?sa=D&q=http://beagleboard-validation.s3.amazonaws.com/deploy/201008201549/sd/ramdisk.gz | ||
+ | Connecting to beagleboard-validation.s3.amazonaws.com (72.21.214.39:80) | ||
+ | ramdisk.gz 100% |*******************************| 19492k 00:00:00 ETA | ||
+ | root@beagleboard:~# cp ramdisk.gz /media/mmcblk0p1/ | ||
+ | root@beagleboard:~# shutdown -r now | ||
+ | </pre> | ||
+ | I halted the board during reboot and did: | ||
+ | <pre> | ||
+ | OMAP3 beagleboard.org # mmc rescan 0 | ||
+ | OMAP3 beagleboard.org # run loaduimage | ||
+ | Loading file "/boot/uImage" from mmc device 0:2 (xxa2) | ||
+ | 3194256 bytes read | ||
+ | OMAP3 beagleboard.org # run loadramdisk | ||
+ | reading ramdisk.gz | ||
+ | 19960110 bytes read | ||
+ | OMAP3 beagleboard.org # run ramboot | ||
+ | </pre> | ||
+ | I allowed it to boot and did: | ||
+ | <pre> | ||
+ | root@beagleboard:~# umount /dev/mmcblk0p1 | ||
+ | root@beagleboard:~# umount /dev/mmcblk0p2 | ||
+ | root@beagleboard:~# fdisk /dev/mmcblk0 | ||
+ | Command (m for help): p | ||
+ | Disk /dev/mmcblk0: 3965 MB, 3965190144 bytes | ||
+ | 255 heads, 63 sectors/track, 482 cylinders | ||
+ | Units = cylinders of 16065 * 512 = 8225280 bytes | ||
+ | Sector size (logical/physical): 512 bytes / 512 bytes | ||
+ | Disk identifier: 0x00000000 | ||
+ | Device Boot Start End Blocks Id System | ||
+ | /dev/mmcblk0p1 * 1 15 120456 c W95 FAT32 (LBA) | ||
+ | /dev/mmcblk0p2 16 444 3445942+ 83 Linux | ||
+ | Command (m for help): d | ||
+ | Partition number (1-4): 2 | ||
+ | Command (m for help): n | ||
+ | Command action | ||
+ | e extended | ||
+ | p primary partition (1-4) | ||
+ | p | ||
+ | Partition number (1-4): 2 | ||
+ | First cylinder (16-482, default 16): | ||
+ | Using default value 16 | ||
+ | Last cylinder, +cylinders or +size{K,M,G} (16-482, default 482): | ||
+ | Using default value 482 | ||
+ | Command (m for help): w | ||
+ | The partition table has been altered! | ||
+ | Calling ioctl() to re-read partition table. | ||
+ | Syncing disks. | ||
+ | root@beagleboard:~# umount /dev/mmcblk0p2 | ||
+ | root@beagleboard:~# resize2fs /dev/mmcblk0p2 | ||
+ | resize2fs 1.41.9 (22-Aug-2009) | ||
+ | Resizing the filesystem on /dev/mmcblk0p2 to 937794 (4k) blocks. | ||
+ | The filesystem on /dev/mmcblk0p2 is now 937794 blocks long. | ||
+ | root@beagleboard:~# shutdown -r now | ||
+ | </pre> | ||
+ | I then waited for the reboot. That was all there was to it. | ||
+ | Going the other way would require performing the resize operation | ||
+ | first and specifying the size. | ||
+ | |||
+ | Anyone care to automate this and submit this to Angstrom? |
Revision as of 08:45, 2 April 2011
Some useful tips and tricks for Linux and the Beagleboard.
Contents
Quick Tips
Tip | Description |
---|---|
gnome-open | Open a file or directory using the default program |
Give the IP address a name | Inside /etc/hosts add a line of the form <IP address> <alias> this will allow you to refer to the host by name. |
bash
Tip | Description |
---|---|
Ctrl-r | Reverse incremental search |
Ctrl-g | Abort command |
Esc-. | Insert last argument from last command |
ssh
Suspending ssh
Most programs can be suspended by typing ^z (Ctrl-z). If you have an ssh connection to another machine you can suspend it by entering ~^z. You can resume the connection by entering fg.
ssh and X-windows
When using ssh between to X-windows systems try
host$ ssh -CY root@beagle
The -Y set the DISPLAY variable on the remote machine so you can open windows from the beagle on your host machine.
The -C compressed the data over the link. Good for slow connections.
Authorizing ssh
ssh and sftp can be set up for automatic authorization so you don't have to enter your password when using these commands. Here's how to do it:
- On your host computer run
host $ ssh-keygen host $ cd ~/.ssh host $ sftp Beagle put id_rsa.pub exit host $ ssh Beagle
The first command creates an authorization key and places it in your .ssh directory. Remember the pass phrase you enter here. You'll use it below. The next two commands copy that key to your Beagle. The last command connects to your Beagle.
- On your Beagle run
beagle $ mkdir ~/.ssh beagle $ cd ~/.ssh beagle $ mv ../id_rsa.pub . beagle $ cp id_rsa.pub authorized_keys beagle $ exit
Here we create a .ssh directory and copy the public key into it. The authorized_keys folder contains a list of all the machines that are authorized to connect to your Beagle without a password.
- Back on the host computer:
host $ ssh Beagle
This time you should see a window pop up. Enter your pass phrase from above. You should be logged into your Beagle. Log out and log in again. This time you should get access without having to enter your pass phrase.
Here is move information on ssh authorization.
Mounting dfs/afs
You can set up your Linux box to directly mount your afs and dfs files. The Rose-Hulman Linux Users' Group has a nice page with the details .
After installing sshfs
I added the following to my /etc/fstab
file:
sshfs#username@dfs.Rose-hulman.edu:/MyDocs/username /home/username/MyDocs fuse user,noauto,uid=1000,gid=1000 0 0 sshfs#username@dfs.rose-hulman.edu:/Users/Y/username /home/username/dfs-home fuse user,noauto,uid=1000,gid=1000 0 0 sshfs#username@afs.rose-hulman.edu: /home/username/afs-home fuse user,noauto,uid=1000,gid=1000 0 0
You'll have to replace username
with your login name. Then create the mount points:
cd ~ mkdir MyDocs mkdir dfs-home mkdir afs-home
Now you can mount your files by using:
cd ~ mount dfs-home cd dfs-home ls
You should now see your dfs files. You can unmount using:
cd ~ sudo umount dfs-home
Installing Ubuntu
I've installed 2 different versions of Ubuntu on my SD cards. Each of my SD cards is 4GB, and this is just large enough to hold the Ubuntu images.
I followed the instructions from here and here.
The first link references a Ubuntu wiki which details how to install a netbook edition of Ubuntu on ARM/OMAP processor-based systems. It is not beagle-specific. This image runs a little slowly, but not much slower than the SPEd image.
The second link references instructions for installing another image. This image is very minimal, and doesn't have a gui. There are instructions for installing a gui, which I did, with good success. As far as I can tell, even with the gui, this is the fastest image so far.
Resizing an SD card partition via the Beagle
The following is a slick way to boot the Beagle so it isn't using the SD, then repartition the SD card. It came from [1]
Jason Kridner says ... I got a related question from Mark about how to perform the partition resizing, so I figured I'd address that here. I don't believe you'd be able to resize a mounted partition and that this operation would require another file system to mount. Because this image does not have the ramdisk, I downloaded the one used being shipped with the xM boards today [2].
root@beagleboard:~# wget http://www.google.com/url?sa=D&q=http://beagleboard-validation.s3.amazonaws.com/deploy/201008201549/sd/ramdisk.gz Connecting to beagleboard-validation.s3.amazonaws.com (72.21.214.39:80) ramdisk.gz 100% |*******************************| 19492k 00:00:00 ETA root@beagleboard:~# cp ramdisk.gz /media/mmcblk0p1/ root@beagleboard:~# shutdown -r now
I halted the board during reboot and did:
OMAP3 beagleboard.org # mmc rescan 0 OMAP3 beagleboard.org # run loaduimage Loading file "/boot/uImage" from mmc device 0:2 (xxa2) 3194256 bytes read OMAP3 beagleboard.org # run loadramdisk reading ramdisk.gz 19960110 bytes read OMAP3 beagleboard.org # run ramboot
I allowed it to boot and did:
root@beagleboard:~# umount /dev/mmcblk0p1 root@beagleboard:~# umount /dev/mmcblk0p2 root@beagleboard:~# fdisk /dev/mmcblk0 Command (m for help): p Disk /dev/mmcblk0: 3965 MB, 3965190144 bytes 255 heads, 63 sectors/track, 482 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/mmcblk0p1 * 1 15 120456 c W95 FAT32 (LBA) /dev/mmcblk0p2 16 444 3445942+ 83 Linux Command (m for help): d Partition number (1-4): 2 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (16-482, default 16): Using default value 16 Last cylinder, +cylinders or +size{K,M,G} (16-482, default 482): Using default value 482 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. root@beagleboard:~# umount /dev/mmcblk0p2 root@beagleboard:~# resize2fs /dev/mmcblk0p2 resize2fs 1.41.9 (22-Aug-2009) Resizing the filesystem on /dev/mmcblk0p2 to 937794 (4k) blocks. The filesystem on /dev/mmcblk0p2 is now 937794 blocks long. root@beagleboard:~# shutdown -r now
I then waited for the reboot. That was all there was to it. Going the other way would require performing the resize operation first and specifying the size.
Anyone care to automate this and submit this to Angstrom?