Skip to content

Instantly share code, notes, and snippets.

@matteodelabre
Last active December 14, 2023 09:33
Show Gist options
  • Save matteodelabre/92599920b46e5fac9daf58670d367950 to your computer and use it in GitHub Desktop.
Save matteodelabre/92599920b46e5fac9daf58670d367950 to your computer and use it in GitHub Desktop.
reMarkable QEMU VM
  • Build Linux (I used 5.4.161) with imx_v6_v7 config
apt install bison bc lzop libssl-dev
make O=imx7 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- imx_v6_v7_defconfig
make O=imx7 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
  • Download rM update file (I used 2.10.0.295)
  • Create qcow2 disk
./extractor/extractor.py updates/2.10.0.295_reMarkable2.signed 2.10.0.295_reMarkable2.ext4
qemu-img create -f qcow2 root.qcow2 8G
modprobe nbd
qemu-nbd -c /dev/nbd0 root.qcow2
sfdisk /dev/nbd0 <<SFD
label: dos
label-id: 0xc410b303
device: /dev/nbd0
unit: sectors
sector-size: 512

/dev/nbd0p1 : start=        2048, size=       40960, type=83
/dev/nbd0p2 : start=       43008, size=      552960, type=83
/dev/nbd0p3 : start=      595968, size=      552960, type=83
/dev/nbd0p4 : start=     1148928, size=    13793280, type=83
SFD
mkfs.vfat /dev/nbd0p1
cp 2.10.0.295_reMarkable2.ext4 /dev/nbd0p2
e2fsck -f /dev/nbd0p2
resize2fs /dev/nbd0p2
mkfs.ext4 /dev/nbd0p3
mkfs.ext4 /dev/nbd0p4
mkdir -p /mnt/root /mnt/home
mount /dev/nbd0p2 /mnt/root
mount /dev/nbd0p4 /mnt/home
cp -r /mnt/root/etc/skel /mnt/home/root
sed -i 's/mmcblk2/mmcblk1/' /mnt/root/etc/fstab
sed -i 's/wlan0/eth0/' /mnt/root/lib/systemd/system/dhcpcd.service
umount /dev/nbd0p2
umount /dev/nbd0p4
qemu-nbd -d /dev/nbd0
  • Start the VM
qemu-system-arm \
    -machine mcimx7d-sabre \
    -cpu cortex-a9 \
    -m 2048 \
    -kernel linux/linux-5.4.161/imx7/arch/arm/boot/zImage \
    -dtb linux/linux-5.4.161/imx7/arch/arm/boot/dts/imx7d-sbc-imx7-rm.dtb \
    -drive if=sd,file=root.qcow2,format=qcow2,index=2 \
    -append "console=ttymxc0 rootfstype=ext4 root=/dev/mmcblk1p2 rw rootwait init=/sbin/init" \
    -nographic
  • Login as root with no password
@tvlad1234
Copy link

How did you obtain the firmware update file?

@matteodelabre
Copy link
Author

You can ask people on the community Discord server for an update file.

@Eeems
Copy link

Eeems commented Dec 5, 2023

For anybody finding this, you may be more interested in https://github.com/timower/rM-docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment