Web lists-archives.com

Re: can't boot a Debian on QEMU-mips virtual machine, could be initrd or root device problems




Thanks Reco. The concept I missed is, I need to grab the initrd and
kernel from the installed system, specifically from the /boot
directory. I know that now for all future architectures I mess with!

There are lots of ways to do the same thing, I'm just sharing. To
mount a partition inside raw disk image, one can use the loopback
device.

1.  Determine the byte offset of the desired partition.
$ fdisk -lu
$offset=sector size * start sector

2.  Create the loopback link.
# losetup -o $offset /dev/loop0 image_file

3.  Mount as usual:
# mount /dev/loop0 directory

4.  Copy files, edit/make changes, etc.

5.  When done, umount as usual:
# umount /dev/loop0

6.  Detach the loopback device.
# losetup -d /dev/loop0

Alan


On 4/30/18, Reco <recoverym4n@xxxxxxxxx> wrote:
> 	Hi.
>
> On Mon, Apr 30, 2018 at 06:30:32PM +0200, Thomas Schmitt wrote:
>> > # qemu-system-mips -m 2048 -rtc base=localtime -boot order=c
>> > -nographic -hda debian_mips32b.img -kernel vmlinux-4.9.0-6-4kc-malta
>> > -append "root=/dev/sda1"
>>
>> Shouldn't there be a bootloader installed in debian_mips32b.img ?
>
> No. One of the oddities of QEMU's malta that nobody was able to write a
> working bootloader for it. OP is doing it the only way that's possible.
>
> Reco
>
>