Skip to content

Instantly share code, notes, and snippets.

@theStack
Last active November 22, 2023 15:15
Show Gist options
  • Select an option

  • Save theStack/6eaeadd3fa1e521ed038b1ed93c101d6 to your computer and use it in GitHub Desktop.

Select an option

Save theStack/6eaeadd3fa1e521ed038b1ed93c101d6 to your computer and use it in GitHub Desktop.
Running Bitcoin Core on an emulated 32-bit ARM system using qemu
# Running Bitcoin Core on an emulated 32-bit ARM system using qemu (for reproducing issue #28906 and testing the fix PR #28913)
# guide based on https://translatedcode.wordpress.com/2016/11/03/installing-debian-on-qemus-32-bit-arm-virt-board/
# tested on Ubuntu 22.04 LTS
$ sudo apt-get install qemu-system-arm libguestfs-tools
$ wget -O installer-vmlinuz http://http.us.debian.org/debian/dists/bookworm/main/installer-armhf/current/images/netboot/vmlinuz
$ wget -O installer-initrd.gz http://http.us.debian.org/debian/dists/bookworm/main/installer-armhf/current/images/netboot/initrd.gz
$ qemu-img create -f qcow2 myarmdisk.qcow2 80G
$ qemu-system-arm -M virt -m 2048 -kernel installer-vmlinuz -initrd installer-initrd.gz \
-drive if=none,file=myarmdisk.qcow2,format=qcow2,id=hd \
-device virtio-blk-device,drive=hd \
-netdev user,id=mynet \
-device virtio-net-device,netdev=mynet \
-nographic -no-reboot
=== follow the installation instructions (simply use default options everywhere, in the last menu choose "continue without bootloader") ===
$ sudo virt-get-kernel -a myarmdisk.qcow2
$ qemu-system-arm -M virt -m 2048 -kernel vmlinuz-6.1.0-13-armmp-lpae -initrd initrd.img-6.1.0-13-armmp-lpae \
-append 'root=/dev/vda2' \
-drive if=none,file=myarmdisk.qcow2,format=qcow2,id=hd \
-device virtio-blk-device,drive=hd \
-netdev user,id=mynet \
-device virtio-net-device,netdev=mynet \
-nographic -no-reboot
=== wait until the boot of the emulated arm machine is finished, should see a login prompt ===
=== login as root ===
# apt-get install git autoconf pkg-config libtool build-essential libboost-dev libevent-dev
# swapoff -a
# exit
=== login as user ===
$ git clone https://github.com/bitcoin/bitcoin
$ cd bitcoin
$ git checkout d752349029ec7a76f1fd440db2ec2e458d0f3c99
$ ./autogen.sh
$ ./configure --disable-wallet --with-gui=no
$ make ./src/bitcoind
$ cp ./src/bitcoind ./bitcoind-master
$ git fetch origin pull/28913/head:pr28913_fix_pool_allocator
$ git checkout pr28913_fix_pool_allocator
$ make ./src/bitcoind
$ cp ./src/bitcoind ./bitcoind-fixed
$ ./bitcoind-master -dbcache=100 -stopatheight=350000
=== should go OOM ===
$ rm -rf ~/.bitcoin
$ ./bitcoind-fixed -dbcache=100 -stopatheight=350000
=== should work ===
@martinus
Copy link
Copy Markdown

Awesome, thanks for that!

@pablomartin4btc
Copy link
Copy Markdown

I was already doing something similar, thanks for this!

@theStack
Copy link
Copy Markdown
Author

Updated the instructions to include turning off swap memory (# swapoff -a). With this, I get the OOM on master after block height 322923.

@pablomartin4btc
Copy link
Copy Markdown

Installation instructions: so far so good... I'll try to repro de issue #28906 now and verify the fix #28913...

@pablomartin4btc
Copy link
Copy Markdown

It all worked for me, many thanks again!

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