平台
Ubuntu 16.04 + Buildroot-2021.02
问题
mkdir -p /home/anson/codes/buildroot-2021.02/output/images rm -rf /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2 mkdir -p /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2 rsync -auH --exclude=/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM /home/anson/codes/buildroot-2021.02/output/target/ /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2/target echo '#!/bin/sh' > /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2/fakeroot echo "set -e" >> /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2/fakeroot echo "chown -h -R 0:0 /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2/target" >> /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2/fakeroot PATH="/home/anson/codes/buildroot-2021.02/output/host/bin:/home/anson/codes/buildroot-2021.02/output/host/sbin:/home/anson/bin:/home/anson/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" /home/anson/codes/buildroot-2021.02/support/scripts/mkusers /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/full_users_table.txt /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2/target >> /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2/fakeroot echo "/home/anson/codes/buildroot-2021.02/output/host/bin/makedevs -d /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/full_devices_table.txt /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2/target" >> /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2/fakeroot printf ' \n' >> /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2/fakeroot printf ' \n' >> /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2/fakeroot printf ' rm -f /home/anson/codes/buildroot-2021.02/output/images/rootfs.ext2\n /home/anson/codes/buildroot-2021.02/output/host/sbin/mkfs.ext2 -d /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2/target -r 1 -N 0 -m 5 -L "rootfs" -O ^64bit /home/anson/codes/buildroot-2021.02/output/images/rootfs.ext2 "64M" || { ret=$?; echo "*** Maybe you need to increase the filesystem size (BR2_TARGET_ROOTFS_EXT2_SIZE)" 1>&2; exit $ret; }\n' >> /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2/fakeroot chmod a+x /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2/fakeroot PATH="/home/anson/codes/buildroot-2021.02/output/host/bin:/home/anson/codes/buildroot-2021.02/output/host/sbin:/home/anson/bin:/home/anson/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" FAKEROOTDONTTRYCHOWN=1 /home/anson/codes/buildroot-2021.02/output/host/bin/fakeroot -- /home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2/fakeroot rootdir=/home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/ext2/target table='/home/anson/codes/buildroot-2021.02/output/build/buildroot-fs/full_devices_table.txt' mke2fs 1.45.6 (20-Mar-2020) Creating regular file /home/anson/codes/buildroot-2021.02/output/images/rootfs.ext2 Creating filesystem with 65536 1k blocks and 16384 inodes Filesystem UUID: 7882b549-c37b-4741-9546-c893e7457164 Superblock backups stored on blocks: 8193, 24577, 40961, 57345 Allocating group tables: done Writing inode tables: done Copying files into the device: __populate_fs: Could not allocate block in ext2 filesystem while writing file "modules" mkfs.ext2: Could not allocate block in ext2 filesystem while populating file system *** Maybe you need to increase the filesystem size (BR2_TARGET_ROOTFS_EXT2_SIZE) fs/ext2/ext2.mk:46: recipe for target '/home/anson/codes/buildroot-2021.02/output/images/rootfs.ext2' failed make[1]: *** [/home/anson/codes/buildroot-2021.02/output/images/rootfs.ext2] Error 1 Makefile:84: recipe for target '_all' failed make: *** [_all] Error 2
前面的编译过程没有的报错, 所以基本判断可以从Maybe you need to increase the filesystem size (BR2_TARGET_ROOTFS_EXT2_SIZE)
解决
查看当前配置(.config):
BR2_TARGET_ROOTFS_EXT2_SIZE="64M"
改为:
BR2_TARGET_ROOTFS_EXT2_SIZE="256M"
产生这个问题的原因是尝试加入了OPENJDK的环境导致系统文件增加(rootfs.ext2), 最终超出了指定的镜像文件大小.
修改后:
~/codes/buildroot-2021.02$ ls -lh output/images/ total 128M -rw-r--r-- 1 anson anson 256M 7月 16 14:04 rootfs.ext2 -rwxr-xr-x 1 anson anson 477 7月 16 14:01 start-qemu.sh -rwxr-xr-x 1 anson anson 14K 7月 16 12:03 vexpress-v2p-ca9.dtb -rw-r--r-- 1 anson anson 4.7M 7月 16 12:03 zImage