This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Fast boot with ramdisk



Hi everybody,

I am using davinci evm and NAND flash to store uImage and ramdisk.gz. I want fast boot. How can I do fast boot? The following is u-boot arguments.

 

baudrate=115200
bootfile="uImage"
gateway=192.168.0.1
dns1=192.168.0.2
dns2=192.168.0.3
bootdelay=1
filesize=c16c7a
fileaddr=82000000
netmask=255.255.255.0
ipaddr=192.168.0.243
serverip=192.168.0.244
bootcmd=nand read 0x82000000 0x2200000 0xc18000;nboot 0x80700000 0 0x2000000;bootm
bootargs=console=ttyS1,115200n8 ip=off root=/dev/ram0 rw initrd=0x82000000,16M ramdisk_size=32768,nolock video=davincifb:vid0=1024x768x16,3000K@0x0,0 davinci_enc_mngr.ch0_output=LCD davinci_enc_mngr.ch0_mode=640x480 mem=118M quiet
stdin=serial
stdout=serial
stderr=serial
ethaddr=00:00:5b:ee:de:ad
videostd=ntsc

 

And the next is boot logs.

 

NAND read: device 0 offset 0x2200000, size 0xc18000
 12681216 bytes read: OK  <------------------------------------------------ (a)

Loading from NAND 64MiB 1,8V 8-bit, offset 0x2000000
   Image Name:   Linux-2.6.18_pro500-davinci_evm-
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1912848 Bytes =  1.8 MB
   Load Address: 80008000
   Entry Point:  80008000
## Booting image at 80700000 ...
   Image Name:   Linux-2.6.18_pro500-davinci_evm-
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1912848 Bytes =  1.8 MB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
OK

Starting kernel ...

davincifb davincifb.0: dm_osd0_fb: Failed to obtain ownership of OSD window.
vpfe vpfe.1: DaVinci v4l2 capture driver V1.0 loaded
INIT: version 2.86 booting
Starting the hotplug events dispatcher: udevd.
Synthesizing the initial hotplug events...done.
Waiting for /dev to be fully populated...done.
Activating swap...done.
Remounting root filesystem...done.
Mounting local filesystems: mount none on /var/run type tmpfs (rw)
none on /tmp type tmpfs (rw)
Setting up networking ....
Starting hotplug subsystem:
   pci
   pci      [success]
   usb
   usb      [success]
   isapnp
   isapnp   [success]
   ide
   ide      [success]
   input
   input    [success]
   scsi
   scsi     [success]
done.
Starting portmap daemon....
DSPLINK Module (1.61.03) created on Date: Apr 16 2009 Time: 18:22:23
Encode demo started.

 

I know that optimizing kernel and filesystem is necessary for fast boot. But (a) of the above is my point. It spends about 20 seconds in reading ramdisk from nand flash. Is it possible to decrease (a) process time by boot argument or kernel setting?

Thank you and best regards,

