Created
July 14, 2011 04:37
-
-
Save adamvr/1081946 to your computer and use it in GitHub Desktop.
Bare minimum creating a beagleboard SD card
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Reformat disc | |
| # Create master boot record | |
| sudo parted --script /dev/sdb mklabel msdos | |
| # Setup boot partition as FAT16 | |
| sudo fdisk /dev/sdb << END | |
| n | |
| p | |
| 1 | |
| 1 | |
| +64M | |
| t | |
| e | |
| p | |
| w | |
| END | |
| sync | |
| # Make disc bootable | |
| sudo parted --script /dev/sdb set 1 boot on | |
| # Calculate end of boot partition and end of disc | |
| Eb=$(sudo parted -s /dev/sdb unit mb print free | grep primary | awk '{print $3}' | cut -d 'M' -f1) | |
| Ed=$(sudo parted -s /dev/sdb unit mb print free | grep Free | tail -n 1 | awk '{print $3}' | cut -d 'M' -f1) | |
| # Create rootfs partition | |
| sudo parted --script /dev/sdb mkpart primary ext2 $Eb $Ed | |
| sync | |
| # Format boot partition | |
| sudo mkfs.vfat -F 16 /dev/sdb1 -n root | |
| # Format rootfs partition | |
| sudo mkfs.ext2 /dev/sdb2 -L beagle | |
| # Mount boot partition | |
| sudo mount -t vfat /dev/sdb1 mnt | |
| # Populate boot partition | |
| sudo cp -v MLO mnt | |
| sudo cp -v u-boot.bin mnt | |
| sudo cp -v uImage mnt | |
| sudo cp -v uInitrd mnt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment