Changes between Initial Version and Version 1 of laguna/gw2388-4


Ignore:
Timestamp:
10/22/2017 05:28:45 AM (21 months ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • laguna/gw2388-4

    v1 v1  
     1[[PageOutline]]
     2
     3[[Image(wiki:laguna:gw2388-4.jpg,200px)]]
     4
     5= Gateworks Laguna GW2388-4 and Other Laguna NOR Based Boards =
     6== Useful Information ==
     7
     8Gateworks has created a list of information that we have deemed useful to anybody looking to become familiar with the GW2388-4 or looking for development information on the GW2388-4. A list of this information has been provided below.
     9 * [http://www.gateworks.com/product/item/laguna-gw2388-4-network-processor GW2388-4 Product Info]
     10 * [wiki:laguna/hw_compatibility Hardware Compatibility]
     11 * [wiki:laguna/sw_compatibility Software Compatibility]
     12 * [wiki:laguna/performance_upgrades Performance Improvements]
     13 * [wiki:laguna/peripherals Peripherals and Drivers]
     14 * [wiki:gsc Gateworks System Controler]
     15 * [wiki:gateworks_linux_test_commands Linux Commands to test peripherals]
     16 * [wiki:laguna/bootloader Laguna bootloader]
     17 * [wiki:laguna/openwrt OpenWrt for the Laguna Family]
     18 * [wiki:laguna/smp_benchmarks Laguna SMP Benchmarks using FIQ's]
     19 * [wiki:laguna/faq Laguna FAQ]
     20 * [http://shop.gateworks.com Where to Buy]
     21 * [http://www.gateworks.com/products/laguna/datasheets/gw2388-4ds.pdf GW2388-4 Datasheet]
     22
     23
     24= Booting from microSD (uSD) =
     25'''NOTE: Problems have been reported with certain SD cards.  If you are experiencing issues, please try a different brand/card/etc. Additional note, there was an issue with Uboot not detecting the uSD which has been fixed in the latest Uboot release. The binary for the updated Uboot can be found in the pre-built images directory. '''
     26
     27There are many options and configurations for booting from microSD. 
     28 1. The bootloader must have support for any device/filesystem you use within the bootloader.
     29 2. The kernel must have support for whatever root filesystem device/type you wish to use as the rootfs. 
     30 3. You must choose a partitioning scheme and image your microSD properly.  You can even mix things up a bit more by booting partially from FLASH and partially from microSD.
     31
     32The GW2388 bootloader configuration supports FAT fiilesystems on MMC devices.  While the linux kernel supports a variety of block device filesystems, to keep the static kernel size down for our FLASH configuration, our default kernel configuration supports only the following 'FLASH' based filesystems: overlayfs, jffs2, squashfs.
     33
     34To boot from microSD you will need to build your own firmware with the following options/configuration changes:
     35 1. either use a FAT filesystem on uSD or rebuild u-boot with ext2 support
     36 2. rebuild the kernel with other commonly used block filesystem support (ie ext2/ext3/ext4) and use the proper rootfs= parameter to tell the kernel where your rootfs is
     37
     38== Example 1.  Kernel and Root Filesystem On Card ==
     39
     40As an example here is how you would boot from uSD with your kernel on a small FAT partition and your rootfs on an ext3 fs on the remainder of the device:
     41=== Step 1 - Add ext2/ext4 support to the kernel ===
     42 * Add ext2 support to kernel: '''run 'make kernel_menuconfig' and add support for EXT2 via 'File systems' -> 'Ext3 journalling file system support' (CONFIG_EXT3_FS)'''
     43 * '''NOTE:'''  If problems occur, one may try turning off squashfs in the config.
     44=== Step 2 - Modify OpenWrt to output tarball ===
     45 * Configure OpenWRT to create a root filesystem tarball:  ''''make menuconfig' select 'Target Images' -> 'tar.gz' (CONFIG_TARGET_ROOTFS_TARGZ=y)'''
     46
     47
     48 * To see what SD card is attached to a Linux Desktop use the command {{{df -h}}}
     49
     50=== Step 3 - Create MicroSD Card On Linux Desktop Machine ===
     51 * Create a microSD with a small FAT partition as partition1 where you place the kernel uImage as 'uImage' and the rest an ext4 fs where you untar the root filesystem created above.  For example, on a linux system where /dev/sdb is the device where your uSD is (understand this carefully as you do NOT want to re-partition and format your host drive):
     52{{{#!bash
     53# partition /dev/sde with a 9MB FAT partition and the rest a Linux partition
     54sfdisk -uS /dev/sde << EOF
     55,$((9*2048)),c,*,
     56$((9*2048)),,L,,
     57EOF
     58}}}
     59Example Output:
     60{{{
     61
     62
     63ryan@Ryan:~/Downloads/binaries/images$ sudo sfdisk -uS /dev/sde << EOF
     64,$((9*2048)),c,*,
     65$((9*2048)),,L,,
     66EOF
     67Checking that no-one is using this disk right now ...
     68OK
     69
     70Disk /dev/sdb: 60480 cylinders, 4 heads, 32 sectors/track
     71Old situation:
     72Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0
     73
     74   Device Boot Start   End    MiB    #blocks   Id  System
     75/dev/sdb1   *     0+     8      9-      9215+   c  W95 FAT32 (LBA)
     76/dev/sdb2         9   3779   3771    3861504   83  Linux
     77/dev/sdb3         0      -      0          0    0  Empty
     78/dev/sdb4         0      -      0          0    0  Empty
     79New situation:
     80Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0
     81
     82   Device Boot Start   End    MiB    #blocks   Id  System
     83/dev/sdb1   *     0+     8      9-      9215+   c  W95 FAT32 (LBA)
     84/dev/sdb2         9   3779   3771    3861504   83  Linux
     85/dev/sdb3         0      -      0          0    0  Empty
     86/dev/sdb4         0      -      0          0    0  Empty
     87Successfully wrote the new partition table
     88
     89Re-reading the partition table ...
     90
     91}}}
     92
     93''' Continuing on with the steps....'''
     94{{{
     95# hotplug the uSD or manually mount /dev/sde1 and /dev/sde2 so that the partitions are mounted on your Linux host
     96mkfs.vfat /dev/sde1
     97mount /dev/sde1 /mnt
     98cp bin/cns3xxx/openwrt-cns3xxx-uImage /mnt/uImage
     99umount /dev/sde1
     100mkfs.ext4 /dev/sde2
     101mount /dev/sde2 /mnt
     102cp build_dir/linux-cns3xxx/ext4 /dev/sde2
     103umount /dev/sde2
     104}}}
     105
     106=== Step 4 - Insert SD Card into Gateworks Board  ===
     107 * boot the standard u-boot which has FAT fs support on GW2388 with your uSD in the card slot and use the following uboot commands to load the kernel from FAT partition and boot the kernel with a rootfs of the ext4 partition:
     108{{{
     109mmcinit
     110fatload mmc 0:1 0x00800000 uImage
     111setenv bootargs 'console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 noinitrd init=/etc/preinit'
     112bootm 0x00800000
     113}}}
     114
     115== Example 2. Only Root Filesystem On Card ==
     116
     117=== Step 1 - Add ext2/ext4 support to the kernel ===
     118 * Add ext4 support to kernel: '''run 'make kernel_menuconfig' and add support for EXT4 via 'File systems' -> 'The Extended 4 (ext4) filesystem' '''
     119 * Rebuild the kernel by typing '''make -j8 V=99''' from the trunk directory
     120 * Look for the kernel output '''/gateworks-openwrt/trunk/bin/cns3xxx/openwrt-cns3xxx-uImage'''
     121
     122=== Step 2 - Copy the Kernel to Gateworks Board ===
     123 * [wiki:laguna/openwrt#NORFlashGW2387GW2388GW2391 Copy Kernel To Board]
     124
     125=== Step Create Tarball of OpenWrt Linux Filesystem ===
     126 * Configure OpenWRT to create a root filesystem tarball:  ''''make menuconfig' select 'Target Images' -> 'tar.gz' (CONFIG_TARGET_ROOTFS_TARGZ=y)'''
     127 * Rebuild the root filesystem by typing '''make -j8 V=99''' from the trunk directory
     128 * Look for the kernel output '''/gateworks-openwrt/trunk/bin/cns3xxx/openwrt-cns3xxx-rootfs.tar.gz'''
     129
     130=== Step  Create MicroSD Card & Copy Root Filesystem ===
     131Format the SD card on Linux Desktop Computer then place the root filesystem onto the SD Card.[[BR]]
     132[[BR]]
     133''' NOTE: Each SD card may be a different device on your system.  It may not be /dev/sdc as outlined below: '''
     134{{{
     135DISK=/dev/sdc
     136printf ",,L,,\n" | sudo sfdisk -uS ${DISK}
     137sudo mkfs.ext4 ${DISK}1
     138sudo mount ${DISK}1 /mnt/disk
     139sudo tar xvf gateworks-openwrt/trunk/bin/cns3xxx/openwrt-cns3xxx-rootfs.tar.gz -C /mnt/disk
     140sudo umount /mnt/disk
     141}}}
     142
     143=== Step Insert MicroSD into Laguna Gateworks Board ===
     144 * Boot the Gateworks Board and immediately break into the bootloader by hitting a key on the keyboard
     145  *   
     146{{{
     147Hit any key to stop autoboot:  0
     148         Laguna > 
     149}}}
     150 * Change the Bootargs to tell the kernel to boat to the rootfs on the sd card (which is /dev/mmcblk0p1 - p1 denotes partition one )[[BR]]
     151'''NOTE: You may want to record or save your old bootargs in case you want to return back to stock'''
     152{{{
     153setenv bootargs 'console=ttyS0,115200 root=/dev/mmcblk0p1 rootfstype=ext4 rootwait'
     154}}}
     155 * Save the variable...
     156{{{
     157saveenv
     158}}}
     159 * Boot the board
     160{{{
     161boot
     162}}}
     163 * You can tell the SD card is being booted to by seeing lines in the bootup that look something similar to below:
     164{{{
     165[    2.050000] 0x000000200000-0x000000400000 : "rootfs"
     166[    2.050000] split_squashfs: no squashfs found in "spi1.0"
     167[    2.070000]  mmcblk0: p1
     168[    2.080000] rtc-ds1672 0-0068: setting system clock to 1970-01-01 00:42:28 UTC (2548)
     169[    2.490000] EXT4-fs (mmcblk0p1): recovery complete
     170[    2.500000] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
     171[    2.510000] VFS: Mounted root (ext4 filesystem) on device 179:1.
     172}}}
     173     
     174