Additional Partitions in Buildroot

Additional Partitions in Buildroot

I'd like to know if it's possible to add more partitions in the partition table, and how. I've tested to change the genimage.cfg but it seems that support/scripts/genimage.sh doesn't create it.

Thank you in advance.

1

1 Answer

Using the genimage.cfg script is the right way to go.

If it does not work, you might be modifying the wrong config file; genimage is usually invoked by a script specified as Make sure to modify the right config file however, the one used by the script defined in the BR2_ROOTFS_POST_IMAGE_SCRIPT option, under System configuration-> Custom scripts to run after creating filesystem images in menuconfig.

For example, I modified mine (specifically boards/raspberrypi3-64/genimage-raspberrypi3-64.cfg to accomodate for an extra ext4 partition.

image boot.vfat {                                                                                                                                                                                                                                      
  vfat {                                                                                                                                                                                                                                               
    files = {                                                                                                                                                                                                                                          
      "bcm2710-rpi-3-b.dtb",                                                                                                                                                                                                                           
      "bcm2710-rpi-3-b-plus.dtb",                                                                                                                                                                                                                      
      "bcm2837-rpi-3-b.dtb",                                                                                                                                                                                                                           
      "rpi-firmware/bootcode.bin",                                                                                                                                                                                                                     
      "rpi-firmware/cmdline.txt",                                                                                                                                                                                                                      
      "rpi-firmware/config.txt",                                                                                                                                                                                                                       
      "rpi-firmware/fixup.dat",                                                                                                                                                                                                                        
      "rpi-firmware/start.elf",                                                                                                                                                                                                                        
      "rpi-firmware/overlays",                                                                                                                                                                                                                         
      "Image"                                                                                                                                                                                                                                          
    }                                                                                                                                                                                                                                                  
  }                                                                                                                                                                                                                                                    
  size = 32M                                                                                                                                                                                                                                           
}                                                                                                                                                                                                                                                      

image sdcard.img {                                                                                                                                                                                                                                     
  hdimage {                                                                                                                                                                                                                                            
  }                                                                                                                                                                                                                                                    

  partition boot {                                                                                                                                                                                                                                     
    partition-type = 0xC                                                                                                                                                                                                                               
    bootable = "true"                                                                                                                                                                                                                                  
    image = "boot.vfat"                                                                                                                                                                                                                                
  }                                                                                                                                                                                                                                                    

  partition rootfs {                                                                                                                                                                                                                                   
    partition-type = 0x83                                                                                                                                                                                                                              
    image = "rootfs.ext4"                                                                                                                                                                                                                              
  }                                                                                                                                                                                                                                                    

  partition log {                                                                                                                                                                                                                                      
    partition-type = 0x83                                                                                                                                                                                                                              
    image = "log.ext4"                                                                                                                                                                                                                                 
  }                                                                                                                                                                                                                                                    
}
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Marcus Vance
Author

Marcus Vance

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.