Closed Marietto2008 closed 2 months ago
This is not supported in any way at least and I can't find any reason why you would need to attempt something like this.
If you need to run AOSP in some sort of emulator, there's already an official supported way to achieve this. https://source.android.com/docs/setup/create/avd
I know but to be able to do it is very intriguing for me.
I know but to be able to do it is very intriguing for me.
Then I'm not going to spoil the fun from you figuring it out. ;)
Your cmdline looks very incorrect at least.
-append "console=ttyAMA0,38400 drm.debug=0x0 rootwait rootdelay=5 root=/dev/mmcblk1p2 androidboot.hardware=rpi4 androidboot.selinux=permissive security=selinux selinux=1 androidboot.qemu.hw.mainkeys=0 androidboot.lcd.density=160"
On Android, rootfs is on ramdisk loaded by kernel from ramdisk.img vs. being on any partition. You probably can't have SELinux disabled and enabled at the same time either.
In addition,following your instructions I see that the file userdata.img hasn't been produced. Is this also normal ?
It's created at the point of making the flashable image. https://github.com/raspberry-vanilla/android_device_brcm_rpi4/blob/android-14.0/mkimg.sh#L64-L65
And yes, you need to have userdata partition to have any change of booting Android.
Hello.
I'm not able to find the file userdata.img,but from the messages that I get :
root@Z390-AORUS-PRO-DEST:/mnt/zroot-133/_OS/Android/raspberry-vanilla# ./rpi4-mkimg.sh
Creating image file /mnt/zroot-133/_OS/Android/raspberry-vanilla/out/target/product/rpi4/RaspberryVanillaAOSP14-20240907-rpi4.img...
7168+0 records in
7168+0 records out
7516192768 bytes (7.5 GB, 7.0 GiB) copied, 1.4751 s, 5.1 GB/s
Creating partitions...
Welcome to fdisk (util-linux 2.39.3).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS (MBR) disklabel with disk identifier 0xce1e1fb2.
Comando (m per richiamare la guida): Created a new DOS (MBR) disklabel with disk identifier 0xfb3cd69c.
Comando (m per richiamare la guida): Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): Numero della partizione (1-4, default 1): First sector (2048-14680063, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-14680063, default 14680063):
Created a new partition 1 of type 'Linux' and of size 128 MiB.
Comando (m per richiamare la guida): Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): Numero della partizione (2-4, default 2): First sector (264192-14680063, default 264192): Last sector, +/-sectors or +/-size{K,M,G,T,P} (264192-14680063, default 14680063):
Created a new partition 2 of type 'Linux' and of size 2 GiB.
Comando (m per richiamare la guida): Partition type
p primary (2 primary, 0 extended, 2 free)
e extended (container for logical partitions)
Select (default p): Numero della partizione (3,4, default 3): First sector (4458496-14680063, default 4458496): Last sector, +/-sectors or +/-size{K,M,G,T,P} (4458496-14680063, default 14680063):
Created a new partition 3 of type 'Linux' and of size 256 MiB.
Comando (m per richiamare la guida): Partition type
p primary (3 primary, 0 extended, 1 free)
e extended (container for logical partitions)
Select (default e):
Selected partition 4
First sector (4982784-14680063, default 4982784): Last sector, +/-sectors or +/-size{K,M,G,T,P} (4982784-14680063, default 14680063):
Created a new partition 4 of type 'Linux' and of size 4.6 GiB.
Comando (m per richiamare la guida): Numero della partizione (1-4, default 4): Hex code or alias (type L to list all):
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.
Comando (m per richiamare la guida): Numero della partizione (1-4, default 4):
The bootable flag on partition 1 is enabled now.
Comando (m per richiamare la guida): The partition table has been altered.
Syncing disks.
Image mounted as /dev/loop0
Copying boot...
128+0 records in
128+0 records out
134217728 bytes (134 MB, 128 MiB) copied, 1.16107 s, 116 MB/s
Copying system...
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 55.5621 s, 38.7 MB/s
Copying vendor...
256+0 records in
256+0 records out
268435456 bytes (268 MB, 256 MiB) copied, 5.36113 s, 50.1 MB/s
Creating userdata...
mke2fs 1.47.0 (5-Feb-2023)
Discarding device blocks: fatto
Creazione del file system con 1212160 4k blocchi e 303104 inode
Etichetta del file system=ce0805f8-43d1-4aa0-ad2c-be9ad72822a1
Backup del superblocco salvati nei blocchi:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Allocating group tables: fatto
Scrittura delle tavole degli inode: fatto
Creating journal (16384 blocks): fatto
Scrittura delle informazioni dei super-blocchi e dell'accounting del file system: fatto
Done, created /mnt/zroot-133/_OS/Android/raspberry-vanilla/out/target/product/rpi4/RaspberryVanillaAOSP14-20240907-rpi4.img!
It seems that userdata.img could be called "RaspberryVanillaAOSP14-20240907-rpi4.img". Is it correct ? I don't see any userdata.img file inside the folder below :
Your cmdline looks very incorrect at least.
-append "console=ttyAMA0,38400 drm.debug=0x0 rootwait rootdelay=5 root=/dev/mmcblk1p2 >androidboot.hardware=rpi4 androidboot.selinux=permissive security=selinux selinux=1 >androidboot.qemu.hw.mainkeys=0 androidboot.lcd.density=160"
This is not VERY incorrect. I'm using that line when I boot Android 10 adapted by Antmicro on my Jetson Nano. You can see the qemu parameters that should be used going here at the end of the page :
https://github.com/antmicro/kvm-aosp-jetson-nano/blob/master/README_Jetson_Nano_BSP.md
At least for Android 10 it works perfectly. So,I imagine that for Android 14 it should be changed. How do you suggest to change it ?
It seems that userdata.img could be called "RaspberryVanillaAOSP14-20240907-rpi4.img". Is it correct ?
No. Flashable image that the mkimg.sh
script creates, contains four partitions (boot
, system
, vendor
, and userdata
). I even linked the exact line where the userdata partition is created with mkfs.ext4
.
--> I even linked the exact line where the userdata partition is created with mkfs.ext4.
It seems thats not enough to link "the exact line where the userdata partition is created with mkfs.ext4" if I don't have that file because it is NOT created by your script for some reason. If your script does not create userdata.img it means that we should at least understand the reasons. The better method is to divide the bigger task into smaller ones to understand where it fails.
Your script is broken. Something does not work :
root@Z390-AORUS-PRO-DEST:/mnt/zroot-133/_OS/Android/raspberry-vanilla# fdisk -l
Disk /dev/loop0: 7 GiB, 7516192768 bytes, 14680064 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x07ee67c2
Dispositivo Avvio Start Fine Settori Size Id Tipo
/dev/loop0p1 * 2048 264191 262144 128M c W95 FAT32 (LBA)
/dev/loop0p2 264192 4458495 4194304 2G 83 Linux
/dev/loop0p3 4458496 4982783 524288 256M 83 Linux
/dev/loop0p4 4982784 14680063 9697280 4.6G 83 Linux
root@Z390-AORUS-PRO-DEST:/mnt/zroot-133/_OS/Android/raspberry-vanilla# ls /dev/mapper
control loop0p1 loop0p2 loop0p3 loop0p4
root@Z390-AORUS-PRO-DEST:/mnt/zroot-133/_OS/Android/raspberry-vanilla# sudo mkfs.ext4 /dev/mapper/loop0p4 -I 512 -L userdata
mke2fs 1.47.0 (5-Feb-2023)
Discarding device blocks: fatto
Creazione del file system con 1212160 4k blocchi e 303104 inode
Etichetta del file system=f8ea2c6a-c914-4963-92ea-431dbd5fda4d
Backup del superblocco salvati nei blocchi:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Allocating group tables: fatto
Scrittura delle tavole degli inode: fatto
Creating journal (16384 blocks): fatto
Scrittura delle informazioni dei super-blocchi e dell'accounting del file system: fatto
root@Z390-AORUS-PRO-DEST:/mnt/zroot-133/_OS/Android/raspberry-vanilla# ls userdata*
ls: impossibile accedere a 'userdata*': File or directory not found
If your script does not create userdata.img it means that we should at least understand the reasons.
FFS, it's not supposed to create any userdata.img, but an userdata partition within the flashable image. I understand perfectly what it does and why.
Your script is broken.
No, you just don't understand what it is supposed to do.
As mentioned earlier, what you're attempting is not supported in any shape or form so I don't have time/energy/interest to get into this any further.
If you need to run AOSP in an emulator, use the official Android emulator. https://source.android.com/docs/setup/create/avd
FFS, it's not supposed to create any userdata.img, but an userdata partition within the flashable image. I understand perfectly what it does and why.
So,maybe you don't emulate Android so often,because usually with qemu the userdata partition is declared with :
-drive index=2,if=none,id=userdata,file=userdata.img
But it's not a problem,because now that I've understood where you want it to be,I can still use it in qemu doing something like this :
dd if=/dev/mapper/loop0p4 of=userdata.img
If you need to run AOSP in an emulator, use the official Android emulator.
no. I want to emulate this version of Android.
One only last question,please. Can you tell me if the content of the userdata.img file that you see below,is correct ? thanks.
Hello bro.
I'm trying to emulate Android 14 for raspberry pi 4 on my PC,where I have installed Ubuntu 24.04 X64 bit using QEMU emulator version 9.0.93 (v9.1.0-rc3). This is the script that I ran :
This is what happens when I run it :
The error that I get is interesting. It seems that some important file is missing inside the /sys folder of the system.img file ? Let's see the content of that folder :
it's empty. Is normal ? In addition,following your instructions I see that the file userdata.img hasn't been produced. Is this also normal ?