To be specific here, we're simply emulating Raspberry Pi OS (64-bit) in qemu. So it is as good for any other Raspberry Pis as it is for Raspberry Pi 4. :D
Hope it helps.
Shortcomings: No GUI yet, only console.
You might want to read this to get an introduction to armel vs armhf.
If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.
First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux
This is basically a rehash of an original post on CNXSoft - all credit (particularly for the Virtio device arguments used below) belongs to the author of that piece.
Download the latest uefi1.img image. E.g. ubuntu-16.04-server-cloudimg-arm64-uefi1.img from https://cloud-images.ubuntu.com/releases/16.04/release/
Download the UEFI firmware image QEMU_EFI.fd from https://releases.linaro.org/components/kernel/uefi-linaro/latest/release/qemu64/
Determine your current username and get your current ssh public key:
| #!/bin/sh | |
| #Check the Drive Space Used by Cached Files | |
| du -sh /var/cache/apt/archives | |
| #Clean all the log file | |
| #for logs in `find /var/log -type f`; do > $logs; done | |
| logs=`find /var/log -type f` | |
| for i in $logs |
| #include <stdint.h> //for int8_t | |
| #include <string.h> //for memcmp | |
| #include <wmmintrin.h> //for intrinsics for AES-NI | |
| //compile using gcc and following arguments: -g;-O0;-Wall;-msse2;-msse;-march=native;-maes | |
| //internal stuff | |
| //macros | |
| #define DO_ENC_BLOCK(m,k) \ | |
| do{\ |
| ; 1 2 3 4 5 6 7 | |
| ;01234567890123456789012345678901234567890123456789012345678901234567890 | |
| ;======================================================================= | |
| ;+---------------------------------------------------------------------+ | |
| ;| | | |
| ;| Example using FPU registers for floating point calculations. | | |
| ;| | | |
| ;| The purpose of this source code is to demonstrate on how to | | |
| ;| do floating-point operations using FPU registers. | | |
| ;| | |
| #deb cdrom:[Ubuntu 18.04 LTS _Bionic Beaver_ - Release amd64 (20180426)]/ bionic main restricted | |
| # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to | |
| # newer versions of the distribution. | |
| deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted | |
| # deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted | |
| ## Major bug fix updates produced after the final release of the | |
| ## distribution. | |
| deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted |
| sudo su postgres | |
| psql | |
| update pg_database set datistemplate=false where datname='template1'; | |
| drop database Template1; | |
| create database template1 with owner=postgres encoding='UTF-8' | |
| lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0; | |
| update pg_database set datistemplate=true where datname='template1'; |