Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

  • Introduction
    The Firmware upgrade will upgrade higher or lower version of the current image in BPI target with the help of Xconf server and TFTP/HTTP protocol.

...

Runtime persistence storage creation

  • Code Block
    //-----------Service file
    cat > /lib/systemd/system/mount-data.service << 'EOF' 
    
    [Unit] 
    
    Description=Mount data partition 
    
    After=mount-nvram.service 
    
    Requires=mount-nvram.service 
    
      
    
    [Service] 
    
    Type=oneshot 
    
    ExecStartPre=/bin/sh -c 'until mountpoint -q /nvram; do sleep 1; done' 
    
    ExecStart=/bin/sh /nvram/mount_data.sh 
    
    RemainAfterExit=yes 
    
      
    
    [Install] 
    
    WantedBy=multi-user.target 
    
    EOF 
    //---------script file
    cat > /nvram/mount_data.sh << 'EOF' 
    #!/bin/sh 
    mkdir -p /data 
    blkid_output=$(blkid /dev/mmcblk0p14 | grep 'TYPE="ext4"') 
    if [ -n "$blkid_output" ]; then 
        mount /dev/mmcblk0p14 /data 
        echo "Data partition mounted successfully" >> /tmp/mount-data.log 
    else 
        echo "Data partition not found or not ext4" >> /tmp/mount-data.log 
    fi 
    EOF 
    chmod +x /nvram/mount_data.sh 
    
    //----creating partition
    sgdisk -e /dev/mmcblk0 
    
    sgdisk -F /dev/mmcblk0   # first free sector 
    
    sgdisk -E /dev/mmcblk0   # last free sector 
    
    sgdisk -p /dev/mmcblk0   # full partition table view 
    
    ic-GW:~# sgdisk -l /dev/mmcblk0 
    
    root@Filogic-GW:~#  
    
    root@Filogic-GW:~# sgdisk -F /dev/mmcblk0 
    
    4453342 
    
    root@Filogic-GW:~#  
    
    root@Filogic-GW:~# sgdisk -E /dev/mmcblk0  
    
    15523806 
    
    root@Filogic-GW:~# sgdisk -p /dev/mmcblk0  
    
    Disk /dev/mmcblk0: 15523840 sectors, 7.4 GiB 
    
    Sector size (logical/physical): 512/512 bytes 
    
    Disk identifier (GUID): A74876B1-0039-4930-8C95-B43075F2726C 
    
    Partition table holds up to 128 entries 
    
    Main partition table begins at sector 2 and ends at sector 33 
    
    First usable sector is 34, last usable sector is 15523806 
    
    Partitions will be aligned on 2-sector boundaries 
    
    Total free space is 11075585 sectors (5.3 GiB) 
    
     
    
    Number  Start (sector)    End (sector)  Size       Code  Name 
    
       1              34            8191   4.0 MiB     8300  bl2 
    
       2           13312           17407   2.0 MiB     8300  fip 
    
       3           17408           50175   16.0 MiB    8300  boot_a 
    
       4           50176         2147327   1024.0 MiB  8300  rootfs_a 
    
       5         2147328         2155485   4.0 MiB     8300  bl2_b 
    
       6         2155486         2159581   2.0 MiB     8300  fip_b 
    
       7         2159582         2192349   16.0 MiB    8300  boot_b 
    
       8         2192350         4289501   1024.0 MiB  8300  rootfs_b 
    
       9         4289502         4322269   16.0 MiB    8300  nvram 
    
      10         4322270         4338653   8.0 MiB     8300  crash_a 
    
      11         4338654         4355037   8.0 MiB     8300  crash_b 
    
      12         4355038         4387805   16.0 MiB    8300  reserved 
    
      13         4387806         4453341   32.0 MiB    8300  dac 
    
    root@Filogic-GW:~# 
    
     
    //---------reboot device 
    ~# mkfs.ext4 /dev/mmcblk0p14 
    
    mke2fs 1.46.5 (30-Dec-2021) 
    
    Discarding device blocks: done                             
    
    Creating filesystem with 1383808 4k blocks and 346064 inodes 
    
    Filesystem UUID: d66a633e-151c-482e-83f2-c892a185985e 
    
    Superblock backups stored on blocks:  
    
    32768, 98304, 163840, 229376, 294912, 819200, 884736 
    
     
    
    Allocating group tables: done                             
    
    Writing inode tables: done                             
    
    Creating journal (16384 blocks):  
    
    done 
    
    Writing superblocks and filesystem accounting information: done  
    
     
    
    root@Filogic-GW:~#  
    
    root@Filogic-GW:~# mkdir -p /data 
    
    root@Filogic-GW:~# mount /dev/mmcblk0p14 /data 
    
    root@Filogic-GW:~# df -h /data 
    
    Filesystem            Size  Used Avail Use% Mounted on 
    
    /dev/mmcblk0p14       5.2G   24K  4.9G   1% /data 
    
    root@Filogic-GW:~#  
    
    root@Filogic-GW:~#  
    
    
  • TBD