You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 30 Next »


    



Introduction-Mulitboot

This page is dedicated for switching the images (broadband to video) specifically for techsummit-2019. Automation of Multiple SDCards Partitioning and Image Flash

Steps for Multiboot support of Single and Multi-SDCards Partitioning and Image Flashing automatically

Precondition for used SD Card

All the SD cards should be fully formatted. Use Disk tool to cleanup SD card data. Ignore Precondition steps if SD Card is fresh and empty 

Also, this method can be followed for single card multi boot flashing as well 

Note: These steps are not required for brand new SD card and you can skip

Deletion of partition using Disk tool in Ubuntu:

1) Select particular SD card from left hand side panel and click on '-' symbol of Disk tool

2) Click on Delete button to delete any particular partition

3) Finally deleted all the partitions:

4) After clean up the data in SD card, plug out it and plug in again.

Prerequisite Steps -  Preparing for flashing SD Cards

1) Keep all the below files in same location:

  1.  Broadband image to be flashed
  2.  Video image to be flashed
  3.  extract.sh script file    

extract.sh

  1. multiSDcard_partition.sh
multiSDcard_partition
# This code is for partitioning and image flashing into multiple SD cards

echo Please enter the input arguments in this order : bash partition.sh bb_image video_image SDcardDetail_filename
echo Please keep the script extract.sh in the same folder

# Get user input for Broadband and Video image and SD card partition names and their respective sizes
echo Broadband image : $1
echo Video image : $2
echo SDcard details filename : $3

echo Deleting few folders if they are pre-existing...
sudo rm -rf videomnt/
sudo rm -rf extblock/

echo Video image is going to be extracted...
sudo sh extract.sh $2
sudo mkdir videomnt

loopcnt=1
while IFS=' ' read -r part_name sdcard_size
do
  sudo mkdir videomnt/videomnt'_'$loopcnt
  dir_name='videomnt/videomnt''_'$loopcnt
  echo $dir_name
  echo Calling the thread script which will paralleley execute for multiple SD cards...
  sudo bash threadSD.sh $1 $part_name $sdcard_size $dir_name &
  loopcnt=`expr $loopcnt + 1`
done < $3

# Check file inside videomnt is empty or not
cd videomnt

while true
do
  for file in *; do
     echo Check for file present in the directory...
  done

  if [ "$file" == "*" ]
  then
       echo All SD card partitioning and image flashing are completed !!
       # Deleting temporary folders.
       cd ..
       sudo rm -rf videomnt
       sudo rm -rf extblock/
       exit 1
   fi

  sleep 60
  sleep_cnt=`expr $sleep_cnt + 1`

  if [ "$sleep_cnt" == "10" ]
  then
     echo Multisd card flashing failed due to slow processing or error. Increase sleep count thresold sleep_cnt.
     exit 1
  fi

done


  1.      threadSD.sh

     vi) Create a file (For ex. sudo vi sd_part_size) where all the SD card partition names and their respective sizes are mentioned

2) Connect all the SD cards with host PC and execute the command : sudo fdisk -l  . It will list all the SD card partitions with their respective sizes

3) Write all the partition names and their respective size in a text file (as created earlier as sd_part_size). Please don't copy the colon(: ) displayed at the end of the partition name and the word "GB". There should be single space between partition name and size.

For example content of sd_part_size looks like:

 

[Here we have taken 1 SD card of 16GB and 3 others of 32GB each.]

4) Execute the script below:   

MultiSDcard Partitioning and Image Flashing
bash multiSDcard_partition.sh <Broadband image> <Video image> <SD card details_filename>

For example:
bash multiSDcard_partition.sh rdkb-generic-broadband-image_default_20191009085525.rootfs.rpi-sdimg rdk-generic-hybrid-refapp-thunder-  image_default_20190924125426.rootfs.rpi-sdimg sd_part_size

Multiboot Feature : Switching to RDK-Video Image from RDK-Broadband 

  • Each SD card will contain 4 partitions now

  •  Now Boot up the SD card in RPI-> it should come up with BB image in partition (P2)
  •   Log into the R-Pi from Host PC execute the below command
    • ssh root@<RPI-Board IP>
  • To load the video image which is present in the storage execute the script bank_video_switch.sh

Switching to Video Image

root@RaspberryPi-Gateway:/lib/rdk# sh bank_video_switch.sh

Note: Have tested with 4 SD cards out of which 1 is 16Gb and rest of the 3 cards are 32GB each. Overall process took approximately 6min  time to get completed. Host PC having 8GB RAM. 

           For Broad band image size around 300 MB and video image (thunder) size around 700 MB

           SD card size mentioned in input text file should always be in GB but with format as provided in the steps mentioned


  • No labels