How to emulate Raspberry Pi in QEMU

QEMU is an open source emulator that can emulate operating systems from all architectures, including ARM, the architecture of the Raspberry Pi. You can even emulate it on an x86 PC, but it will be slower than on a Raspberry Pi itself since the code is being converted from ARM code to x86 code through QEMU in order to run on the PC. However, it is still nice for trying some Raspberry Pi software and the OS out and even better, you can get a feel of Raspbian and other Raspberry Pi OSes before buying the device itself.

DISCLAIMER: This only works with ARMv6 Pi OSes and only Linux ones. So this won’t work on ARMv7 Linux distros such as Ubuntu MATE and Server, or non-Linux OSes such as RiscOS. While there is a raspi2 machine for QEMU that can run ARMv7 OSes, this machine is still in early development and things such as mouse, keyboard, and internet do not yet work on it, so I will be using an ARMv6 generic machine instead.

First of all, open up a terminal and create a folder for the virtual machine:

mkdir rpi-vm && cd rpi-vm

Next, let’s download the QEMU kernel adapted for Raspberry Pi images

git clone https://github.com/dhruvvyas90/qemu-rpi-kernel.git

Now we need to extract our desired image to the folder. In my case it will be Raspbian Buster Lite, downloadable from here. You can run any Linux ARMv6 OS on it though, provided you use the right kernel in the folder which you can experiment with.

By default, the OS images are very small and only really contain space for the operating system itself.  So, let’s add 4GB of space to the image with the following command:

dd if=/dev/zero bs=1M count=4096 >> 2020-08-20-raspios-buster-armhf-lite.img

Replace 2020-08-20-raspios-buster-armhf-lite.img with whatever your image is called.

We may have added space to the image, but the partitions of the image itself remain the same. So, mount the image as a loopback device with the following command:

sudo losetup -f -P --show 2020-08-20-raspios-buster-armhf-lite.img

Now run gparted /dev/loopX or install the gparted package first if you do not have it installed. Right click on the ext4 partition and expand it to all of the remaining space. Click apply and then close.

Because this kernel is adapted for a virtual machine board, and not a Pi, we must change the fstab so the OS runs well with the kernel. Let’s mount the ext4 root partition with the following command:

sudo mount -o rw /dev/loopXp2 /mnt

Now, let’s edit the fstab file

sudo nano /mnt/etc/fstab

Replace all mentions of mmcblk0p with sda and save. For the image to be compatible with the QEMU VM and kernel, we must also edit another file. Run:

sudo nano /etc/ld.so.preload

Comment out the line and save the file. Then unmount with the following commands:

sudo umount /mnt

sudo losetup -d /dev/loopX

Now, run the VM with the following command:

qemu-system-arm -M versatilepb -cpu arm1176 -m 256 -kernel qemu-rpi-kernel/kernel-qemu-4.19.50-buster -hda 2020-08-20-raspios-buster-armhf-lite.img -append "dwc_otg.lpm_enable=0 root=/dev/sda2 console=tty1 rootfstype=ext4 elevator=deadline rootwait" -dtb qemu-rpi-kernel/versatile-pb-buster.dtb -no-reboot -serial stdio

Of course, if you are running an OS other than Raspbian Buster Lite, you will have to change the image. If you are running an older OS, you may also have to use an older kernel which you can find in the qemu-rpi-kernel folder.

The output should look a little like this:

In my case, I chose to install the LXDE desktop. You can also install a desktop environment if you like, see this for instructions on how to do this with Raspbian Lite.

Here is my setup:

Of course, if running this on an x86 host, it will be slow since QEMU has to translate ARM code to x86 and also because the hardware being emulated itself is slow too. If running on an ARM host with KVM enabled in kernel, it may be faster, but multitasking in the virtual OS and memory intense programs will either way will be a struggle. It’s a nice thing to play around with though, and you can try it with any ARMv6 Pi Linux OS you want. Enjoy!

Python tutorial – How to create basic functions

In Python, a function is a block of code that only runs when it is called later on in the code. Data can be passed into the functions too. One example of a function is print. It runs when it is called in the code, and the text you put inside the bracket is the data being passed into the function.

Continue reading “Python tutorial – How to create basic functions”

Happy 25th birthday to Windows 95!

On this day in 1995, Windows 95 was released. Windows 95 included new features such as the taskbar and start menu, and it was the first version of Windows to run as its own operating system, rather than on top of MS-DOS. It was also the first 32-bit, rather than 16-bit, Windows operating system.

Support for Windows 95 ended, along with several other Windows versions, on the 31st December 2001, however Windows 95 remains a key point in the history of Microsoft Windows.

Here are some pictures of Windows 95:

Windows 95 welcome screen
Paint on Windows 95
Solitare on Windows 95
Internet Explorer on Windows 95
Notepad on Windows 95
Windows 95 startup screen
Happy 25th birthday, Windows 95!

Galaxy Unpacked to take place on 5th August

Galaxy Unpacked, Samsung’s announcement event that happens twice every year, will take place on the 5th August. At Galaxy Unpacked, they are likely to announce the Galaxy Note 20 along other stuff.

The livestream will be taking place at 5pm BST live on the 5th August. This year because of coronavirus, it will only be happening live. You can watch it from Samsung’s website when it starts.

Galaxy Note20

The Galaxy Note20 is expected to be announced at Galaxy Unpacked as the successor of last year’s Note10.

