create_grub2: ext2 default parameters for image

The mkfs.ext2 heuristics select the "small" ext2 usage type, which does
not fit well with GiB-sized pen drives. For example, the block size is
just 1024 bytes compared to 4096 for "default". Therefore, we enforce
the default usage type as this fits our use case of dumping the image to
USB sticks better.
This commit is contained in:
Christian Helmuth 2015-02-28 12:42:22 +01:00
parent 86c0656de0
commit da21a3c338
3 changed files with 6 additions and 7 deletions

View File

@ -4,7 +4,7 @@
# \author Christian Helmuth # \author Christian Helmuth
# \date 2014-07-11 # \date 2014-07-11
# #
# We generate an head-image file only. This image contains MBR, label # We generate a head-image file only. This image contains MBR, label
# (partition table), and one primary partition where GRUB2 is installed. The # (partition table), and one primary partition where GRUB2 is installed. The
# image size fits only the GRUB2 binaries and must be extended later to include # image size fits only the GRUB2 binaries and must be extended later to include
# further binaries and data. # further binaries and data.
@ -19,7 +19,7 @@ set -e
# config # config
# #
head_size="4MiB" head_size="8MiB"
head_img="grub2-head.img" head_img="grub2-head.img"
# generate image file # generate image file
@ -33,14 +33,14 @@ fallocate -l $head_size $head_img
parted="parted -s $head_img -- unit MiB" parted="parted -s $head_img -- unit MiB"
$parted "mklabel msdos" $parted "mklabel msdos"
$parted "mkpart primary ext2 1MiB 4MiB" $parted "mkpart primary ext2 1MiB -1s"
# loop image as disk (loop0) and partition 1 (loop1) # loop image as disk (loop0) and partition 1 (loop1)
sudo losetup /dev/loop0 $head_img sudo losetup /dev/loop0 $head_img
sudo losetup /dev/loop1 $head_img -o 1MiB sudo losetup /dev/loop1 $head_img -o 1MiB
# initialize ext2 on partition # initialize ext2 on partition
sudo mkfs.ext2 /dev/loop1 -L GENODE -q sudo mkfs.ext2 /dev/loop1 -L GENODE -q -T default
# install GRUB2 # install GRUB2
mnt=$(mktemp -d) mnt=$(mktemp -d)
@ -62,8 +62,7 @@ insmod legacycfg
terminal_input console terminal_input console
terminal_output console terminal_output console
## just switch to partition 2 and legacy load Genode ## just legacy load Genode
#set root=(hd0,msdos1)
legacy_configfile /boot/grub/menu.lst legacy_configfile /boot/grub/menu.lst
EOF EOF

Binary file not shown.

View File

@ -22,7 +22,7 @@ proc run_image { {unused ""} } {
set grub_img "[genode_dir]/tool/grub2-head.img" set grub_img "[genode_dir]/tool/grub2-head.img"
set disk_img "[run_dir].img" set disk_img "[run_dir].img"
set part1_img "[run_dir]-part1.img" set part1_img "[run_dir]-part1.img"
set run_size [expr [regsub {\s.*} [exec du -sm [run_dir]] {}] + 4] set run_size [expr [regsub {\s.*} [exec du -sm [run_dir]] {}] + 8]
if {[image_disk_size] > 0} { if {[image_disk_size] > 0} {
set disk_size [image_disk_size] set disk_size [image_disk_size]
} else { } else {