• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2################################################################################
3#
4# Copyright (C) 2022 Huawei Device Co., Ltd.
5# SPDX-License-Identifier: GPL-2.0
6#
7# Legacy blkg rwstat helpers enabled by CONFIG_BLK_CGROUP_RWSTAT.
8# Do not use in new code.
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16################################################################################
17# File: enhancedswap_t_init.sh
18#
19# Description: enhancedswap_t testsuite init script
20#
21# Authors:     Ma Feng - mafeng.ma@huawei.com
22#
23# History:     Mar 24 2022 - init scripts
24#
25################################################################################
26
27pre_condition()
28{
29
30}
31
32uninit_platform()
33{
34    losetup -d /dev/block/loop7
35    echo ${hyperhold_device} > /proc/sys/kernel/hyperhold/device
36    echo ${hyperhold_enable} > /proc/sys/kernel/hyperhold/enable
37    echo ${zram0_group} > /sys/block/zram0/group
38    echo ${zram0_disksize} > /sys/block/zram0/disksize
39    rm -rf hpdisk
40    swapoff /dev/block/zram0
41    echo 1 > /sys/block/zram0/reset
42}
43
44hp_init()
45{
46    dd if=/dev/random of=hpdisk bs=4096 count=131072
47    losetup /dev/block/loop7 hpdisk
48    hyperhold_device=$(cat /proc/sys/kernel/hyperhold/device)
49    echo /dev/block/loop7 > /proc/sys/kernel/hyperhold/device
50}
51
52hp_enable()
53{
54    hyperhold_enable=$(cat /proc/sys/kernel/hyperhold/enable)
55    echo enable > /proc/sys/kernel/hyperhold/enable
56}
57
58zram_init()
59{
60    zram0_group=$(cat /sys/block/zram0/group)
61    zram0_disksize=$(cat /sys/block/zram0/disksize)
62    echo readwrite > /sys/block/zram0/group
63    echo 512M > /sys/block/zram0/disksize
64}
65
66zram_enable()
67{
68    mkswap /dev/block/zram0
69    swapon /dev/block/zram0
70    aa start -b com.ohos.settings -a com.ohos.settings.MainAbility
71    aa start -b ohos.samples.airquality -a ohos.samples.airquality.default
72    aa start -b ohos.samples.ecg -a ohos.samples.ecg.MainAbility
73    aa start -b ohos.samples.flashlight -a ohos.samples.flashlight.default
74    aa start -b ohos.samples.clock -a ohos.samples.clock.default
75    aa start -b com.ohos.camera -a com.ohos.camera.MainAbility
76    aa start -b com.ohos.permissionmanager -a com.ohos.permissionmanager.MainAbility
77    aa start -b ohos.sample.shopping -a com.example.entry.MainAbility
78    aa start -b ohos.samples.distributedcalc -a ohos.samples.distributedcalc.MainAbility
79
80}
81
82echo "***************************ESWAP INIT START***************************"
83free -m
84uninit_platform
85pre_condition
86hp_init
87hp_enable
88zram_init
89zram_enable
90echo "***************************ESWAP INIT END***************************"