The specs for the Galaxy Note20 are expected to be:

  • CPU: Exynos 990 (Most of the world), Snapdragon 865 (USA, China, Hong Kong, Latin America).
  • RAM: 8GB
  • Screen refresh rate: 120Hz
  • Screen size: 6.42 inches
  • Storage: 128GB
  • Rear cameras: 12MP main, 64MP telephoto, and 12MP ultrawide
  • Battery size: Between 4000mAh and 4300mAh

There is also expected to be a Galaxy Note20 Plus/Ultra with more advanced specs:

  • CPU: Exynos 990 (Most of the world), Snapdragon 865 (USA, China, Hong Kong, Latin America).
  • RAM: 12GB
  • Screen refresh rate: 120Hz
  • Screen size: 6.87 inches
  • Storage: 256GB/512GB
  • Rear cameras: 108MP main, 13MP telephoto, and 12MP ultrawide
  • Battery size: Between 4500mAh and 5000mAh

The Galaxy Note20 is expected to also be the first range of Samsung flagship phones to not have a separate 5G variant and for 5G to be integrated into the main models.

Galaxy Fold

The successor to the Galaxy Fold, which had many issues when released in 2019, is also expected to be announced at Unpacked. The specs are expected to be as follows:

  • CPU: Snapdragon 865
  • RAM: 12GB
  • Screen refresh rate: 120Hz
  • Screen size: 7.7 inches
  • Storage: 256GB
  • Rear cameras: 12MP Quad Camera
  • Battery size: 4500mAh

I certainly hope the Galaxy Fold 2 won’t have the same issues the original one did, and I’m sure many people will be skeptical about this new phablet.

Are you excited for Galaxy Unpacked? I sure am! If you want to watch it live, then go to the Samsung website on the 5th August. I’m excited to see what else Samsung may announce at Unpacked this year.

Apple supporting the iPhone 6S in iOS 14 just shows how far behind Android really is

On the 23rd June at WWDC 2020, which of course due to the current circumstances being held online, Apple announced iOS 14 and iPadOS 14, the new iOS versions. Home screen widgets, no more full screen calls, and a redesigned Siri are just a few of the changes Apple’s new OS includes. The update supports all iPhones as old as the iPhone 6S and iPadOS 14 supports all iPads as old as the iPad Mini 4 and iPad Air 2. This just shows one thing: how far behind Android really is when it comes to better software updates.

Continue reading “Apple supporting the iPhone 6S in iOS 14 just shows how far behind Android really is”

OneUI 2.1 released for Galaxy S9

The OneUI 2.1 update with June 2020 security patch has been released for Galaxy S9 and S9+ phones.

Currently, the update is only available to download in Germany, Taiwan, and Korea, but we can expect to see it roll out to further countries during the coming weeks.

The update includes features such as Quick Share, which is similar to Apple AirDrop; Music Share, which allows you to share your phone’s Bluetooth audio connection with other devices; and in the camera app, there are a ton of new features too including Single Take as well as the pro video mode removed in OneUI 1.0 making a comeback.

With the update also comes a new AR Zone app which puts all the great AR camera features of the Galaxy S9 in a single app.

These are just a few of the many features the S9 has received in the OneUI 2.1 update. However, the update is currently not available in many countries but hopefully will roll out soon to more countries. The update also includes the June 2020 security patch, so it’s recommended you download it.

Sadly, the S9 will probably not be getting Android 11 when it is released on Samsung phones, as it is still following a strict schedule for software updates with only two major OS upgrades, but this could be a sign that Samsung are reconsidering their two major OS upgrades policy for the future.

If you live in Germany, Taiwan, or Korea, then you can download the update now. Otherwise, you will have to wait a little while but hopefully it will come out soon for more countries and carriers soon, as I and I’m sure a lot of you would love to try it.

When OneUI 2.1 gets released in the UK I will not hesitate to do a review on the update, as it definitely sounds good. For now though, I will just have to wait.

Enjoy the update if you can, and if you can’t get it, then please enjoy it when you do get it.

Apple should push security updates out to older iOS devices

Apple have released several security updates to iOS 12 devices such as the iPhone 6 and 5S over the course of the year, and they should continue doing this in the future for other iOS versions.

Continue reading “Apple should push security updates out to older iOS devices”

Five reasons to buy the Galaxy S9 in 2020

The Galaxy S9 may be over two years old now but this phone still has a lot of redeeming qualities that make it perfect for anyone looking to buy a flagship in 2020.

Continue reading “Five reasons to buy the Galaxy S9 in 2020”

Opinion: Samsung need to start using the Snapdragon processor worldwide in their flagship phones

Samsung have always used two different chips for its phones: The latest Qualcomm Snapdragom, some parts of Asia such as China and Hong Kong, as well as Latin America, and the USA, as well as their own Exynos processor used in Europe, most of Asia, Africa, and other places.

Continue reading “Opinion: Samsung need to start using the Snapdragon processor worldwide in their flagship phones”

How much longer will the Galaxy Note8 have left in terms of monthly updates?

Recently, I wrote about the Galaxy S8 and S8+ being moved to Samsung’s quarterly schedule. This is the second time Samsung have done this, with them doing it last year with the Galaxy S7 and S7 edge for the first time. However, 2017’s Galaxy Note flagship remains on the list for monthly updates. So when will the Note8 be demoted?

Continue reading “How much longer will the Galaxy Note8 have left in terms of monthly updates?”