Dual Boot uboot -vs- latest v2.1 Linux 12.04 Release

Discussion in 'General Discussion' started by allwet, Mar 25, 2014.

  1. allwet

    allwet New Member

    Joined:
    Oct 30, 2013
    Messages:
    29
    Likes Received:
    1
    Does the latest release of Linux 12.04 (v2.1) for the UDOO have the dual boot uboot I have been hearing about? If so, any instructions for use? Here is what I would like to do:
    - Set up two partitions on my sata SSD.
    - Have Linux 12.04 on one partition.
    - Have the Android release on another partition.
    - Be able to boot selectively.
    Comments? Ideas? Support?
     
  2. allwet

    allwet New Member

    Joined:
    Oct 30, 2013
    Messages:
    29
    Likes Received:
    1
    Release notes for ubuntu 12.04 v2.1 for the UDOO indicates dual boot support has been added to uboot in uboot v.119. Now, can someone please point me to some reasonable level of documentation for how to set up and use this capability?

    Thanks
     
  3. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    I may be wrong , but dual boot does not normally mean boot to A or B , but if A is not there ( Fails ) boot to B the backup route.

    Eg if you can`t find the Sata drive , boot from the SD card direct .
     
  4. allwet

    allwet New Member

    Joined:
    Oct 30, 2013
    Messages:
    29
    Likes Received:
    1
    Thanks Peter for your response. I have a sata drive up and running. /dev/sda1 is defined in my bootargs. I disconnect the sata drive and the next boot complains that it cannot find the sata device, then gives the UDOO board =>, thus, for this application your assumptions are not correct.

    More findings....
    I did some online research (Google is my friend, sometimes...). Found the following link and it led to loads of info:
    https://github.com/UDOOboard/U-Boot_Unico-2013 got me the source tree of uboot 2013. I then started drilling my way down looking for anything indicating udoo multiboot. I found I can do a "help" at the UDOO board => level and get a long list of commands. Here is my session:
    Code:
    U-Boot 2013.10-rc3 (Jan 20 2014 - 13:33:34)
    
    CPU:   Freescale i.MX6Q rev1.2 at 792 MHz
    Reset cause: POR
    Board: UDOO
    DRAM:  1 GiB
    MMC:   FSL_SDHC: 0
    auto-detected panel HDMI
    Display: HDMI (1024x768)
    In:    serial
    Out:   serial
    Err:   serial
    Net:   using phy at 6
    FEC [PRIME]
    Hit any key to stop autoboot:  5  0 
    UDOO board => ver
    
    U-Boot 2013.10-rc3 (Jan 20 2014 - 13:33:34)
    arm-fsl-linux-gnueabi-gcc (4.4.4_09.06.2010) 4.4.4
    GNU ld (GNU Binutils) 2.20.1.20100303
    UDOO board => help
    ?       - alias for 'help'
    base    - print or set address offset
    bdinfo  - print Board Info structure
    boot    - boot default, i.e., run 'bootcmd'
    bootd   - boot default, i.e., run 'bootcmd'
    bootm   - boot application image from memory
    bootp   - boot image via network using BOOTP/TFTP protocol
    bootz   - boot Linux zImage image from memory
    clocks  - display clocks
    clrlogo - fill the boot logo area with black
    cmp     - memory compare
    coninfo - print console devices and information
    cp      - memory copy
    crc32   - checksum calculation
    dcache  - enable or disable data cache
    dhcp    - boot image via network using DHCP/TFTP protocol
    echo    - echo args to console
    editenv - edit environment variable
    env     - environment handling commands
    erase   - erase FLASH memory
    exit    - exit script
    ext2load- load binary file from a Ext2 filesystem
    ext2ls  - list files in a directory (default /)
    false   - do nothing, unsuccessfully
    fatinfo - print information about filesystem
    fatload - load binary file from a dos filesystem
    fatls   - list files in a directory (default /)
    fdt     - flattened device tree utility commands
    flinfo  - print FLASH memory information
    go      - start application at address 'addr'
    hdmidet - detect HDMI monitor
    help    - print command description/usage
    icache  - enable or disable instruction cache
    iminfo  - print header information for application image
    imxtract- extract a part of a multi-image
    itest   - return true/false on integer compare
    loadb   - load binary file over serial line (kermit mode)
    loads   - load S-Record file over serial line
    loadx   - load binary file over serial line (xmodem mode)
    loady   - load binary file over serial line (ymodem mode)
    loop    - infinite loop on address range
    md      - memory display
    mdio    - MDIO utility commands
    mii     - MII utility commands
    mm      - memory modify (auto-incrementing address)
    mmc     - MMC sub system
    mmcinfo - display MMC info
    multiboot- manage a multiboot startup
    mw      - memory write (fill)
    nfs     - boot image via network using NFS protocol
    nm      - memory modify (constant address)
    ping    - send ICMP ECHO_REQUEST to network host
    plotmsg - Plot text message on current display (HDMI or LVDS).
    	 -r Overwrite last message.
    	 -u Start writing just under Logo.
    printenv- print environment variables
    protect - enable or disable FLASH write protection
    reset   - Perform RESET of the CPU
    run     - run commands in an environment variable
    sata    - SATA sub system
    saveenv - save environment variables to persistent storage
    setenv  - set environment variables
    setexpr - set environment variable as the result of eval expression
    showvar - print local hushshell variables
    sleep   - delay execution for some time
    source  - run script from memory
    test    - minimal test like /bin/sh
    tftpboot- boot image via network using TFTP protocol
    true    - do nothing, successfully
    version - print monitor, compiler and linker version
    
    UDOO board => multiboot
    UDOO interactive multiboot utility.
    Chose system you want to boot.
      > No bootable system defined: "boot_descr_1" is empty! 
      Giving up.
    UDOO board => sata
    AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
    flags: ncq stag pm led clo only pmp pio slum part 
    SATA Device Info:
    S/N:         1350095D2475
    Product model number: Crucial_CT120M500SSD1
    Firmware version: MU03
    Capacity: 234441648 sectors
    sata - SATA sub system
    
    Usage:
    sata init - init SATA sub system
    sata info - show available SATA devices
    sata device [dev] - show or set current device
    sata part [dev] - print partition table
    sata read addr blk# cnt
    sata write addr blk# cnt
    UDOO board => sata info
    
    SATA device 0: Model: Crucial_CT120M500SSD1 Firm: MU03 Ser#:         1350095D2475
                Type: Hard Disk
                Supports 48-bit addressing
                Capacity: 114473.4 MB = 111.7 GB (234441648 x 512)
    UDOO board => sata part
    
    Partition Map for SATA device 0  --   Partition Type: DOS
    
    Part	Start Sector	Num Sectors	UUID		Type
      1	16065     	230230335 	000c356e-01	83
      2	230246400 	4194304   	000c356e-02	82
    UDOO board => sata device
    
    SATA device 0: Model: Crucial_CT120M500SSD1 Firm: MU03 Ser#:         1350095D2475
                Type: Hard Disk
                Supports 48-bit addressing
                Capacity: 114473.4 MB = 111.7 GB (234441648 x 512)
    UDOO board => 
    This indicated multiboot had some subcommands.

    I did further digging into the uboot source tree and found https://github.com/UDOOboard/U-Boot_Unico-2013/blob/master/common/cmd_multiboot.c. This provided me with the source of the multiboot help command. I then tried it. Here is the session, thus the needed documentation for its usage:
    Code:
    UDOO board => multiboot d
    
    	How to setup u-boot environment for multiboot utility.
    
    Step 1) Define as much "boot_descr_X" variable as you need assigning to it
    	a title rapresenting bootable system number X. 
    	(Eg. "setenv boot_descr_1 Linux").
    
    Step 2) Define default booting entry via "default_boot" variable.
    	(Eg. "setenv default_boot 2").
    
    Step 3) For each configured bootable system there are 3 levels of variable
    	definitions which override each other in the following order:
    	  "bootargs_run_X" OVERRIDES "bootargs_X" OVERRIDES "sd_part_X"
    	  "bootcmd_run_X" OVERRIDES "bootcmd_X" OVERRIDES "sd_part_X"
    	If one of the described variable is missing the next one will be used.
    
    Here the meaning of multiboot configuration variable:
      - bootargs_run_X (where X can be 1, 2, 3, ...)
     String contained in "bootargs_run_X" will be executed inside multiboot
     environment with the following command: "run bootargs_run_X".
      - bootargs_X (where X can be 1, 2, 3, ...)
     String contained in "bootargs_X" will be adopted as bootargs environment.
      - sd_part_X (where X can be 1, 2, 3, ...)
     uSD partition number "sd_part_X" to be used as root device filesystem.
      - bootargs_defaults
     Current value for bootargs_defaults is:
      bootargs_defaults='console=ttymxc1,115200 root=/dev/mmcblk0p${sd_part} rootwait rw fixrtc rootflags=barrier=1 fbmem=24M video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24'
    
      - bootcmd_run_X (where X can be 1, 2, 3, ...)
     String contained in "bootcmd_run_X" will be executed inside multiboot
     environment with the following command: "run bootcmd_run_X".
      - bootcmd_X (where X can be 1, 2, 3, ...)
     String contained in "bootcmd_X" will be used as bootcmd environment.
      - sd_part_X (where X can be 1, 2, 3, ...)
     uSD partition number "sd_part_X" will be used to load uImage from.
      - bootcmd_default
     Current value for bootcmd_default is:
      bootcmd_defaults='plotmsg -u Booting from mmcblk0p${sd_part}. Please wait...; mmc dev 0; ext2load mmc 0:${sd_part} 0x10800000 /boot/uImage; bootm 0x10800000'
    
    If your system need multiboot customized environment it will be necessary to
    define some boot*_X variable or change "bootargs_defaults" and "bootcmd_default".
    When no variable is defined, multiboot will use /dev/sda1 for system 1,
    use /dev/sda2 for system 2, /dev/sda3 for system 3, and so on.
    UDOO board => 
    
    OK, now that this information is available, I will experiment and try to make it work for my needs. I see the following capabilities:
    - configuring multiboot session for defining specific displays, HDMI or LVDS (run the one currently representing your hardware configuration setup at the time)
    - defining which sata partition you want to use (ie. sda1, sda2, ....)

    I now see my desires may be reachable (see my original post), First get the variations of multiboot working for the Ubuntu 12.04 image, then move on to exploring the Android build to see if I can put the android release on sda2 and then be able to switch back and forth between the two with multiboot instead of swapping out uSD cards all the time. Hopefully all the uboot setup between the two releases are common enough to have one uboot setup, but that is a lot to explore. I am hoping the UDOO team working on the Android and Linux builds can come up with a way to provide common support between the two uboot setups so we can all benefit from the great capabilities of the UDOO.

    I'll report on my progress on these efforts. I am open to suggestions and guidance. Perhaps we need another topic for multiboot(?).
     
  5. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    Yes you can set up different args to make it boot from different drive etc and make it boot my typing the command , run sata1 .
    but on the sheevaplug , which uses uboot multi-boot mean go down a list of methods of what to boot and if that fails go on the next.
    Eg try Sata .. fail , try sd card .. fail , try the internal nand .
    Each method as it own boot args , so you could just stop the boot before time out and run the nand method and bypass the other methods.
     
  6. allwet

    allwet New Member

    Joined:
    Oct 30, 2013
    Messages:
    29
    Likes Received:
    1
    Thanks Peter.

    Now it gets trickier defining which display to use, HDMI/LVDS as well as which partition to boot from, sda1 or 2, but I'll work that.

    Have you had the chance to look at differences in uboot startups for Android vs Ubuntu 12.04 v2.1? I haven't started to play with the Android release yet for support of the Arduino side, but hope they are closely similar so that I can use the same setups to achieve partition and display selections with multiboot. Ideas?

    Again, thanks. :)
     
  7. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    My udoo in for repair , so can`t test anything .
    Never tried Android so don`t know how it boots , but should be about the same .

    Looking at the way I`ve set sata to boot up which was on a post , But can`t find any way to multi boot that.

    Just looked how the sheevaplug multi boots , a lot and going around in circles.
    When I get my udoo back I will try getting it to boot from two partitions , one by default , but the other if I stop uboot and type a command .
    You have got my going !!!
     

Share This Page