1#!/bin/sh 2################################################################################ 3# 4# Copyright (C) 2022 Huawei Device Co., Ltd. 5# SPDX-License-Identifier: GPL-2.0 6# 7# Unless required by applicable law or agreed to in writing, software 8# distributed under the License is distributed on an "AS IS" BASIS, 9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10# See the License for the specific language governing permissions and 11# limitations under the License. 12# 13################################################################################ 14# File: mem_debug_t_init.sh 15# 16# Description: mem_debug_t testsuite init script 17# 18# Authors: Wang Yuting - wangyuting36@huawei.com 19# 20# History: May 25 2022 - init scripts 21# 22################################################################################ 23 24pre_condition() 25{ 26 27} 28 29hp_init() 30{ 31 dd if=/dev/random of=/data/hpdisk bs=4096 count=131072 32 losetup /dev/block/loop6 /data/hpdisk 33 hyperhold_device=$(cat /proc/sys/kernel/hyperhold/device) 34 echo /dev/block/loop6 > /proc/sys/kernel/hyperhold/device 35} 36 37hp_enable() 38{ 39 hyperhold_enable=$(cat /proc/sys/kernel/hyperhold/enable) 40 echo enable > /proc/sys/kernel/hyperhold/enable 41} 42 43zram_init() 44{ 45 zram0_group=$(cat /sys/block/zram0/group) 46 zram0_disksize=$(cat /sys/block/zram0/disksize) 47 echo readwrite > /sys/block/zram0/group 48 echo 512M > /sys/block/zram0/disksize 49} 50 51zram_enable() 52{ 53 mkswap /dev/block/zram0 54 swapon /dev/block/zram0 55 aa start -b com.ohos.settings -a com.ohos.settings.MainAbility 56 aa start -b ohos.samples.airquality -a ohos.samples.airquality.default 57 aa start -b ohos.samples.ecg -a ohos.samples.ecg.MainAbility 58 aa start -b ohos.samples.flashlight -a ohos.samples.flashlight.default 59 aa start -b ohos.samples.clock -a ohos.samples.clock.default 60} 61 62echo "***************************MEMDEBUG INIT START***************************" 63free -m 64pre_condition 65hp_init 66hp_enable 67zram_init 68zram_enable 69echo "***************************MEMDEBUG INIT END***************************"