X86

From Maemo Leste Wiki
Revision as of 12:45, 27 May 2020 by Brabo (talk | contribs) (Created page with "=== Running on x86/x86_64 === The contents of the <code>qcow2</code> file can be extracted and copied into hard drives for bare metal BIOS/Legacy CSM booting. To extract the...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Running on x86/x86_64

The contents of the qcow2 file can be extracted and copied into hard drives for bare metal BIOS/Legacy CSM booting.

To extract the contents of the qcow2 file, decompress it first and convert it into raw format.

$ xz -d maemo-leste-1.0-amd64-virtual-20180425.qcow2.xz
$ qemu-img convert -f qcow2 -O raw maemo-leste-1.0-amd64-virtual-20180425.qcow2 maemo-leste-1.0-amd64-virtual-20180425.raw

The raw image that it yields, can then be setup as a loopback device, and its partitions mounted.

# losetup --partscan -f maemo-leste-1.0-amd64-virtual-20180425.raw
# mkdir /mnt/maemo-virt
# mount /dev/loop0p1 /mnt/maemo-virt

Setup one Linux partition on the device to be used for booting, format it with a GRUB-compatible filesystem (ext4, for example), then mount it as well.

# cfdisk /dev/sdb
# ...
# mkfs.ext4 /dev/sdb1
# mkdir /mnt/maemo-bare
# mount /dev/sdb1 /mnt/maemo-bare

Change directory to the loop partition, the copy over its contents into the bare metal partition.

# cd /mnt/maemo-virt
# rsync -aAHXv * /mnt/maemo-bare

Once finished copying, bind mount special filesystems into the bare metal Maemo partition, then change root.

# mount --bind /dev /mnt/maemo-bare/dev
# mount --bind /proc /mnt/maemo-bare/proc
# mount --bind /sys /mnt/maemo-bare/sys
# chroot /mnt/maemo-bare /bin/bash

Load the new root's shell profile, install GRUB to the bare metal boot device (/dev/sdb, in this example), then regenerate the GRUB configuration file.

# . /etc/profile
# grub-install /dev/sdb
# grub-mkconfig -o /boot/grub/grub.cfg

After that, you may exit the chroot environment (Ctrl+D), unmount all the filesystems, then reboot the system into your new bare metal Maemo Leste installation.

# umount /mnt/maemo-virt
# umount -AR /mnt/maemo-bare
# reboot