Changes between Version 3 and Version 4 of gsc/alternate_boot_device
- Timestamp:
- 07/29/2020 05:00:13 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
gsc/alternate_boot_device
v3 v4 2 2 3 3 = Alternate Boot Device 4 Some Gateworks Laguna family products have an 'Alternate boot device' that can be used for alternate firmware images, such as a flash recovery image. 4 Some Gateworks family products have an 'Alternate boot device' that can be used for alternate firmware images, such as a flash recovery image: 5 * Newport - eMMC vs microSD 6 * Laguna - NOR FLASH vs SPI FLASH 5 7 6 8 Please note that if you have a board with a 4MB SPI flash device, such as the GW2388-4 you will need to use [https://github.com/Gateworks/u-boot-cns3xxx u-boot-2014.10 cns3xxx] bootloader. 7 9 8 There are 2 ways that you can instruct the [wiki:gsc Gateworks System Controller] to boot to the **alternate boot device (an SPI FLASH device) vs the primary boot device (a NOR FLASH device)**:10 There are 2 ways that you can instruct the [wiki:gsc Gateworks System Controller] to boot to the **alternate boot device**: 9 11 1. set GSC R0.3 and press the user pushbutton 5x times to perform a 1-time hard reboot to the alternate boot device 10 12 {{{#!bash 11 13 i2cset -f -y 0 0x20 0 0x08 12 14 }}} 13 2. set GSC R1.6 (SWITCH_BOOT_ENABLE) to enable 'switch boot check'. If this is set when the board powers on, it will 'toggle' boot device selection and reboot after 30 seconds unless GSC R1.7 (SWITCH_BOOT_CLEAR) has been set before that time. Note that the countdown timer is only activated when the board powers on from a GSC sleep or unpowered state 14 15 == Flash Mapping 16 This is an example from a Laguna 2388 with 16MB NOR and 4MB SPI. The mapping is set by us but can be changed. 17 18 {{{#!bash 19 root@(none):/# cat /proc/mtd 20 dev: size erasesize name 21 mtd0: 00040000 00020000 "uboot" 22 mtd1: 00020000 00020000 "params" 23 mtd2: 00200000 00020000 "kernel" 24 mtd3: 00da0000 00020000 "rootfs" 25 mtd4: 007c0000 00020000 "rootfs_data" 26 mtd5: 00040000 00010000 "uboot" 27 mtd6: 00040000 00010000 "params" 28 mtd7: 00180000 00010000 "kernel" 29 mtd8: 00200000 00010000 "rootfs" 30 }}} 15 2. set GSC R1.6 (SWITCH_BOOT_ENABLE) to enable 'switch boot check' (see below). If this is set when the board powers on, it will 'toggle' boot device selection and reboot after 30 seconds unless GSC R1.7 (SWITCH_BOOT_CLEAR) has been set before that time. Note that the countdown timer is only activated when the board powers on from a GSC sleep or unpowered state 31 16 32 17 == Auto Switch Boot Device … … 46 31 {{{#!bash 47 32 i2cset -f -y 0 0x20 1 0xC0 ;# cancel countdown by asserting R1.7 (SWITCH_BOOT_CLEAR) but keep enabled R1.6 (SWITCH_BOOT_ENABLE) 48 # or49 i2cset -f -y 0 0x20 1 0x80 ;# cancel countdown by asserting R1.7 (SWITCH_BOOT_CLEAR) and disable R1.6 (SWITCH_BOOT_ENABLE)50 33 }}} 51 34 52 To programatically hard power-cycle the board by putting it to sleep for a few seconds while also enabling 'switch boot':53 {{{#!bash54 # power cycle board: must be a hard power cycle, not a soft reboot (which can be done manually or via sleep/wake timer control)55 i2cset -f -y 0 0x20 6 5 ;# write add timer to 5sec56 i2cset -f -y 0 0x20 7 057 i2cset -f -y 0 0x20 8 058 i2cset -f -y 0 0x20 9 059 i2cset -f -y 0 0x20 1 0x04 ;# set add time bit (must be a separate i2c transaction than activating sleep)60 i2cset -f -y 0 0x20 1 0x43 ;# enable R1.6 (SWITCH_BOOT_ENABLE), sleep operation (R1.0) and activate sleep (R1.1)61 # wait for board to reboot into linux and within 30 seconds of powerup cancel the boot timer62 i2cset -f -y 0 0x20 1 0xC0 ;# set R1.7 (SWITCH_BOOT_CLEAR) to cancel timer but leave R1.6 (SWITCH_BOOT_ENABLE) enabled63 }}}64 35 65 36 === From u-boot … … 76 47 }}} 77 48 78 To programatically hard power-cycle the board by putting it to sleep for a few seconds while also enabling 'switch boot':79 {{{#!bash80 Laguna > imw 0x20 6 0x05 1 # LSB (5 secs)81 Laguna > imw 0x20 7 0x00 182 Laguna > imw 0x20 8 0x00 183 Laguna > imw 0x20 9 0x00 1 # MSB84 Laguna > imw 0x20 1 0x04 1 # latch R6-R9 and add to RTC85 Laguna > imw 0x20 1 0x43 1 # set SWITCH_BOOT_ENABLE (R1.6), sleep operation (R1.0) and activate sleep (R1.1)86 }}}87 88 49 89 50 == Alternate Boot Flash firmware images 90 51 91 === Step 1. Bootloader 52 53 === Newport Product families 54 The Newport boards have a primary eMMC device and a removable microSD device that can be used as an **alternate boot device**. Because these are both MMC devices, the same boot firmware can be used on each device. 55 56 === Laguna Product families 57 The Laguna boards have a primary NOR FLASH device and a smaller SPI FLASH device for an **alternate boot device**. Because of the differences in the FLASH types you need to have a different bootloader on each device. 58 59 ==== Step 1. Bootloader 92 60 The alternate boot device and the primary boot device require different bootloaders **(SPI vs NOR FLASH)**. Only the primary boot device is programmed with a bootable image by Gateworks. In order to program the alternate boot device you will need to do so from Linux (as u-boot-nor.bin on the primary boot device without modification can only access NOR flash). 93 61 … … 110 78 Now you can follow the instructions above to boot off the **Alternate Boot Device** (SPI Flash) and setup your kernel/rootfs using the instructions for an SPI FLASH device such as the GW2380 found here here 111 79 112 === Step 2. Kernel / Root Filesystem80 ==== Step 2. Kernel / Root Filesystem 113 81 Depending on the size of the SPI FLASH you will likely **need to prune features from your kernel/filesystem**. A good starting point may be the Laguna test_config file which uses a ramdisk and a minimal set of utilities used by Gateworks to test boards. As this OpenWrt config file specifies an INTRAMFS ramdisk, you only need to flash the kernel which includes the root filesystem. 114 82 … … 156 124 }}} 157 125 158 === Using u-boot-2014.10-cns3xxx bootloader126 ==== Using u-boot-2014.10-cns3xxx bootloader 159 127 If using the [https://github.com/Gateworks/u-boot-cns3xxx u-boot-2014.10-cns3xxx] which supports both the 16MB and 4MB SPI flash devices used on Laguna products, you will need to use the 'sf' commands within uboot to access flash. 160 128