openmiko / openmiko

Open source firmware for Ingenic T20 based devices such as WyzeCam V2, Xiaomi Xiaofang 1S, iSmartAlarm's Spot+ and others.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

swapfile forced to partition that doesn't necessarily exist in openmiko-gen.sh

jangliss opened this issue · comments

Describe the bug
In utilities/openmiko-gen.sh the configuration file that is built enables swap and specifies the path to be a partition on an sdcard.

openmiko-gen.sh

Specs
On line 78-83 in openmiko-gen.sh the swap is turned on, and the path is set to dev/mmcblk0p1

SWAPFILE=/dev/mmcblk0p1

Unless somebody has partitioned their sdcard to have 2 partitions, and the first partition is of type swap, this will cause a failure.

In addition, SD_PARTITION is overwritten to be the second partition on the sdcard, which is used in /usr/bin/general_init.sh.

To Reproduce

  1. cd ./utilities
  2. mkdir -p config/overlay/etc
  3. ./openmiko-gen.sh config/overlay/etc
  4. Observe configuration having swap specified as a block device, and it turning on swap. The default configuration located in overlay_minimal/etc/openmiko.conf does not enable swap, nor specify the block device.

Expected behavior
Add a new option for enabling swap in the openmiko-gen.sh script. When attempting to swapon the partition, make sure it exists first.