Giter Site home page Giter Site logo

raspiduino / a6lte-kvm Goto Github PK

View Code? Open in Web Editor NEW
18.0 3.0 2.0 172.47 MB

Kernel with ARM/KVM for SM-A600G (Samsung Galaxy A6) with Exynos7870 SoC

License: Other

Makefile 0.27% Shell 0.04% C 97.99% Assembly 1.47% Perl 0.09% C++ 0.04% Awk 0.01% sed 0.01% Python 0.03% GDB 0.01% Yacc 0.02% Lex 0.01% UnrealScript 0.01% SmPL 0.01% Scilab 0.01% XS 0.01% Raku 0.01% Roff 0.01% Clojure 0.01% M4 0.01%
android linux arm kernel linux-kernel kvm qemu qemu-kvm samsung samsung-galaxy

a6lte-kvm's Introduction

Hi there πŸ‘‹

Minesweeper game πŸ’£πŸ’£!

If you came here, why don't you play some minesweeper? The game is open for everyone!

A B C D E F G H
0 🚩 🚩 🚩 🚩 🚩 🚩 🚩 🚩
1 🚩 🚩 🚩 🚩 🚩 🚩 🚩 🚩
2 🚩 🚩 🚩 🚩 🚩 🚩 🚩 🚩
3 🚩 🚩 🚩 🚩 🚩 🚩 🚩 🚩
4 🚩 🚩 🚩 🚩 🚩 🚩 🚩 🚩
5 🚩 🚩 🚩 🚩 🚩 🚩 🚩 🚩
6 🚩 🚩 🚩 🚩 🚩 🚩 🚩 🚩
7 🚩 🚩 🚩 🚩 🚩 🚩 🚩 🚩

Last play

Action Who?
Click 1e Quyet Nguyen
Click 0d Quyet Nguyen
Click 2c Quyet Nguyen
Click 7a PhαΊ‘m ThΓ nh TuyΓͺn
Click 1b Quyet Nguyen

Players

Count Who?
1 virut1
1 xerix123456
1 yeppiidev
1 Π”ΠΌΠΈΡ‚Ρ€ΠΈΠΉ ΠšΠΎΠΌΡƒΠ½ΠΈΡΡ‚ΠΎΠ²
2 Tung912k7
2 a
2 gabrielrozn
3 JoΓ£o Pedro Jacques Hoss
3 a
3 iivaanuss
3 polo-jpg
3 raspiduino
3 trta911
4 filipefontenele
4 y._.h
6 St3P40
7 aidgamesa
8 giangvinhloc610
9 Ram Prakash
9 sawex33

How to play?

Simply you can click on a cell to open it, or click on the flag in that cell to flag it. Or:

  • If you want to click to a cell, open a issue with the title minesweeper:click:yourcelllocation. For example: minesweeper:click:5a
  • If you want to flag a cell as mine, open a issue with the title minesweeper:flag:yourcelllocation. For example: minesweeper:flag:5a

Click here to goto Issue

How this work?

When you open an issue, this will trigger the github action to run the Python script and update the game.

Todo:

  • Add '0' cell open support
  • Make this more colorful

Issue? Questions?

Open an issue and assign to me! Any ideas are welcome! ☺

Credit

Thanks to timburgan and his awesome repo has inspired me!
Thanks to Anurag Hazra and his wonderful project!


Visitor count (it should be 3000 + the below number, since my old count has gone away)

Visitor count

Raspiduino's Github Stats Raspiduino's Github Stats Top langs

About me

My website: https://giangvinhloc610.github.io/

  • 🎈 My hobby: FIRST Robotics πŸ€–, Linux, embedded, electronics, C, Python, emulator, virtualization, porting projects, Nokia
  • πŸ“§ How to reach me: my email [email protected] and [email protected]
  • πŸ”­ I'm currently working on some stupid projects, like running custom FPGA design on roboRIO, object scanner using ESP32, micropython on MRE,...
  • I'm the 2023-2024 (gen 8) (co) head of Programming and Electronics department of GART (and I also manage that account for now), together with @KhiemGOM

