1

Using Qemu I managed to run BlissOS almost perfectly.

For the record this is my script to install and launch BlissOS with Qemu (I use also an additional USB stick for storage to be able later on to snapshot)

#!/bin/dash
#

DO_INSTALL=false
#DO_INSTALL=true

VM_NAME="bliss101"
VM_CDRN="Bliss-v15.8.6-x86_64-OFFICIAL-gapps-20230614.iso"
VM_NIC_MAC="52:54:4a:7a:50:f8"
VM_NIC_NET_RANGE="10.10.11.0/24"
VM_NIC_NET_DHCP_START="10.10.11.10"

#
# installation
#

#
VM_GPATH="/home/nihsotas/vm/"
#
VM_LPATH=${VM_GPATH}${VM_NAME}"/"
VM_BPATH=${VM_LPATH}"bios/"
VM_BIOS_0=${VM_BPATH}${VM_NAME}".flash.OVMF_CODE.fd"
VM_BIOS_1=${VM_BPATH}${VM_NAME}".flash.OVMF_VARS.fd"
#
VM_HDD_0_F="qcow2"
VM_HDD_0=${VM_LPATH}${VM_NAME}".sys."${VM_HDD_0_F}".img"
VM_HDD_0_S="12G"
#
VM_HDD_1_F="qcow2"
VM_HDD_1=${VM_LPATH}${VM_NAME}".dat."${VM_HDD_1_F}".img"
VM_HDD_1_S="8G"
#
VM_CPATH="${VM_GPATH}iso/"
VM_CDR_0=${VM_CPATH}${VM_CDRN}
VM_SPATH=${VM_LPATH}"shared"
#
VM_LOGFILE=${VM_LPATH}${VM_NAME}".log"
#
VM_MEM=4G
#
VM_CPU=$(nproc)
VM_CPU_SOCKETS=1
VM_CPU_CORES=4
VM_CPU_THREADS=1
#
VM_XRES=1440
VM_YRES=800
#
VM_KEYB="fr-be"
#
PORT_FW_1=5556
PORT_FW_2=8023

if [ "$DO_INSTALL" = true ] ; then
    echo "Empty VM harddisK"
    rm ${VM_HDD_0}
    qemu-img create -f ${VM_HDD_0_F} ${VM_HDD_0} ${VM_HDD_0_S}
    qemu-img create -f ${VM_HDD_1_F} ${VM_HDD_1} ${VM_HDD_1_S}
#   mkfs.fat -v ${VM_HDD_1_F} -n ${VM_NAME}dat
#
#   shared data folder
#
    mkdir -p ${VM_SPATH}
fi
#
    GDK_SCALE=1 qemu-system-x86_64 --enable-kvm -D ${VM_LOGFILE} \
    -object memory-backend-memfd,id=ram0,size=${VM_MEM},prealloc=on,share=on,merge=off,dump=off,seal=on \
    -machine type=q35,accel=kvm,vmport=off,dump-guest-core=off,mem-merge=off,hmat=on,usb=on,kernel-irqchip=on,memory-backend=ram0 \
    -no-hpet \
    -cpu host,kvm=off,topoext=on,host-cache-info=on,l3-cache=on,invtsc=on,migratable=off,amd-stibp=off,hypervisor=off,kvm_pv_unhalt=on,kvm_pv_eoi=on \
    -smp ${VM_CPU},sockets=${VM_CPU_SOCKETS},cores=${VM_CPU_CORES},threads=${VM_CPU_THREADS} \
    -m ${VM_MEM},maxmem=${VM_MEM} \
    -drive if=pflash,file=${VM_BIOS_0},format=raw,unit=0,readonly=on \
    -drive if=pflash,file=${VM_BIOS_1},format=raw,unit=1,snapshot=on \
    -audiodev driver=pa,id=snd0 \
    -vga none \
    -serial stdio \
    -display type=sdl,gl=on \
    -device driver=virtio-vga-gl,xres=$VM_XRES,yres=$VM_YRES \
    -device driver=virtio-keyboard-pci \
    -device driver=virtio-tablet-pci \
    -device driver=intel-hda \
    -device driver=hda-duplex,audiodev=snd0 \
    -device virtio-rng-pci \
    -device virtio-iommu-pci \
    -rtc base=localtime,clock=host \
    -device nec-usb-xhci,id=xhci \
    -device ich9-ahci,id=ahci \
    -object iothread,id=iothread0 \
    -drive id=disk0,if=none,file=${VM_HDD_0},format=${VM_HDD_0_F},media=disk,aio=io_uring,cache.direct=on,cache=none \
    -device driver=virtio-blk-pci,drive=disk0,id=virtioblk0,iothread=iothread0,bootindex=1 \
        -drive id=disk1,if=none,file=${VM_HDD_1},format=${VM_HDD_1_F},media=disk,aio=io_uring,cache.direct=on,cache=none \
    -device usb-storage,bus=xhci.0,drive=disk1,id=usbstick,bootindex=3 \
    -drive id=cdrom0,if=none,file=${VM_CDR_0},format=raw,readonly=on,media=cdrom,aio=io_uring \
    -device ide-cd,drive=cdrom0,bus=ahci.3,bootindex=2 \
    -fsdev local,path=${VM_SPATH},security_model=mapped-xattr,id=virfs,writeout=immediate,fmode=660,dmode=770,multidevs=remap \
    -device virtio-9p-pci,fsdev=virfs,mount_tag=hostfs \
    -device driver=virtio-net-pci,id=nic1,netdev=mynet0,modern-pio-notify=on,mac=${VM_NIC_MAC} \
    -netdev type=user,id=mynet0,restrict=off,net=${VM_NIC_NET_RANGE},dhcpstart=${VM_NIC_NET_DHCP_START},restrict=n,hostfwd=tcp::${PORT_FW_1}-:${PORT_FW_2} \
    -k ${VM_KEYB}

Now I want to create a shared folder with the host in folder ${VM_SPATH}

-fsdev local,path=${VM_SPATH},security_model=mapped-xattr,id=virfs,writeout=immediate,fmode=660,dmode=770,multidevs=remap \
-device virtio-9p-pci,fsdev=virfs,mount_tag=hostfs

Once Android is running, I have prompt with root privileges.

I can mount this hostfs with:

mkdir -p /mnt/host
mount -t 9p -o \ trans=virtio,rw,dirsync,nosuid,nodev,noexec,noatime, \
cache=fscache,access=any,msize=512000 \
hostfs /mnt/host

At root it's possibe to read, write files Good so far....

Now I want to make this location visible to ALL USERS who have access to storage, aka the SDCARD. The sdcard seems to use esdfs

So reading a few solutions here and there about mounting in the right namespace I use:

mount -t esdfs -o \ rw,nosuid,nodev,noexec,noatime,lower=1023:1023:664:775,upper=0:1015:771:771, \
derive=multi,noconfine,derive_gid,default_normal,unshared_obb \
/mnt/host /mnt/runtime/write/emulated/0/Shared/Host

Again I can read and write inside /mnt/runtime/write/emulated/0/Shared/Host

However this location does not propagate properly on /sdcard/Shared/Host at all. I think I did something wrong here...

Can somebody help me out on this, wasted a day on this...

0

You must log in to answer this question.

Browse other questions tagged .