diff --git a/qemu_small_system_demo/config.json b/qemu_small_system_demo/config.json index 300f3cce9dc75b5702aca92e97be1f2d63211d85..36250ba7cd1fb46cf4a099a8b9735ea3c3d39802 100755 --- a/qemu_small_system_demo/config.json +++ b/qemu_small_system_demo/config.json @@ -12,12 +12,15 @@ "subsystem": "distributedschedule", "components": [ { "component": "safwk_lite", "features":[] }, - { "component": "samgr_lite", "features":[] } + { "component": "samgr_lite", "features":[] }, + { "component": "dmsfwk_lite", "features":[] } ] }, { "subsystem": "security", "components": [ + { "component": "permission", "features":[] }, + { "component": "appverify", "features":[] }, { "component": "deviceauth_lite", "features":[] }, { "component": "huks", "features": [ @@ -26,6 +29,13 @@ } ] }, + { + "subsystem": "applications", + "components": [ + { "component": "camera_sample_app", "features":[] }, + { "component": "camera_screensaver_app", "features":[] } + ] + }, { "subsystem": "hiviewdfx", "components": [ @@ -42,6 +52,15 @@ { "component": "init_lite", "features":[] } ] }, + { + "subsystem": "multimedia", + "components": [ + { "component": "camera_lite", "features":[] }, + { "component": "media_lite", "features":[] }, + { "component": "audio_manager_lite", "features":[] }, + { "component": "media_service", "features":[] } + ] + }, { "subsystem": "graphic", "components": [ @@ -69,6 +88,12 @@ { "component": "wpa_supplicant", "features":[] } ] }, + { + "subsystem": "ace", + "components": [ + { "component": "ace_engine_lite", "features":[ "" ] } + ] + }, { "subsystem": "appexecfwk", "components": [ @@ -78,7 +103,14 @@ { "subsystem": "aafwk", "components": [ - { "component": "aafwk_lite", "features":[ "enable_ohos_appexecfwk_feature_ability = false" ] } + { "component": "aafwk_lite", "features":[ "enable_ohos_appexecfwk_feature_ability = true" ] } + ] + }, + { + "subsystem": "global", + "components": [ + { "component": "resmgr_lite", "features":[] }, + { "component": "i18n_lite", "features":[] } ] }, { @@ -98,6 +130,13 @@ { "component": "wlan_device_driver", "features":[] }, { "component": "vibrator_device_driver", "features":[] } ] + }, + { + "subsystem": "powermgr", + "components": [ + { "component": "powermgr_lite", "features":[ "enable_screensaver = true" ] }, + { "component": "battery_lite", "features":[] } + ] } ], "third_party_dir": "//third_party", diff --git a/qemu_small_system_demo/fs.yml b/qemu_small_system_demo/fs.yml index eec4ef6bce97c6cf0dcb3b272fe850641191afd5..ef99be6c430b9479ce5c3d46645a571d9b0ab432 100644 --- a/qemu_small_system_demo/fs.yml +++ b/qemu_small_system_demo/fs.yml @@ -100,6 +100,9 @@ - source_dir: data target_dir: data + ignore_files: + - line_cj.brk + - SourceHanSansSC-Regular.otf - target_dir: app - diff --git a/qemu_small_system_demo/graphic_config/product_graphic_lite_config.h b/qemu_small_system_demo/graphic_config/product_graphic_lite_config.h index 02ef2adc7027fcd42d4452af53d6b93b4be789e6..135db8e81984ae20cd9f24dafd7e4541284c99d0 100644 --- a/qemu_small_system_demo/graphic_config/product_graphic_lite_config.h +++ b/qemu_small_system_demo/graphic_config/product_graphic_lite_config.h @@ -16,6 +16,6 @@ #ifndef PRODUCT_GRAPHIC_LITE_CONFIG_H #define PRODUCT_GRAPHIC_LITE_CONFIG_H -#define VECTOR_FONT_DIR "/storage/data/" +#define VECTOR_FONT_DIR "/sdcard/data/" #endif diff --git a/qemu_small_system_demo/init_configs/init_liteos_a_arm_virt.cfg b/qemu_small_system_demo/init_configs/init_liteos_a_arm_virt.cfg index 0e42b866b5dc407be67dda484aafdbb0a978c06b..1b2ab7bb277fcb6792b7f06926cd3cc3b295ebed 100755 --- a/qemu_small_system_demo/init_configs/init_liteos_a_arm_virt.cfg +++ b/qemu_small_system_demo/init_configs/init_liteos_a_arm_virt.cfg @@ -11,8 +11,10 @@ "chown 7 7 /storage/data/softbus", "mkdir /sdcard", "chmod 0777 /sdcard", - "mount vfat /dev/mmcblk0 /sdcard rw,umask=000", - "mount vfat /dev/mmcblk1 /sdcard rw,umask=000" + "mount vfat /dev/mmcblk0p0 /sdcard rw,umask=000", + "mkdir /userdata", + "chmod 0777 /userdata", + "mount vfat /dev/mmcblk0p1 /userdata rw,umask=000" ] }, { "name" : "init", @@ -32,18 +34,10 @@ }, { "name" : "post-init", "cmds" : [ + "chown 0 99 /dev/hdf", "chown 0 99 /dev/hdf/dev_mgr", "chown 0 99 /dev/hdf/hdfwifi", - "chown 0 99 /dev/gpio", - "chown 0 99 /dev/i2c-0", - "chown 0 99 /dev/i2c-1", - "chown 0 99 /dev/i2c-2", - "chown 0 99 /dev/uartdev-0", - "chown 0 99 /dev/uartdev-1", - "chown 0 99 /dev/uartdev-2", - "chown 0 99 /dev/spidev0.0", - "chown 0 99 /dev/spidev1.0", - "chown 0 99 /dev/spidev1.1" + "chown 0 99 /dev/uartdev-0" ] } ], diff --git a/qemu_small_system_demo/kernel_configs/debug.config b/qemu_small_system_demo/kernel_configs/debug.config index 7e6a40dc0bce13ab9ec49e54639a7c2a115bbd19..0758035870a90254f4db474247cdb182483af095 100644 --- a/qemu_small_system_demo/kernel_configs/debug.config +++ b/qemu_small_system_demo/kernel_configs/debug.config @@ -5,6 +5,7 @@ LOSCFG_BOARD_CONFIG_PATH="device/qemu/arm_virt/liteos_a/board" LOSCFG_KERNEL_HOOK=y LOSCFG_KERNEL_TRACE=y LOSCFG_FS_VFS_BLOCK_DEVICE=y +LOSCFG_FS_FAT_CACHE_SYNC_THREAD=y LOSCFG_FS_FAT_VIRTUAL_PARTITION=y LOSCFG_DEBUG_VERSION=y # LOSCFG_SHELL_LK is not set @@ -14,6 +15,9 @@ LOSCFG_DRIVERS_HDF_PLATFORM=y LOSCFG_DRIVERS_HDF_PLATFORM_GPIO=y LOSCFG_DRIVERS_HDF_PLATFORM_I2C=y LOSCFG_DRIVERS_HDF_PLATFORM_SPI=y +LOSCFG_DRIVERS_HDF_PLATFORM_SDIO=y +LOSCFG_DRIVERS_HDF_PLATFORM_MMC=y +LOSCFG_DRIVERS_HDF_WIFI=y LOSCFG_DRIVERS_HDF_DISP=y LOSCFG_DRIVERS_HDF_INPUT=y LOSCFG_DRIVERS_HDF_STORAGE=y diff --git a/qemu_small_system_demo/qemu_run.sh b/qemu_small_system_demo/qemu_run.sh index 58b13bb52474c70fc3331b1b3a4c7857bb9bd970..4e2a7c654a7786ee3b699abfdadd01c8f17ffa8d 100755 --- a/qemu_small_system_demo/qemu_run.sh +++ b/qemu_small_system_demo/qemu_run.sh @@ -85,7 +85,81 @@ function make_flash(){ dd if=${src_dir}/bootargs of=${flash_name} conv=notrunc seek=9984k oflag=seek_bytes dd if=${src_dir}/rootfs_jffs2.img of=${flash_name} conv=notrunc seek=10M oflag=seek_bytes dd if=${src_dir}/userfs_jffs2.img of=${flash_name} conv=notrunc seek=37M oflag=seek_bytes - echo -e "Success making ${flash_name}...\n" + echo -e "Succeed making ${flash_name}.\n" +} + +function check_mmc_tools(){ + modprobe -n nbd > /dev/null 2>&1 + if [ $? != 0 ]; then + echo "Failed: need kernel module 'nbd'" + exit 1 + fi + + type qemu-img qemu-nbd > /dev/null 2>&1 + if [ $? != 0 ]; then + echo "Failed: need qemu-utils 'qemu-img' and 'qemu-nbd'" + exit 1 + fi + + type parted > /dev/null 2>&1 + if [ $? != 0 ]; then + echo "Failed: need tool 'parted'" + exit 1 + fi +} + +function make_mmc(){ + echo -ne "\nStart making out/smallmmc.img..." + + # Create raw "disk" with 1G, 2G, 5G partitions, all type 0C (FAT32 LBA). + qemu-img create -f raw out/smallmmc.raw 8G > /dev/null + sudo losetup /dev/loop0 out/smallmmc.raw + sudo parted -s /dev/loop0 -- mklabel msdos mkpart primary fat32 2048s 1025MiB \ + mkpart primary fat32 1025MiB 3073MiB mkpart primary fat32 3073MiB -1s + + # Format. + sudo losetup -o 1048576 /dev/loop1 /dev/loop0 + sudo losetup -o 1074790400 /dev/loop2 /dev/loop0 + sudo losetup -o 3222274048 /dev/loop3 /dev/loop0 + sudo mkfs.vfat /dev/loop1 > /dev/null + sudo mkfs.vfat /dev/loop2 > /dev/null + sudo mkfs.vfat /dev/loop3 > /dev/null + + # Clean. + sudo losetup -d /dev/loop3 + sudo losetup -d /dev/loop2 + sudo losetup -d /dev/loop1 + sudo losetup -d /dev/loop0 + + # Convert to qcow2 format. + qemu-img convert -f raw out/smallmmc.raw -O qcow2 out/smallmmc.img + rm out/smallmmc.raw + + # Mount partition 1. + sudo modprobe nbd + sudo qemu-nbd --connect=/dev/nbd0 out/smallmmc.img + sudo mount /dev/nbd0p1 /mnt + + # Copy font files. + sudo mkdir /mnt/data + sudo cp out/arm_virt/qemu_small_system_demo/data/line_cj.brk /mnt/data/ + sudo cp out/arm_virt/qemu_small_system_demo/data/SourceHanSansSC-Regular.otf /mnt/data + + # Mount partition 2. + sudo umount /mnt + sudo mount /dev/nbd0p2 /mnt + + # Copy sample pictures. + sudo cp -r device/qemu/arm_virt/liteos_a/sample/photo /mnt # photo name must alike 'photoXXX.jpg' + sudo cp -r device/qemu/arm_virt/liteos_a/sample/thumb /mnt # thumb resolution 120x120, same name + + # Unmount. + sudo umount /mnt + sudo qemu-nbd -d /dev/nbd0 > /dev/null + sudo modprobe -r nbd + sync out/smallmmc.img # avoid 'Failed to get "write" lock' error + + echo -e "done.\n" } function net_config(){ @@ -109,12 +183,14 @@ function start_qemu(){ sudo `which qemu-system-arm` -M virt,gic-version=2,secure=on -cpu cortex-a7 -smp cpus=1 -m 1G -drive \ if=pflash,file=./${flash_name},format=raw -global virtio-mmio.force-legacy=false -netdev bridge,id=net0 \ -device virtio-net-device,netdev=net0,mac=12:22:33:44:55:66 \ - -device virtio-gpu-device,xres=800,yres=480 -device virtio-tablet-device ${vnc} $qemu_option \ + -device virtio-gpu-device,xres=960,yres=480 -device virtio-tablet-device ${vnc} $qemu_option \ + -drive if=none,file=./out/smallmmc.img,format=qcow2,id=mmc -device virtio-blk-device,drive=mmc \ -device virtio-rng-device else `which qemu-system-arm` -M virt,gic-version=2,secure=on -cpu cortex-a7 -smp cpus=1 -m 1G -drive \ if=pflash,file=./${flash_name},format=raw -global virtio-mmio.force-legacy=false \ - -device virtio-gpu-device,xres=800,yres=480 -device virtio-tablet-device ${vnc} $qemu_option \ + -device virtio-gpu-device,xres=960,yres=480 -device virtio-tablet-device ${vnc} $qemu_option \ + -drive if=none,file=./out/smallmmc.img,format=qcow2,id=mmc -device virtio-blk-device,drive=mmc \ -device virtio-rng-device fi } @@ -128,4 +204,8 @@ elif [ ${add_boot_args} = yes ]; then echo -e "${bootargs}"'\0' > ${src_dir}/bootargs dd if=${src_dir}/bootargs of=${flash_name} conv=notrunc seek=9984k oflag=seek_bytes fi +if [ ! -f "out/smallmmc.img" ]; then + check_mmc_tools + make_mmc +fi start_qemu ${net_enable}