[Buildroot] Raspberry: sd card image

Arnout Vandecappelle arnout at mind.be
Tue Jun 28 23:49:17 UTC 2016


On 28-06-16 13:02, David wrote:
> I'm trying to change sdcard image generated by Buildroot for Raspberry and I
> have few questions.
> 
> 1) How can I modify size of root filesystem partition? Size option of genimage
> is not working. I always get partition with 5% free space. For example I add size:
> 
> partition rootfs {
>     partition-type = 0x83
>         image = "rootfs.ext4"
>     size = 512M
>   }
> 
> It does not change anything. The partition size is the same as previously.

 Are you sure? I think the partition size will be 512M. The filesystem size,
however, will stay the same as before.

 To change the filesystem size, use BR2_TARGET_ROOTFS_EXT2_BLOCKS or
BR2_TARGET_ROOTFS_EXT2_EXTRA_BLOCKS.


> 2) I want to add third partition and mount it during boot in read-write mode to
> home directory. Root filesystem is in my case mounted as read-only. I tried add
> to genimage config file:
> 
> partition data {
>     partition-type = 0x83
>     size = 128M
>   }

 This will create the partition, but won't put a filesystem on it. To add a
filesystem, you have to add an image for it:

image data.ext4 {
  ext4 {
    # Put any files you want to add here
  }
  size = 128M
}

...
  partition data {
     image = "data.ext4"
  }


> 
> without success. Of course I can do it with other tools (fdisk, mkfs), but I see
> that genimage is now a standard tool in Buildroot to create images.
> 
> 3) I think that good idea is mount root filesystem with noatime option.

 Actually, that's really a good idea!

> Unfortunately rootflags=noatime does not work.

 Doesn't it? That's weird.

> How can I config this option in
> Buildroot? I know that I can modify /etc/fstab using the overlay, but I think
> that there is better way to do it. Do I have to modify /etc/inittab? I noticed
> that Buildroot change this file according to BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW.

 If rootflags doesn't work, then modifying fstab and/or inittab will be the only
option. I'm not sure if 'mount -a' will remount /, so fstab may not be sufficient.

> 
> 4) In my system only third partition is mounted in read-write mode, so I want to
> run fsck on this partition before mount to be sure that file system is not
> corrupted by power fail. Should I modify /etc/inittab for this purpose?

 Yep.

> 
> 5) BTW. I noticed that command tune2fs is not available when
> BR2_PACKAGE_E2FSPROGS_TUNE2FS is selected.

 It is in my build. But you probably want the host tune2fs, which is built when
you select BR2_PACKAGE_HOST_E2FSPROGS.


 Regards,
 Arnout

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF



More information about the buildroot mailing list