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.

DM365: How to update baseline cramfs

Problem Statement: Need to update provided cramfsImage (as part of Dm365 Appro's IPNC release)

Background: We have provide cramfs "cramfsImage_ipnc_dm365_1.0.0" as partof standard distribution. This is working fine. We now need to upgrade this with our new applications. For this, I intend to extract provided image and do the modification and mkfs.cramfs back. To complete this I tried following (with no success)

  1. Mounted "cramfsImage_ipnc_dm365_1.0.0" using -o loop and tried cp -a (as described in one of the TI document. This ail as cp is not copying al linked files as needed.
  2. I tried tar and untar (this is described in one of the posting). This too fails with "too many errors"
  3. I tried using fsck to extract the files out. This too fails on the provided release
  4. End of the day when I cram (partially extracted files) IPNC stalls half way thourgh boot.

Queries:

  1. How to extract this cramfs to orignal?
  2. Is extracted cramfs of this release "cramfsImage_ipnc_dm365_1.0.0" available from TI/Appro that I can use and cramfs it directly instead of extracting the provided release?
  3. Is it possible (if so how) to directly change the mounted cramfs? This was I so not need to extract and cram again.
  4. Any other recommendation/pointer/support will be of great help.

Regards,

Ajay

 

  • Finally I choose following procedure that is working well for me. I am putting this here in case some one need it.

     

    $ cd tmp                        // Working Directory
    $ ls cramfsImage_ipnc_dm365_1.0.0            // Ensure this exists
    $ mkdir filesys                        // it will be mounted here
    $ sudo mount -o loop -t cramfs cramfsImage_ipnc_dm365_1.0.0 filesys
    $ mkdir rdmnt                        // For new FileSys
    $ cd filesys                        // Enter original area
    $ sudo tar -cf  -  . | sudo tar -C ../rdmnt/ -xpf -    // NEED TO BE ROOT
    $   echo **** Above stuff fails with errors but it works. YOU GOT TO BE ROOT for this.

  • Hi,
    i have never used mkfs.cramfs ... which is the correct syntax to compress back the filesystem?

    best regards

  • $ rm /var/tftpboot/cramfsImage_ipnc_dm365		// Remove old stuff if any
    $ mkfs.cramfs rdmnt /var/tftpboot/cramfsImage_ipnc_dm365

    where rdmnt is a directory that contains the filesystem

    Ajay
  • Thank you,
    i'm going to try
    regards

    Andrea

  • Hi,
    i'm a little bit confused and i have another question, what is the difference from the directories filesys and rdmnt?
    i have decompressed original cramfsImage_ipnc_dm365 and i have tried do compress back rdmnt folder and filesys folder ... if i use cramfs obtained with first mkfs i don't have any problem to boot on camera, if i use the one obtained from filesys directory the boot process fail (see attachment)

    What is wrong? When i compress filesys directory i obtain this warning: gids truncated to 8 bits. (This may be a security concern.)

    regards

    DM365 IPNC :>boot
    
    NAND read: device 0 offset 0x400000, size 0xbf0000
     12517376 bytes read: OK
    
    Loading from NAND 32MiB 3,3V 8-bit, offset 0x200000
       Image Name:   Linux-2.6.18_pro500-davinci_IPNC
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    1803208 Bytes =  1.7 MB
       Load Address: 80008000
       Entry Point:  80008000
    ## Booting kernel from Legacy Image at 80700000 ...
       Image Name:   Linux-2.6.18_pro500-davinci_IPNC
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    1803208 Bytes =  1.7 MB
       Load Address: 80008000
       Entry Point:  80008000
       Verifying Checksum ... OK
       Loading Kernel Image ... OK
    OK
    
    Starting kernel ...
    
    Linux version 2.6.18_pro500-davinci_IPNC_1.5 (wenchi@dino.linux) (gcc version 4.2.0 (MontaVista 4.2.0-16.0.32.0801914 2008-08-30)) #1 PREEMPT Mon Nov 23 16:38:49 CST 2009
    CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
    Machine: DaVinci DM365 IPNC
    Memory policy: ECC disabled, Data cache writeback
    DaVinci DM0365 variant 0x0
    PLL0: fixedrate: 24000000, commonrate: 135000000, vpssrate: 270000000
    PLL0: vencrate_sd: 27000000, ddrrate: 270000000 mmcsdrate: 135000000
    PLL1: armrate: 297000000, voicerate: 20482758, vencrate_hd: 74250000
    CPU0: D VIVT write-back cache
    CPU0: I cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
    CPU0: D cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets
    Built 1 zonelists.  Total pages: 14336
    Kernel command line: mem=56M console=ttyS1,115200n8 root=/dev/ram0 rw initrd=0x82000000,13M ip=172.27.130.131 eth=00:0C:0C:A0:03:64
    PID hash table entries: 256 (order: 8, 1024 bytes)
    Clock event device timer0_0 configured with caps set: 07
    Console: colour dummy device 80x30
    Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
    Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
    Memory: 56MB = 56MB total
    Memory: 39448KB available (3092K code, 643K data, 176K init)
    Security Framework v1.0.0 initialized
    Capability LSM initialized
    Mount-cache hash table entries: 512
    CPU: Testing write buffer coherency: ok
    checking if image is initramfs...it isn't (bad gzip magic numbers); looks like an initrd
    Freeing initrd memory: 13312K
    NET: Registered protocol family 16
    DaVinci: 104 gpio irqs
    MUX: initialized GPIO20
    MUX: initialized I2C_SCL
    Generic PHY: Registered new driver
    ch0 default output "COMPOSITE", mode "NTSC"
    VPBE Encoder Initialized
    SCSI subsystem initialized
    NET: Registered protocol family 2
    IP route cache hash table entries: 512 (order: -1, 2048 bytes)
    TCP established hash table entries: 2048 (order: 1, 8192 bytes)
    TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
    TCP: Hash tables configured (established 2048 bind 1024)
    TCP reno registered
    VFS: Disk quotas dquot_6.5.1
    Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
    squashfs: version 3.1 (2006/08/19) Phillip Lougher
    JFFS2 version 2.2. (NAND) (C) 2001-2006 Red Hat, Inc.
    yaffs Nov 23 2009 16:34:48 Installing. 
    SGI XFS with no debug enabled
    Initializing Cryptographic API
    io scheduler noop registered
    io scheduler anticipatory registered (default)
    LTT : ltt-facilities init
    LTT : ltt-facility-core init in kernel
    DAVINCI-WDT: DaVinci Watchdog Timer: heartbeat 60 sec
    Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing disabled
    serial8250.0: ttyS0 at MMIO map 0x1c20000 mem 0xfbc20000 (irq = 40) is a 16550A
    serial8250.0: ttyS1 at MMIO map 0x1d06000 mem 0xfbd06000 (irq = 41) is a 16550A
    RAMDISK driver initialized: 1 RAM disks of 32768K size 1024 blocksize
    Linux video capture interface: v2.00
    Trying to register davinci display video device.
    layer=c36daa00,layer->video_dev=c36dab60
    Trying to register davinci display video device.
    layer=c36da800,layer->video_dev=c36da960
    davinci_init:DaVinci V4L2 Display Driver V1.0 loaded
    i2c /dev entries driver
    nand_davinci nand_davinci.0: Using 4-bit hardware ECC
    NAND device: Manufacturer ID: 0xec, Chip ID: 0x75 (Samsung NAND 32MiB 3,3V 8-bit)
    Creating 5 MTD partitions on "nand_davinci.0":
    0x00000000-0x00080000 : "bootloader"
    0x00080000-0x00200000 : "params"
    0x00200000-0x00400000 : "kernel"
    0x00400000-0x01c00000 : "filesystem1"
    0x01c00000-0x02000000 : "filesystem2"
    nand_davinci nand_davinci.0: hardware revision: 2.3
    rtc_davinci_dm365 rtc_davinci_dm365.0: rtc intf: proc
    rtc_davinci_dm365 rtc_davinci_dm365.0: rtc intf: dev (254:0)
    rtc_davinci_dm365 rtc_davinci_dm365.0: rtc core: registered rtc_davinci_dm365 as rtc0
    Advanced Linux Sound Architecture Driver Version 1.0.12rc1 (Thu Jun 22 13:55:50 2006 UTC).
    ASoC version 0.13.1
    CQ0093 Voice Codec 0.1
    asoc: cq93vc <-> davinci-vcif mapping ok
    ALSA device list:
      #0: On-chip voice codec (cq93vc)
    IPv4 over IPv4 tunneling driver
    TCP bic registered
    NET: Registered protocol family 1
    NET: Registered protocol family 17
    rtc_davinci_dm365 rtc_davinci_dm365.0: setting the system clock to 2000-01-01 00:58:26 (946688306)
    Time: timer0_1 clocksource has been installed.
    Clock event device timer0_0 configured with caps set: 08
    Switched to high resolution mode on CPU 0
    IP-Config: No network devices available.
    RAMDISK: cramfs filesystem found at block 0
    RAMDISK: Loading 12100KiB [1 disk] into ram disk... |/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|done.
    VFS: Mounted root (cramfs filesystem) readonly.
    Freeing init memory: 176K
    Warning: unable to open an initial console.
    CSL: Module install successful, device major num = 253 
    CSL: Module version 0.10.00, built on Nov 23 2009 16:42:12 
    I2C: Module install successful, device major num = 252 
    DMA: Module install successful, device major num = 251 
    DRV: Module install successful
    DRV: Module built on Nov 23 2009 16:42:16 
    DRV: EDMACC.QUEPRI  = 00000777
    DRV: SYSTEM.MSTPRI0 = 00550011
    DRV: SYSTEM.MSTPRI1 = 00000444
    DRV: ISP.BCR        = 00000002
    CMEMK module: built on Nov 23 2009 at 16:41:37
      Reference Linux version 2.6.18
      File /home/wenchi/Templates/dvsdk_2_10_01_18/linuxutils_2_24_03/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c
    allocated heap buffer 0xc5000000 of size 0x4800000
    CMEM Range Overlaps Kernel Physical - allowing overlap
    CMEM phys_start (0x1000) overlaps kernel (0x80000000 -> 0x83800000)
    cmemk initialized
    EDMAK module: built on Nov 23 2009 at 16:41:40
      Reference Linux version 2.6.18
      File /home/wenchi/Templates/dvsdk_2_10_01_18/linuxutils_2_24_03/packages/ti/sdo/linuxutils/edma/src/module/edmak.c
    IRQK module: built on Nov 23 2009 at 16:41:41
      Reference Linux version 2.6.18
      File /home/wenchi/Templates/dvsdk_2_10_01_18/linuxutils_2_24_03/packages/ti/sdo/linuxutils/irq/src/module/irqk.c
    irqk initialized
    io scheduler deadline registered
    io scheduler cfq registered
     sbulla: unknown partition table
    Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
    loop: loaded (max 8 devices)
    tun: Universal TUN/TAP device driver, 1.6
    tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
    CSLIP: code copyright 1989 Regents of the University of California
    netconsole: not configured, aborting
    PPP generic driver version 2.4.2
    PPP Deflate Compression module registered
    Davinci EMAC MII Bus: probed
    MAC address is deadbeaf
    TI DaVinci EMAC Linux version updated 4.0
    davinci-mmc davinci-mmc.0: Supporting 4-bit mode
    davinci-mmc davinci-mmc.0: Using DMA mode
    usbcore: registered new driver usbfs
    usbcore: registered new driver hub
    musb_hdrc: version 6.0, cppi-dma, peripheral, debug=0
    musb_hdrc musb_hdrc: No DMA interrupt line
    musb_hdrc: USB Peripheral mode controller at c40f2000 using DMA, IRQ 12
    Loading iSCSI transport class v1.1-646.<5>iscsi: registered transport (tcp)
    

  • rdmnt is just a name where original cramfs are decompressed. It can be anything. In case yr question is that 'when you use filesys from the CD it fails but if yr decompress (I am not sure what you mean here) and compress back it works' I can suggest following

    Cramfs is usually mounted and not decompressed

    Post mount, you can take copy of this into another area (I called it rdnmt)

    All cp command usually fails as /dev has special files that cp can't copy

    you need to use tar for this. Even tar reports failures with truncations.

    But it works :)

    Sequence of commands are

    $ cd tmp						// Working Directory
    $ ls cramfsImage_ipnc_dm365_1.0.0 // Ensure this exists
    $ mkdir filesys // it will be mounted here
    $ sudo mount -o loop -t cramfs cramfsImage_ipnc_dm365_1.0.0 filesys
    $ mkdir rdmnt // For new FileSys
    $ cd filesys // Enter original area
    $ sudo tar -cf - . | sudo tar -C ../rdmnt/ -xpf - // NEED TO BE ROOT
    $ echo **** Above stuff fails with errors but it works. YOU GOT TO BE ROOT for this.
    $ echo **** Now do some changes to make sure that stuff is working.
    $ cd ~/tmp/rdmnt/var/www
    $ sudo ln -s /mnt/mmc/fs/az az // Change permissions if needed
    $ echo **** Now it is time to download the new file system
    $ cd ~/tmp // Come back
    $ rm /var/tftpboot/cramfsImage_ipnc_dm365_ajay // Remove old stuff if any
    $ mkfs.cramfs rdmnt /var/tftpboot/cramfsImage_ipnc_dm365_ajay
    $ ifconfig // Get the IPaddr of ubunutu
    # echo **** Use this IP Addr in IPNC boot for NFS mount.
  • Excuse me, i have used directory names unequal than yours ... my target is to modify cramfs content and reload it into NAND

    i have followed your instructions and compressed back rdmnt folder (without any changes), then i have loaded this cramfs on camera NAND and tried to boot but it fails (it hangs like you see in attachment) ... then i have tried to compress back mount filesys folder and with the obtained cramfs the boot on camera is ok.

    the two resulting files look the same, have you idea why one works and the other not?

    thank you,
    regards

    0257.boot_failure.txt

  • I have retried and now it's ok
    regards

  • Good.

     

    What I was not able to do is to make this cramsfs writable. The directories (expect /tmp and few more) are only writable.

    In case you are able to crack this problem, lemme know

     

    -- Ajay

  • Ok Ajay,
    i have seen that cramfs isn't writable on target but, at the moment, i update it on host before compress back
    if i'm going to try write on it on target i'll let you know

    regards,
    Andrea