Open source never die!

a6lte-kvm's People

Contributors

raspiduino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

a6lte-kvm's Issues

I have unpacked and repacked the files contained inside your boot.img file. Did I do everything correct or not ?

Hello,

I have unpacked and repacked files from your boot.img file. I have unpacked the files stored inside this boot.img file :

https://github.com/raspiduino/a6lte-kvm/releases/download/0.01/boot.tar

and I've used a tool called "unpackbootimg" that I've got from this link :

https://github.com/osm0sis/mkbootimg

this is how I have extracted the files from the boot.img file :

# /mnt/zroot2/zroot2/OS/Android-KVM/Galaxy-A6/osm0sis-mkbootimg# mkdir boot
# ./unpackbootimg -i /mnt/zroot2/zroot2/OS/Android-KVM/Galaxy-A6/Boot-Files/boot-orig.img -o boot

this is what happened :

ANDROID! magic found at: 0
BOARD_KERNEL_CMDLINE androidboot.selinux=permissive
androidboot.selinux=permissive
BOARD_KERNEL_BASE 0x10000000
BOARD_NAME SRPRA31B008KU
BOARD_PAGE_SIZE 2048
BOARD_HASH_TYPE sha1
BOARD_KERNEL_OFFSET 0x00008000
BOARD_RAMDISK_OFFSET 0x01000000
BOARD_SECOND_OFFSET 0x00f00000
BOARD_TAGS_OFFSET 0x00000100
BOARD_OS_VERSION 10.0.0
BOARD_OS_PATCH_LEVEL 2021-03
BOARD_DT_SIZE 509952

then I have removed the old kernel and I have replaced it with a new kernel re-compiled by me,where I have enabled KVM. At this point,I have repacked the files previously extracted and this is how I did that :

cd /mnt/zroot2/zroot2/OS/Android-KVM/Galaxy-A6/Boot-Files/boot/

mkdir ./ramdisk

cd ./ramdisk/

gzip -dc ../boot.img-ramdisk.gz | cpio -imd

find . ! -name . | LC_ALL=C sort | cpio -o -H newc -R root:root | gzip > ../new-boot.img-ramdisk.gz

mkbootimg
--kernel ./boot.img-kernel
--ramdisk ./new-boot.img-ramdisk.gz
--dtb ./boot.img-dt
--cmdline "$(cat ./boot.img-cmdline)"
--base "$(cat ./boot.img-base)"
--kernel_offset "$(cat ./boot.img-kernel_offset)"
--ramdisk_offset "$(cat ./boot.img-ramdisk_offset)"
--second_offset "$(cat ./boot.img-second_offset)"
--os_version ./boot.img-os_version
--os_patch_level ./boot.img-os_patch_level
--tags_offset "$(cat ./boot.img-tags_offset)"
--board ./boot.img-board
--pagesize "$(cat ./boot.img-pagesize)"
--output ./new-boot.img

I would like to know if I did everything correctly. I didn't see any error,but I'm not sure to have done the whole procedure correctly. Thanks.

Boot cycle occurs

I use sm-a600fn
The system version is A600FNXXU3BSD2
I flash in the built 0.01 kernel
But unfortunately, it has a boot cycle
When I flash magisk 25.1 into this kernel,enter download mode every time you restart
Should I rebuild a kernel myself or update system ?
Thanks ! I am very interested in this kind of project

Windows 11 does not recognize the Samsung drivers for my Samsung Galaxy A6 phone.

Hello again.

I've reached Step 1 of the section "installing",where you say to :

Transfer the patched img file to your Windows PC (to use Odin, in Linux you need [Heimdall] https://github.com/Benjamin-Dobell/Heimdall)) and rename it to boot.img. Add the file to tar using 7-zip or tar command then load tar file to AP in Odin. Flash your phone and when it says PASS!, you are doing well!

You didn't say that Windows needs to have the Samsung drivers installed or Odin will not work. Not a problem. I've got them from here :

https://developer.samsung.com/android-usb-driver

and I've installed them on Windows 11. And then I put the phone in Download mode and I have attached the USB cable from the phone to my PC and then I ran Odin. Unfortunately Odin does not work because Windows 11 does not recognize the Samsung drivers. Below you can see the error reported,that goes away when I disconnect the USB cable from the phone to the PC :

2023-07-07 22_45_26-Settings

How can I fix this error ? yes,I tried to connect and disconnect several times the USB port and the USB cable,but the error does not go away.

Could you make this for Galaxy A53?

I'm using A536N, but latest A536U (A536USQU2AVG2) kernel is compatiable.
So I modified arch/arm64/include/asm/virt.h like this

static inline bool is_hyp_mode_available(void)
{
    /*
     * If KVM protected mode is initialized, all CPUs must have been booted
     * in EL2. Avoid checking __boot_cpu_mode as CPUs now come up in EL1.
     */
    if (IS_ENABLED(CONFIG_KVM) &&
        static_branch_likely(&kvm_protected_mode_initialized))
        return true;

    /*
    return (__boot_cpu_mode[0] == BOOT_CPU_MODE_EL2 &&
        __boot_cpu_mode[1] == BOOT_CPU_MODE_EL2);*/
    return 1;
}

Also I removed the string "kvm-arm.mode=protected" from CONFIG_CMDLINE
After compiled, kvm showed in /dev, but it doesn't work properly...

To compile this kernel, you need two things:
Clang 12 : https://android.googlesource.com/platform//prebuilts/clang/host/linux-x86/+archive/b669748458572622ed716407611633c5415da25c/clang-r416183b.tar.gz

Build-tools : https://android.googlesource.com/platform/prebuilts/build-tools/+archive/refs/heads/master.tar.gz

  1. Make directory named 'compiler' in kernel main folder, then extract those in compilers folder.
  2. Open build_kernel.sh, edit like this
#!/bin/bash

export PATH=$(pwd)/compiler/clang/bin:$PATH
export PATH=$(pwd)/compiler/build-tools/path/linux-x86:$(pwd)/compiler/gas:$PATH

make PLATFORM_VERSION=12 ANDROID_MAJOR_VERSION=s LLVM=1 LLVM_IAS=1 ARCH=arm64 TARGET_SOC=s5e8825 CROSS_COMPILE=aarch64-linux-gnu- (defconfig_name)
make PLATFORM_VERSION=12 ANDROID_MAJOR_VERSION=s LLVM=1 LLVM_IAS=1 ARCH=arm64 TARGET_SOC=s5e8825 CROSS_COMPILE=aarch64-linux-gnu- -j32
  1. Open terminal, run build_kernel.sh !

kvm_enabled
kvm_error

OT (but not that much) : Invalid accelerator kvm / kvm run failed , Function not implemented ERRORS trying to virtualize a guest OS on the ARM Chromebook running with a relatively recent kernel version and KVM enabled

Hello.

I see that you are experienced with qemu-kvm,I want to try to ask you what do you think about what I've got from the project that I've completed,but that does not work.

I've enabled KVM on a more recent kernel version,to be precise on the 5.4.244,on the old ARM Chromebook model xe303c12,following mainly this tutorial :

http://www.virtualopensystems.com/en/solutions/guides/kvm-on-chromebook/

This is how I have achieved the goal (or at least I think that I did) :

I have formatted my sd card following the procedure explained by the v.o.s website.

In the u boot source directory I did :

$ sudo ./scripts/sdcard.sh /dev/sdX

This erased all data and created 4 partitions in the sd-card, along with copying the u-boot binary to the first partition:

  1. ChromeOS signed binary (vos chained u-boot)
    
  2. Partition 2 not used
    
  3. EXT2 partition for u-boot files (here I have copied your zImage (converted in uImage and your exynos5250-snow.dtb files). I've got the zip file that you created for me one month ago,here :
    

https://github.com/quarkscript/linux-armv7-xe303c12-only/files/11615040/5.4.244-kvm.zip

I have decompressed it and I've got the zImage file that was stored inside the deb file.

Since I want to use u-boot,I have converted zImage into uImage using the following command :

mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n "Linux kernel" -d zImage uImage

4. EXT4 partition for userspace files. Here I have copied the devuan 4 userland files that I've got here :

https://drive.google.com/u/0/uc?id=1KSgE-3G2GEBzcYhk_JleVYWl6m061GdI&export=download

but I haven't used btrfs fs,but ext4. And I have extended the space on the partition from 1882M to 200 GB.

sudo dd if=nv_uboot-snow.kpart of=/dev/sdX1 (nv_uboot-snow.kpart taken from the vos website)

I wrote a little bash script that executes the command line :

dmesg > /root/Desktop/log

as soon as the desktop environment started. This is the content of the log file :

https://pastebin.ubuntu.com/p/GQ59sqt72v/

I read "kvm: Hyp mode initialized successfully". So I'm sure that kvm is working on the kernel version that I've used (5.4.244),infact :

Screenshot_2023-08-04_14-50-02-1

OK,now let's talk about how to virtualize a GUEST os.

I've installed virt-manager and I tried to create a new virtual machine. With my big surprise,I saw the warning :

KVM is not available. This may mean the KVM package is not installed or the KVM kernel modules are not loaded.

What could be the cause ? KVM seems to be running great. It is detected by kvm-ok and even virt-manager can establish a connection to QEMU / KVM. The qemu version installed is 5.2.0.

I conducted some further experiments :

In this example I've used qemu 5.2.0 installed by default by the devuan 4 :

qemu-system-arm \
    -enable-kvm -serial stdio -kernel zImage \
    -m 512 -M vexpress-a15 -cpu cortex-a15 \
    -drive file=/mnt/fisso/bhyve/img/Linux/ubuntu2210.img,id=virtio-blk,if=none \
    -device virtio-blk,drive=virtio-blk,transport=virtio-mmio.0 \
    -device virtio-net,transport=virtio-mmio.1,netdev=net0,mac="52:54:00:12:34:55" \
    -netdev type=user,id=net0 \
    -append "earlyprintk=ttyAMA0 console=ttyAMA0 mem=512M \
             virtio_mmio.device=1M@0x4e000000:74:0 \
             virtio_mmio.device=1M@0x4e100000:75:1 \
             root=/dev/vda rw ip=dhcp --no-log"

qemu-system-arm: invalid accelerator kvm. 

In this example I've compiled qemu-system-arm on ubuntu 12.04 as described by the vos tutorial and then I've copied the libraries produced on ubuntu 12.04 to the devuan 4 + 5.4 kernel installation :

/12.04/usr/local/bin/./qemu-system-arm \
    -enable-kvm -serial stdio -kernel zImage \
    -m 512 -M vexpress-a15 -cpu cortex-a15 \
    -drive file=/mnt/fisso/bhyve/img/Linux/ubuntu2210.img,id=virtio-blk,if=none \
    -device virtio-blk,drive=virtio-blk,transport=virtio-mmio.0 \
    -device virtio-net,transport=virtio-mmio.1,netdev=net0,mac="52:54:00:12:34:55" \       
    -netdev type=user,id=net0 \
    -append "earlyprintk=ttyAMA0 console=ttyAMA0 mem=512M \
             virtio_mmio.device=1M@0x4e000000:74:0 \
             virtio_mmio.device=1M@0x4e100000:75:1 \
             root=/dev/vda rw ip=dhcp --no-log"


(process:2843): GLib-WARNING **: 14:17:40.742: ../../../glib/gmem.c:497: custom memory allocation vtable not supported

error: kvm run failed Function not implemented

At this point I don't know what to do to enable the kvm acceleration,but I have a vague idea about the reason why it does not work.

The virtual open systems developers says :

The guests that we will create later will be based on the Versatile Express QEMU machine model. For we will use a different kernel branch specific to that platform:

In my opinion :

In the first experiment,KVM does not work because qemu 5.2.0 is too new and / or it is not patched by v.s.o developers.

In the second experiment,KVM does not work because the qemu version used by v.o.s is very old and it is not compatible with the kernel that I'm using, 5.4.244.

My final goal is to virtualize FreeBSD on the ARM Chromebook,but I think that I will never be able to do this. Maybe,with your help I will be able to virtualize Ubuntu. Maybe.

I've also got an answer by Peter Maidell,a very known qemu-kvm developer,which says :

You can't use KVM with the vexpress-a15 board. The only Arm guest machine that will work with KVM is the "virt" board.
Further, it looks like your host CPU is 32-bit. QEMU 5.2 dropped support for running KVM on 32-bit hosts, because this
support was dropped from host kernels in kernel version 5.7. Basically, 32-bit hosts are just too small to do anything
sensible with virtual machines, which is why the kernel (and in turn QEMU) dropped that support. If you want to play
around with Arm virtualization, use a 64-bit host (64-bit hosts can still use KVM to virtualize 32-bit guests if you want
32 bit guests)

I don't know if he read well what I said or if I didn't understand something,BUT :

point 1)

On the virtual open systems website they used the vexpress-a15 board. You can read by yourself what they say :

The guests that we will create later will be based on the Versatile Express QEMU machine model. For we will use a different kernel branch specific to that platform:

$ git checkout origin/kvm-vexpress-3.9
$ curl http://www.virtualopensystems.com/downloads/guides/kvm_on_chromebook/guest-config > .config
$ ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make zImage dtbs -j4

Then we can append the dtb file to the kernel image with:

$ cat arch/arm/boot/dts/rtsm_ve-cortex_a15x1.dtb >> arch/arm/boot/zImage

That way we only need to handle one file. Make sure to copy arch/arm/boot/zImage for later usage.

point 2)

