-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Note on ndb not being available #5
Comments
Based on @dueringa's suggestion, this is the #!/usr/bin/env bash
SDNAME="$1"
UIMGNAME="$2"
if [ "$#" -ne 2 ]; then
echo "Usage: "$0" sdimage uimage"
exit 1
fi
command -v qemu-img > /dev/null || { echo "qemu-img not installed"; exit 1; }
command -v qemu-nbd > /dev/null || { echo "qemu-nbd not installed"; exit 1; }
sudo modprobe nbd max_part=16 # <----- Added after @dueringa's suggestion
qemu-img create "$SDNAME" 64M
sudo qemu-nbd -c /dev/nbd0 "$SDNAME"
partprobe /dev/nbd0 # <----- Added after @dueringa's suggestion
(echo o;
echo n; echo p;
echo 1
echo ; echo
echo w; echo p) | sudo fdisk /dev/nbd0
sudo mkfs.ext2 /dev/nbd0p1
mkdir tmp || true
sudo mount -o user /dev/nbd0p1 tmp/
sudo cp "$UIMGNAME" tmp/
sudo umount /dev/nbd0p1
rmdir tmp/ || true
sudo qemu-nbd -d /dev/nbd0 |
#!/usr/bin/env bash
SDNAME="$1"
UIMGNAME="$2"
if [ "$#" -ne 2 ]; then
echo "Usage: "$0" sdimage uimage"
exit 1
fi
command -v genimage >/dev/null || { echo "genimage not installed"; exit 1; }
rm -rf tmp rootfs
mkdir rootfs
cp "$UIMGNAME" rootfs
make_ext4fs -l 32M rootfs.ext4 rootfs
cat << EOF > genimage.cfg
image genimage_output.img {
hdimage {
}
partition rootfs {
partition-type = 0x83
image = "rootfs.ext4"
}
}
EOF
genimage --inputpath . --outputpath . genimage.cfg
mv genimage_output.img "${SDNAME}"
qemu-img resize "${SDNAME}" 64M
rm rootfs.ext4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
also in doc/03_bootloader.md, there's a note regarding the nbd module.
At least under Debian Stretch, I had some issues with section, and the SD card creation script, since nbd is not loaded by default. Also, simply executing
modprobe nbd
didn't solve the problem. Specifically, I had to executemodprobe nbd max_part=16
, and after "connecting" the image withqemu-nbd -c /dev/nbd0 sdcard.img
, I had to executepartprobe /dev/nbd0
so the/dev/nbd0p1
device gets created. (Otherwise I could not execute mkfs.ext2 on it).I'm not sure if it's worth mentioning this in the note, since this might be fairly Debian-specific, and other Linux distros might behave differently. (Related bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=824553)
The text was updated successfully, but these errors were encountered: