{"id":575,"date":"2011-11-21T13:35:25","date_gmt":"2011-11-21T13:35:25","guid":{"rendered":"http:\/\/41j.com\/blog\/?p=575"},"modified":"2011-11-22T15:13:03","modified_gmt":"2011-11-22T15:13:03","slug":"setting-up-a-gumstix-sd-card","status":"publish","type":"post","link":"https:\/\/41j.com\/blog\/2011\/11\/setting-up-a-gumstix-sd-card\/","title":{"rendered":"Setting up a gumstix SD Card"},"content":{"rendered":"<p>My notes, based on http:\/\/gumstix.org\/create-a-bootable-microsd-card.html<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nfdisk -l \/dev\/sdd\r\n\r\nDisk \/dev\/sdd: 32.2 GB, 32191283200 bytes\r\n255 heads, 63 sectors\/track, 3913 cylinders\r\nUnits = cylinders of 16065 * 512 = 8225280 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk identifier: 0x00000000\r\n\r\n   Device Boot      Start         End      Blocks   Id  System\r\n\/dev\/sdd1               1        3914    31432704    c  W95 FAT32 (LBA)\r\n<\/pre>\n<p>Calculate number of cylinders required:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nroot@ubuntu:~# bc -l\r\nbc 1.06.95\r\nCopyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.\r\nThis is free software with ABSOLUTELY NO WARRANTY.\r\nFor details type `warranty'. \r\n32191283200\/255\/63\/512\r\n3913.70059134765017117958\r\nquit\r\n<\/pre>\n<p>Wipe the SD card:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nroot@ubuntu:~# dd if=\/dev\/zero of=\/dev\/sdd bs=1024 count=1024\r\n1024+0 records in\r\n1024+0 records out\r\n1048576 bytes (1.0 MB) copied, 2.84156 s, 369 kB\/s\r\n<\/pre>\n<p>Parition the disk:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nroot@ubuntu:~# sfdisk --force -D -uS -H 255 -S 63 -C 3913 \/dev\/sdd\r\nChecking that no-one is using this disk right now ...\r\nOK\r\n\r\nDisk \/dev\/sdd: 3913 cylinders, 255 heads, 63 sectors\/track\r\n\r\nsfdisk: ERROR: sector 0 does not have an MSDOS signature\r\n \/dev\/sdd: unrecognised partition table type\r\nOld situation:\r\nNo partitions found\r\nInput in the following format; absent fields get a default value.\r\n&lt;start&gt; &lt;size&gt; &lt;type &#x5B;E,S,L,X,hex]&gt; &lt;bootable &#x5B;-,*]&gt; &lt;c,h,s&gt; &lt;c,h,s&gt;\r\nUsually you only need to specify &lt;start&gt; and &lt;size&gt; (and perhaps &lt;type&gt;).\r\n\r\n\/dev\/sdd1 :128,130944,0x0C,*\r\n\/dev\/sdd1   *       128    131071     130944   c  W95 FAT32 (LBA)\r\n\/dev\/sdd2 :131072,,,-\r\n\/dev\/sdd2        131072  62873599   62742528  83  Linux\r\n\/dev\/sdd3 :\r\n\/dev\/sdd3             1       127        127  83  Linux\r\n\/dev\/sdd4 :\r\n\/dev\/sdd4             0         -          0   0  Empty\r\nNew situation:\r\nUnits = sectors of 512 bytes, counting from 0\r\n\r\n   Device Boot    Start       End   #sectors  Id  System\r\n\/dev\/sdd1   *       128    131071     130944   c  W95 FAT32 (LBA)\r\n\/dev\/sdd2        131072  62873599   62742528  83  Linux\r\n\/dev\/sdd3             1       127        127  83  Linux\r\n\/dev\/sdd4             0         -          0   0  Empty\r\nWarning: partition 1 does not end at a cylinder boundary\r\nDo you want to write this to disk? &#x5B;ynq] y\r\nSuccessfully wrote the new partition table\r\n\r\nRe-reading the partition table ...\r\n\r\nIf you created or changed a DOS partition, \/dev\/foo7, say, then use dd(1)\r\nto zero the first 512 bytes:  dd if=\/dev\/zero of=\/dev\/foo7 bs=512 count=1\r\n(See fdisk(8).)\r\n<\/pre>\n<p>Format the paritions:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nroot@ubuntu:~# mkfs.vfat -F 32 \/dev\/sdd1 -n boot\r\nmkfs.vfat 3.0.7 (24 Dec 2009)\r\nroot@ubuntu:~# mke2fs -j -L rootfs \/dev\/sdd2\r\nmke2fs 1.41.11 (14-Mar-2010)\r\nFilesystem label=rootfs\r\nOS type: Linux\r\nBlock size=4096 (log=2)\r\nFragment size=4096 (log=2)\r\nStride=0 blocks, Stripe width=0 blocks\r\n1962240 inodes, 7842816 blocks\r\n392140 blocks (5.00%) reserved for the super user\r\nFirst data block=0\r\nMaximum filesystem blocks=4294967296\r\n240 block groups\r\n32768 blocks per group, 32768 fragments per group\r\n8176 inodes per group\r\nSuperblock backups stored on blocks: \r\n\t32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, \r\n\t4096000\r\n\r\nWriting inode tables: done                            \r\nCreating journal (32768 blocks): done\r\nWriting superblocks and filesystem accounting information: done\r\n\r\nThis filesystem will be automatically checked every 21 mounts or\r\n180 days, whichever comes first.  Use tune2fs -c or -i to override.\r\n<\/pre>\n<p>Mount the partitions and copy the current root to them:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nroot@ubuntu:~# sudo mkdir \/media\/{boot,rootfs}\r\nroot@ubuntu:~# sudo mount -t vfat \/dev\/sdd1 \/media\/boot\r\nroot@ubuntu:~# sudo mount -t ext3 \/dev\/sdd2 \/media\/rootfs\r\nroot@ubuntu:~# cd \/media\/boot\/\r\nroot@ubuntu:\/media\/boot# ls\r\nroot@ubuntu:\/media\/boot# cd ~\r\nroot@ubuntu:~# wget http:\/\/cumulus.gumstix.org\/images\/angstrom\/developer\/current\/MLO\r\n--2011-11-21 11:31:12--  http:\/\/cumulus.gumstix.org\/images\/angstrom\/developer\/current\/MLO\r\nResolving cumulus.gumstix.org... 74.3.164.55\r\nConnecting to cumulus.gumstix.org|74.3.164.55|:80... connected.\r\nHTTP request sent, awaiting response... 200 OK\r\nLength: 24304 (24K)\r\nSaving to: `MLO'\r\n\r\n100% 24,304      49.8K\/s   in 0.5s    \r\n\r\n2011-11-21 11:31:13 (49.8 KB\/s) - `MLO' saved &#x5B;24304\/24304]\r\n\r\nroot@ubuntu:~# mv MLO \/media\/boot\r\nroot@ubuntu:~# wget http:\/\/cumulus.gumstix.org\/images\/angstrom\/developer\/current\/u-boot.bin\r\n--2011-11-21 11:31:48--  http:\/\/cumulus.gumstix.org\/images\/angstrom\/developer\/current\/u-boot.bin\r\nResolving cumulus.gumstix.org... 74.3.164.55\r\nConnecting to cumulus.gumstix.org|74.3.164.55|:80... connected.\r\nHTTP request sent, awaiting response... 200 OK\r\nLength: 269120 (263K) &#x5B;application\/octet-stream]\r\nSaving to: `u-boot.bin'\r\n\r\n100% 269,120      199K\/s   in 1.3s    \r\n\r\n2011-11-21 11:31:49 (199 KB\/s) - `u-boot.bin' saved &#x5B;269120\/269120]\r\n\r\nroot@ubuntu:~# mv u-boot.bin \/media\/boot\r\nroot@ubuntu:~# wget http:\/\/cumulus.gumstix.org\/images\/angstrom\/developer\/current\/uImage\r\n--2011-11-21 11:32:08--  http:\/\/cumulus.gumstix.org\/images\/angstrom\/developer\/current\/uImage\r\nResolving cumulus.gumstix.org... 74.3.164.55\r\nConnecting to cumulus.gumstix.org|74.3.164.55|:80... connected.\r\nHTTP request sent, awaiting response... 200 OK\r\nLength: 3091308 (2.9M) \r\nSaving to: `uImage'\r\n\r\n100% 3,091,308    205K\/s   in 15s     \r\n\r\n2011-11-21 11:32:23 (196 KB\/s) - `uImage' saved &#x5B;3091308\/3091308]\r\n\r\nroot@ubuntu:~# mv uImage \/media\/boot\r\nroot@ubuntu:~# wget http:\/\/cumulus.gumstix.org\/images\/angstrom\/developer\/current\/omap3-desktop-image-overo.tar.bz2\r\n--2011-11-21 11:34:06--  http:\/\/cumulus.gumstix.org\/images\/angstrom\/developer\/current\/omap3-desktop-image-overo.tar.bz2\r\nResolving cumulus.gumstix.org... 74.3.164.55\r\nConnecting to cumulus.gumstix.org|74.3.164.55|:80... connected.\r\nHTTP request sent, awaiting response... 200 OK\r\nLength: 234752536 (224M) &#x5B;application\/x-bzip2]\r\nSaving to: `omap3-desktop-image-overo.tar.bz2'\r\n\r\n100% 234,752,536  396K\/s   in 13m 58s \r\n\r\n2011-11-21 11:48:04 (274 KB\/s) - `omap3-desktop-image-overo.tar.bz2' saved &#x5B;234752536\/234752536]\r\n\r\nroot@ubuntu:~#  tar xaf omap3-desktop-image-overo.tar.bz2 -C \/media\/rootfs\r\nroot@ubuntu:~# ls \/media\/rootfs\/\r\nbin  boot  dev  etc  home  lib  linuxrc  lost+found  media  mnt  proc  sbin  sys  tmp  usr  var\r\nroot@ubuntu:~# sync\r\nroot@ubuntu:~# umount \/media\/boot\r\nroot@ubuntu:~# umount \/media\/rootfs\r\n<\/pre>\n<h2>Network config<\/h2>\n<p>If your using a board with a network interface and want to use this at first boot:<\/p>\n<p>edit \/etc\/network\/interfaces<\/p>\n<p>Add the following for a static config:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nauto eth0\r\niface eth0 inet static\r\naddress 192.168.0.7\r\nnetmask 255.255.255.0\r\ngateway 192.168.0.254\r\n<\/pre>\n<p>or uncomment the following for a dynamic config:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nauto eth0\r\niface eth0 inet dhcp\r\n<\/pre>\n<p>Fin<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My notes, based on http:\/\/gumstix.org\/create-a-bootable-microsd-card.html fdisk -l \/dev\/sdd Disk \/dev\/sdd: 32.2 GB, 32191283200 bytes 255 heads, 63 sectors\/track, 3913 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical\/physical): 512 bytes \/ 512 bytes I\/O size (minimum\/optimal): 512 bytes \/ 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-575","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1RRoU-9h","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/575","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/comments?post=575"}],"version-history":[{"count":6,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/575\/revisions"}],"predecessor-version":[{"id":589,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/575\/revisions\/589"}],"wp:attachment":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/media?parent=575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/categories?post=575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/tags?post=575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}