On the devuan 4 host os that I have installed I'm using kernel 5.4,that's lower than 5.7,so the qemu support for it should be there.

point 3)

I tried -M virt like this :

qemu-system-arm \
    -enable-kvm -serial stdio -kernel zImage \
    -m 512 -M virt -cpu cortex-a15 \

but I've got the same error : qemu-system-arm: invalid accelerator kvm.

What to do on step 9 and step 1 / Installing ?

Hello.

I've reached the step 9 of your tutorial and I'm confused what to do because it seems,based on my perspective,that step 9 confuses itself a little bit with step 1 of the installing section. Let's give a look at what you wrote :

Step 9: Open your phone (or any phone), install latest Magisk apk. Open the Magisk app, select Install, click Next, choose patch a file, then transfer the new-boot.img to that phone, patch it using Magisk. The output should be in Download folder.

Step 1: Transfer the patched img file to your Windows PC (to use Odin, in Linux you need Heimdall) and rename it to boot.img. Add the file to tar using 7-zip or tar command then load tar file to AP in Odin. Flash your phone and when it says PASS!, you are doing well!

So,below there are my questions. Please try to be clearer because I don't want to brick my phone. I want to be sure to do correctly before to try.

  1. let's take the Samsung Galaxy A6 and installs magisk there : OK

  2. Open the Magisk app, select Install, click Next, choose patch a file, then transfer the new-boot.img to that phone, patch it using Magisk : OK but you haven't explained how to transfer the new-boot.img file to the phone. Are you sure that everyone knows how to do this ?

  3. The output should be in Download folder : I don't understand what's the output and why it should be there.

  4. Transfer the patched img file to your Windows PC (to use Odin, in Linux you need Heimdall) : If I don't get wrong,the patched file is the new-boot.img file,right ? or it is the ouput that has been stored within the Download folder after the patching ? Should I transfer it from the Download folder of the phone to my Linux box ?

  5. and rename it to boot.img : should I rename the output file to boot.img ?

  6. Add the file to tar using 7-zip or tar command then load tar file to AP in Odin : should I convert the output file in a tar file ?

  7. should I press on the odin button called flash ? you stopped to talk about heimdall. But I'm still using Linux. Does Odin work for Linux ? Which version of Odin should I get for Linux ? I see that there are many.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.