Inchul Lee.

  • Hi Inchul,

    inchul lee said:
    It spends about 20 seconds in reading ramdisk from nand flash. Is it possible to decrease (a) process time by boot argument or kernel setting?

    From the U-Boot prompt, can you dump the A1CR register for the EMIF chip select the NAND is connected to to see if the timing values configured there are optimized (instead of being left at the default of most relaxed timings)?

    The kernel does some timing optimizations for DM6446 EVM which you can try replicating in U-Boot: http://git.kernel.org/?p=linux/kernel/git/khilman/linux-davinci.git;a=blob;f=drivers/mtd/nand/davinci_nand.c;h=103235e83e8290622f6088c98c2eae9dd4cfcde2;hb=33bd223cd8f649be74975f9abc52c84f7a2ee8ab#l481

    I am not sure if these are the most optimized settings, but should be a good place to start.

    Thanks,

    Sekhar

  • Hi Sekhar,

    Thank you for your reply. I couldn't find out the command to dump A1CR register(or memory) in u-boot. How can I dump A1CR register in u-boot prompt? I am using u-boot-1.2.0-dvevm. And the following is commands in u-boot.

    askenv  - get environment variables from stdin
    autoscr - run script from memory
    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
    cmp     - memory compare
    coninfo - print console devices and information
    cp      - memory copy
    crc32   - checksum calculation
    dhcp    - invoke DHCP client to obtain IP/boot params
    go      - start application at address 'addr'
    help    - print online help
    iminfo  - print header information for application image
    loadb   - load binary file over serial line (kermit mode)
    loads   - load S-Record file over serial line
    loady   - load binary file over serial line (ymodem mode)
    loop    - infinite loop on address range
    md      - memory display
    mm      - memory modify (auto-incrementing)
    mtest   - simple RAM test
    mw      - memory write (fill)
    nand    - NAND sub-system
    nboot   - boot from NAND device
    nfs     - boot image via network using NFS protocol
    nm      - memory modify (constant address)
    ping    - send ICMP ECHO_REQUEST to network host
    printenv- print environment variables
    rarpboot- boot image via network using RARP/TFTP protocol
    reset   - Perform RESET of the CPU
    run     - run commands in an environment variable
    saveenv - save environment variables to persistent storage
    setenv  - set environment variables
    sleep   - delay execution for some time
    tftpboot- boot image via network using TFTP protocol
    version - print monitor version

    Thanks,

    Inchu Lee.

  • Hi Inchu,

    inchul lee said:
    How can I dump A1CR register in u-boot prompt?

    You can do this using md command.

    U-Boot> md <address of A1CR register>

    You can get the address of A1CR register from the device datasheet.

    To modify a register you can use mm command.

    Thanks,

    Sekhar

  • Hi Sekhar,

    I tested optimizing A1CR. The following is test result.

     

    ODU > md 0x01e00010
    01e00010: 3ffffffc 3ffffffc 3ffffffc 3ffffffc    ...?...?...?...?
    01e00020: 00000000 00000000 00000000 00000000    ................
    01e00030: 00000000 00000000 00000000 00000000    ................
    01e00040: 00000004 00000000 00000000 00000000    ................
    01e00050: 00000000 00000000 00000000 00000000    ................
    01e00060: 00000001 00000001 00000000 00000000    ................
    01e00070: 0d5c02a3 00000000 00000000 00000000    ..\.............
    01e00080: 00000000 00000000 00000091 00000000    ................
    01e00090: 00000000 00000000 00000000 00000000    ................
    01e000a0: 00000000 00000000 00000000 00000000    ................
    01e000b0: 00000005 00000000 00000000 00000000    ................
    01e000c0: 00000000 00000000 00000000 00000000    ................
    01e000d0: 00000000 00000000 00000000 00000000    ................
    01e000e0: 00000000 00000000 00000000 00000000    ................
    01e000f0: 00000000 00000000 00000000 00000000    ................
    01e00100: 000f0201 f0000000 00000000 00000000    ................
    ODU > mm.l 0x01e00010
    01e00010: 3ffffffc ? 0432018c
    01e00014: 3ffffffc ? ODU > md 0x01e00010
    01e00010: 0432018c 3ffffffc 3ffffffc 3ffffffc    ..2....?...?...?
    01e00020: 00000000 00000000 00000000 00000000    ................
    01e00030: 00000000 00000000 00000000 00000000    ................
    01e00040: 00000004 00000000 00000000 00000000    ................
    01e00050: 00000000 00000000 00000000 00000000    ................
    01e00060: 00000001 00000001 00000000 00000000    ................
    01e00070: 0d5c02a3 00000000 00000000 00000000    ..\.............
    01e00080: 00000000 00000000 00000091 00000000    ................
    01e00090: 00000000 00000000 00000000 00000000    ................
    01e000a0: 00000000 00000000 00000000 00000000    ................
    01e000b0: 00000005 00000000 00000000 00000000    ................
    01e000c0: 00000000 00000000 00000000 00000000    ................
    01e000d0: 00000000 00000000 00000000 00000000    ................
    01e000e0: 00000000 00000000 00000000 00000000    ................
    01e000f0: 00000000 00000000 00000000 00000000    ................
    01e00100: 000f0201 f0000000 00000000 00000000    ................
    ODU > boot

     

    Time reading ramdisk from nand flash is about 10 sec. About 10 sec is decreased. You are good job. Is 0x0432018c the best value?

    Thanks,

    Inchul Lee.

  • Hi!

    We are also trying to create the ramdisk.gz  with zImage. I created the ramdisk.gz of 2.4MB compressed image

    mke2fs -vm0 /dev/ram 6560
    mount -t ext2 /dev/ram /mnt
    cd /mnt
    cp /bin, /sbin, /etc, /dev ... files in mnt
    cd ../
    umount /mnt
    dd if=/dev/ram bs=1k count=6560 of=ramdisk
    gzip -9 ramdisk

     

    Then in Redboot I loaded the images using tftp as

    load -v -r -b 0x400000 zImage; load -v -r -b 0x600000 ramdisk.gz

    boot script edited as

    exec -b 0xC0400000 -l 0x200000 -c "console=ttymxc0 root=/dev/ram0 initrd=0xC0600000 ramdisk_size=2417"

     

    And also I tried with many alternative because I am not sure which is correct one. Following are few of them

    exec -b 0xC0400000 -l 0x200000 -c "console=ttymxc0 root=/dev/ram0 initrd=0xC0600000,6.5M ramdisk_size=6560"

    exec -b 0xC0400000 -l 0x200000 -c "mem=16M console=ttymxc0 root=/dev/ram0 initrd=0xC0600000,6.5M ramdisk_size=6560"

     

    Boot log is

    Redboot> exec -b 0xC0400000 -l 0x200000 -c "console=ttymxc0 root=/dev/ram0 initrd=0xC0600000 ramdisk_size=2417"
    entry=0xc0008000, target=0xc0008000
    Uncompressing Linux.................................................................... done, booting the kernel.
    Linux version 2.6.18.1 (ram@emmys0082.emsys.net) (gcc version 4.1.1) #19 PREEMPT Tue Nov 16 10:36:27 IST 2010
    CPU: ARM926EJ-S [41069264] revision 4 (ARMv5TEJ), cr=00053177
    Machine: Freescale i.MX21ADS
    Memory policy: ECC disabled, Data cache writeback
    CPU0: D VIVT write-back cache
    CPU0: I cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
    CPU0: D cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
    Built 1 zonelists.  Total pages: 4096
    Kernel command line: console=ttymxc0 root=/dev/ram0 initrd=0xC0600000 ramdisk_size=2417
    MXC IRQ initialized
    PID hash table entries: 128 (order: 7, 512 bytes)

    WARNING: Can't generate CLOCK_TICK_RATE at 7388890 Hz
    Actual CLOCK_TICK_RATE is 7388890 Hz
    Console: colour dummy device 80x30
    Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
    Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
    Memory: 16MB = 16MB total
    Memory: 14076KB available (1704K code, 333K data, 84K init)
    Mount-cache hash table entries: 512
    CPU: Testing write buffer coherency: ok
    NET: Registered protocol family 16
    MXC GPIO hardware
    AIPI VA base: 0xe4000000
    mx21ads.c: registering mxc keypad device...
    CSPI: mxc_spi-1 probed
    mxc_spi mxc_spi.1: registering loopback device 'spi'
    CSPI: mxc_spi-2 probed
    mxc_spi mxc_spi.2: registering loopback device 'spi'
    usbcore: registered new driver usbfs
    usbcore: registered new driver hub
    MXC I2C driver
    MX21: Power management module initialized
    NetWinder Floating Point Emulator V0.97 (double precision)
    JFFS2 version 2.2. (NAND) (C) 2001-2006 Red Hat, Inc.
    io scheduler noop registered
    io scheduler anticipatory registered (default)
    io scheduler deadline registered
    io scheduler cfq registered

    In _enable_graphic_window
    mxc_sdc_fb mxc_sdc_fb.0: fb0: DISP0 BG fb device registered successfully.
    Writing to ext RTC successful 2
    Real TIme clock Driver v1.0
    MixCOM watchdog driver v0.1, watchdog port at 0x  0
    Serial: MXC Internal UART driver
    mxcintuart.0: ttymxc0 at MMIO 0x1000a000 (irq = 20) is a Freescale MXC
    mxcintuart.1: ttymxc1 at MMIO 0x1000b000 (irq = 19) is a Freescale MXC
    mxcintuart.2: ttymxc2 at MMIO 0x1000c000 (irq = 18) is a Freescale MXC
    RAMDISK driver initialized: 16 RAM disks of 2417K size 1024 blocksize
    loop: loaded (max 8 devices)
    MXC MTD nor Driver 2.0
    mxc_nor_flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
     Amd/Fujitsu Extended Query Table at 0x0040
    mxc_nor_flash.0: CFI does not contain boot bank location. Assuming top.
    number of CFI chips: 1
    cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
    RedBoot partition parsing not available
    Creating 8 MTD partitions on "mxc_nor_flash.0":
    0x00000000-0x00040000 : "Bootloader"
    0x00040000-0x001c0000 : "nor.Kernel1"
    0x001c0000-0x00340000 : "nor.kernel2"
    0x00340000-0x00940000 : "nor.rootfs1"
    0x00940000-0x00f40000 : "nor.rootfs2"
    0x00f40000-0x00f80000 : "Parameter"
    0x00fe0000-0x00fe3000 : "FIS directory"
    0x00fff000-0x01000000 : "Redboot config"
    Registering the SPI Driver
    Device spi1.4 probed
    Device spi2.4 probed
    usbmon: debugfs is not available
    MX2 OTG Driver ver. 1.0 built on 10:35:50 Nov 16 2010
    imx21hcd: driver imx21-hcd, 2007 May 27
    imx21-hcd imx21-hcd.0: USB Host Controller
    imx21-hcd imx21-hcd.0: new USB bus registered, assigned bus number 1
    imx21-hcd imx21-hcd.0: irq 55, io mem 0x10024000
    usb usb1: Product: USB Host Controller
    usb usb1: Manufacturer: Linux 2.6.18.1 imx21-hcd
    usb usb1: SerialNumber: imx21-hcd.0
    usb usb1: configuration #1 chosen from 1 choice
    hub 1-0:1.0: USB hub found
    roothubb 00070000
    hub 1-0:1.0: 3 ports detected
    FeatPwr0
    usbcore: registered new driver usbmb
    drivers/usb/class/magicbox.c: v0.13: USB TNT12000 Vendor Specific Device Class driver
    udc: mx21_udc version 18 April 2007
    TNT12000 Gadget: mb_req_free ep0=c033c460 buf=c0391be0
    TNT12000 Gadget: TNT12000 Gadget, version: 0.1.2 05/21/2007
    TNT12000 Gadget: using mx21_udc, OUT ep2out-bulk IN ep1in-bulk
    MXC keypad loaded
    input: mxckpd as /class/input/input0
    i2c /dev entries driver
    NET: Registered protocol family 1
    drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
    ramdisk_execute_command <NULL>
    TNT12000 Gadget: suspend
    No filesystem could mount root, tried:  ext3 ext2 romfs
    Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)

     

     

    1. Is there any problem with the bootargument? And also Is there any guide to guide what I should pass as bootargs for ramdisk usage?

    2. For ramdisk implementation, only bootargs are enough or any kernel configurations are required?

     

    Notes:

    Our system got a 16MB SDRAM, no other memory.