please choosego to mobile | Continue to access the PC version
View: 48579|Reply: 34

[SOLVED] Move to Emmc

[Copy link]

10

threads

55

posts

345

credits

Intermediate member

Rank: 3Rank: 3

credits
345
Published in 2016-2-23 22:21:12 | Show all floors |Read mode
Edited by jernej at 2016-5-6 17:56

How can i move OpenElect from SD to emmc?

0

threads

47

posts

1708

credits

Gold member

Rank: 6Rank: 6

credits
1708
Published in 2016-2-24 01:11:30 | Show all floors
Edited by dx.l at 2016-2-24 14:52

Theoretically, you need to copy all content from sd card to flash at the same partitions.
Then, you need to configure boot loader.
BTW, get some loboris distro and see what in install_to_emmc script, to make alike steps with your distro.

I can't tell you more, because I still not have OPI board.

10

threads

55

posts

345

credits

Intermediate member

Rank: 3Rank: 3

credits
345
 Author| Published in 2016-2-26 07:43:10 | Show all floors
Using SSH i cannot see emmc partition.
  1. OpiElec:~ # df -h
  2. Filesystem                Size      Used Available Use% Mounted on
  3. devtmpfs                400.8M         0    400.8M   0% /dev
  4. /dev/mmcblk0p1          511.7M    113.4M    398.3M  22% /flash
  5. /dev/mmcblk0p2            3.1G      1.3G      1.8G  42% /storage
  6. /dev/loop0              108.1M    108.1M         0 100% /
  7. tmpfs                   402.4M         0    402.4M   0% /dev/shm
  8. tmpfs                   402.4M      5.4M    397.1M   1% /run
  9. tmpfs                   402.4M         0    402.4M   0% /sys/fs/cgroup
  10. tmpfs                   402.4M    236.0K    402.2M   0% /var
  11. tmpfs                   402.4M         0    402.4M   0% /tmp
Copy code


Fourthermore :
Fdisk is not present in Openelec, so the script from loboris cant run

Ideas?

4

threads

1118

posts

9535

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9535
Published in 2016-2-26 08:05:53 | Show all floors
df shows only mounted disks. Check if you see it in /dev folder. Can you post a link to loboris script? Other thing is that his images are using different u-boot, so the script probably won't work anyway.

10

threads

55

posts

345

credits

Intermediate member

Rank: 3Rank: 3

credits
345
 Author| Published in 2016-2-26 15:08:28 | Show all floors
Edited by campioncino at 2016-2-27 01:36
  1. #!/bin/bash

  2. if [ "$(id -u)" != "0" ]; then
  3.    echo "Script must be run as root !"
  4.    exit 0
  5. fi


  6. echo ""
  7. date
  8. echo -e "\033[36m==============================="
  9. echo "Installing Linux system to emmc"
  10. echo -e "===============================\033[37m"
  11. setterm -default
  12. echo ""

  13. _format=${1}

  14. fatsize=64

  15. sdcard="/dev/mmcblk1"
  16. odir="/tmp/_extdir"
  17. bootdir="/tmp/_fatdir"

  18. if [ ! -b ${sdcard}boot0 ]; then
  19.     echo "Error: EMMC not found."
  20.     exit 1
  21. fi
  22. if [ ! -f /boot/boot0_OPI.fex ]; then
  23.     echo "Error: boot0_OPI.fex not found."
  24.     exit 1
  25. fi
  26. if [ ! -f /boot/u-boot_OPI-emmc.fex ]; then
  27.     echo "Error: u-boot_OPI-emmc.fex not found."
  28.     exit 1
  29. fi

  30. umount ${sdcard}* > /dev/null 2>&1
  31. #----------------------------------------------------------
  32. echo ""
  33. echo -n "WARNING: EMMC WILL BE ERASED !, Continue (y/N)?  "
  34. read -n 1 ANSWER

  35. if [ ! "${ANSWER}" = "y" ] ; then
  36.     echo "."
  37.     echo "Canceled.."
  38.     exit 0
  39. fi
  40. echo ""
  41. #----------------------------------------------------------

  42. echo "Erasing EMMC ..."
  43. dd if=/dev/zero of=${sdcard} bs=1M count=32 > /dev/null 2>&1
  44. sync
  45. sleep 1

  46. echo "Creating new filesystem on EMMC ..."
  47. echo -e "o\nw" | fdisk ${sdcard} > /dev/null 2>&1
  48. sync
  49. echo "  New filesystem created on $sdcard."
  50. sleep 1
  51. partprobe -s ${sdcard} > /dev/null 2>&1
  52. if [ $? -ne 0 ]; then
  53.     echo "ERROR."
  54.     exit 1
  55. fi
  56. sleep 1

  57. echo "Partitioning EMMC ..."
  58. sfat=40960
  59. efat=$(( $fatsize * 1024 * 1024 / 512 + $sfat - 1))
  60. echo "  Creating boot & linux partitions"
  61. sext4=$(( $efat + 1))
  62. eext4=""
  63. echo -e "n\np\n1\n$sfat\n$efat\nn\np\n2\n$sext4\n$eext4\nt\n1\nb\nt\n2\n83\nw" | fdisk ${sdcard} > /dev/null 2>&1
  64. echo "  OK."
  65. sync
  66. sleep 2
  67. partprobe -s ${sdcard} > /dev/null 2>&1
  68. if [ $? -ne 0 ]; then
  69.     echo "ERROR."
  70.     exit 1
  71. fi
  72. sleep 1

  73. echo "Formating fat partition ..."
  74. dd if=/dev/zero of=${sdcard}p1 bs=1M count=1 oflag=direct > /dev/null 2>&1
  75. sync
  76. sleep 1
  77. mkfs.vfat -n EMMCBOOT ${sdcard}p1 > /dev/null 2>&1
  78. if [ $? -ne 0 ]; then
  79.     echo "  ERROR formating fat partition."
  80.     exit 1
  81. fi
  82. echo "  fat partition formated."

  83. dd if=/dev/zero of=${sdcard}p2 bs=1M count=1 oflag=direct > /dev/null 2>&1
  84. sync
  85. sleep 1
  86. if [ "${_format}" = "btrfs" ] ; then
  87.     echo "Formating linux partition (btrfs), please wait ..."
  88.     # format as btrfs
  89.     mkfs.btrfs -O ^extref,^skinny-metadata -f -L emmclinux ${sdcard}p2 > /dev/null 2>&1
  90.     if [ $? -ne 0 ]; then
  91.         echo "ERROR formating btrfs partition."
  92.         exit 1
  93.     fi
  94. else
  95.     echo "Formating linux partition (ext4), please wait ..."
  96.     mkfs.ext4 -L emmclinux ${sdcard}p2 > /dev/null 2>&1
  97.     if [ $? -ne 0 ]; then
  98.         echo "ERROR formating ext4 partition."
  99.         exit 1
  100.     fi
  101. fi
  102. echo "  linux partition formated."

  103. #************************************************************************
  104. echo ""
  105. echo "Instaling u-boot to EMMC ..."
  106. dd if=/boot/boot0_OPI.fex of=${sdcard} bs=1k seek=8 > /dev/null 2>&1
  107. if [ $? -ne 0 ]; then
  108.     echo "ERROR installing u-boot."
  109.     exit 1
  110. fi
  111. dd if=/boot/u-boot_OPI-emmc.fex of=${sdcard} bs=1k seek=16400 > /dev/null 2>&1
  112. if [ $? -ne 0 ]; then
  113. echo "ERROR installing u-boot."
  114. exit 0
  115. fi
  116. sync
  117. #************************************************************************


  118. # -------------------------------------------------------------------
  119.    
  120. if [ ! -d $bootdir ]; then
  121.     mkdir -p $bootdir
  122. fi
  123. rm $bootdir/* > /dev/null 2>&1
  124. sync
  125. umount $bootdir > /dev/null 2>&1

  126. if [ ! -d $odir ]; then
  127.     mkdir -p $odir
  128. fi
  129. rm -rf $odir/* > /dev/null 2>&1
  130. sync
  131. umount $odir > /dev/null 2>&1
  132. sleep 1

  133. # ================
  134. # MOUNT PARTITIONS
  135. # ================

  136. if [ "${_format}" = "btrfs" ] ; then
  137.     _mntopt="-o compress-force=lzo"
  138. else
  139.     _mntopt=""
  140. fi

  141. echo ""
  142. echo "Mounting EMMC partitions..."

  143. if ! mount ${sdcard}p1 $bootdir; then
  144.     echo "ERROR mounting fat partitions..."
  145.     exit 1
  146. fi
  147. if ! mount ${_mntopt} ${sdcard}p2 $odir; then
  148.     echo "ERROR mounting linux partitions..."
  149.     umount $bootdir
  150.     exit 1
  151. fi
  152. echo "FAT partitions mounted to $bootdir"
  153. echo "linux partition mounted to $odir"


  154. #-----------------------------------------------------------------------------------------------
  155. echo ""
  156. echo "Copying file system to EMMC ..."
  157. echo ""

  158. #-----------------------------------------------------------------------------------------
  159. rsync -r -t -p -o -g -x --delete -l -H -D --numeric-ids -s --stats / $odir/ > /dev/null 2>&1
  160. if [ $? -ne 0 ]; then
  161.     echo "  ERROR."
  162. fi
  163. #-----------------------------------------------------------------------------------------
  164. sync

  165. rm $odir/usr/local/bin/fs_resize_warning > /dev/null 2>&1

  166. echo "  Creating "fstab""
  167. echo "# OrangePI fstab" > $odir/etc/fstab
  168. if [ "${_format}" = "btrfs" ] ; then
  169.     echo "/dev/mmcblk0p2  /  btrfs subvolid=0,noatime,nodiratime,compress=lzo  0 1" >> $odir/etc/fstab
  170. else
  171.     echo "/dev/mmcblk0p2  /  ext4  errors=remount-ro,noatime,nodiratime  0 1" >> $odir/etc/fstab
  172. fi
  173. echo "/dev/mmcblk0p1  /media/boot  vfat  defaults  0 0" >> $odir/etc/fstab
  174. echo "tmpfs /tmp  tmpfs nodev,nosuid,mode=1777  0 0" >> $odir/etc/fstab
  175. sync

  176. #-----------------------------------------------------------------------------------------
  177. rsync -r -t -p -o -g -x --delete -l -H -D --numeric-ids -s --stats /media/boot/ $bootdir/ > /dev/null 2>&1
  178. if [ $? -ne 0 ]; then
  179.     echo "  ERROR."
  180. fi
  181. #-----------------------------------------------------------------------------------------
  182. sync


  183. # UMOUNT
  184. if ! umount $bootdir; then
  185.   echo "ERROR unmounting fat partition."
  186.   exit 1
  187. fi
  188. rm -rf $bootdir/* > /dev/null 2>&1
  189. rmdir $bootdir > /dev/null 2>&1

  190. if ! umount $odir; then
  191.     echo "ERROR unmounting linux partitions."
  192.     exit 0
  193. fi

  194. rm -rf $odir/* > /dev/null 2>&1
  195. rmdir $odir > /dev/null 2>&1
  196. sync

  197. echo ""
  198. echo -e "\033[36m*******************************"
  199. echo "Linux system installed to EMMC."
  200. echo -e "*******************************\033[37m"
  201. setterm -default
  202. echo ""

  203. exit 0
Copy code
and that's the dev folder
  1. OpiElec:/dev # ls -a
  2. .                   loop6               tty1                tty50
  3. ..                  loop7               tty10               tty51
  4. apm_bios            mali                tty11               tty52
  5. autofs              mem                 tty12               tty53
  6. block               mmcblk0             tty13               tty54
  7. bsg                 mmcblk0p1           tty14               tty55
  8. btrfs-control       mmcblk0p2           tty15               tty56
  9. bus                 mqueue              tty16               tty57
  10. cachefiles          net                 tty17               tty58
  11. cedar_dev           network_latency     tty18               tty59
  12. char                network_throughput  tty19               tty6
  13. console             null                tty2                tty60
  14. cpu_dma_latency     ppp                 tty20               tty61
  15. cuse                ptmx                tty21               tty62
  16. deinterlace         pts                 tty22               tty63
  17. disk                ram0                tty23               tty7
  18. disp                ram1                tty24               tty8
  19. fb0                 ram10               tty25               tty9
  20. fb1                 ram11               tty26               ttyS0
  21. fb2                 ram12               tty27               tv
  22. fb3                 ram13               tty28               uhid
  23. fb4                 ram14               tty29               uinput
  24. fb5                 ram15               tty3                ump
  25. fb6                 ram2                tty30               urandom
  26. fb7                 ram3                tty31               usb
  27. fd                  ram4                tty32               vcs
  28. full                ram5                tty33               vcs1
  29. fuse                ram6                tty34               vcs2
  30. hdmi                ram7                tty35               vcs3
  31. hidraw0             ram8                tty36               vcs4
  32. hidraw1             ram9                tty37               vcs5
  33. i2c-0               random              tty38               vcs6
  34. initctl             rtc                 tty39               vcsa
  35. input               rtc0                tty4                vcsa1
  36. ion                 sda                 tty40               vcsa2
  37. kmsg                shm                 tty41               vcsa3
  38. lirc0               snd                 tty42               vcsa4
  39. log                 spidev0.0           tty43               vcsa5
  40. loop-control        stderr              tty44               vcsa6
  41. loop0               stdin               tty45               vmouse
  42. loop1               stdout              tty46               watchdog
  43. loop2               sunxi-reg           tty47               zero
  44. loop3               sunxi_soc_info      tty48
  45. loop4               tty                 tty49
  46. loop5               tty0                tty5
Copy code

I think that sunxi-tools are missing

4

threads

1118

posts

9535

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9535
Published in 2016-2-27 03:15:29 | Show all floors
You are right, but that's true also for other programs. Anyway, this script has no chance working with OpenELEC, because it is too different. However, now that I see what is done, I could try to write something. But first I would need to borrow PLUS board. No promises here.

10

threads

55

posts

345

credits

Intermediate member

Rank: 3Rank: 3

credits
345
 Author| Published in 2016-2-27 04:20:12 | Show all floors
First of all, thanks a lot for your reply and your work.

May I ask you some other questions?

1) is possible to "open" the read-only filesystem in OpenELEC?
2) the physical power button is not working, is there any possibility to enable it?

4

threads

1118

posts

9535

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9535
Published in 2016-2-28 18:17:40 | Show all floors
Not sure what do you mean with 1). Give an example.

2) is work in progress.

10

threads

55

posts

345

credits

Intermediate member

Rank: 3Rank: 3

credits
345
 Author| Published in 2016-2-28 20:04:18 | Show all floors
Openelec is a Read-Only File System,  it would be nice if it could be opened (so we can create folder, modify password, etc etc)
In hopes of having a complete open linux-based media center.

But, is just a curiosity.

Thanks a lot for your work.

1

threads

90

posts

791

credits

Senior member

Rank: 4

credits
791
Published in 2016-2-29 16:01:25 | Show all floors
Edited by lymon at 2016-2-29 16:09

You can't, This is the point of OpenELEC . it is an embedded operating system built around Kodi..also to prevent people from messing around with the main filesystem and break things and then start complaining it doesn't work (anymore)
It is designed to be as lightweight as possible in terms of size and complexity.

You can put/load necessary files in /storage (and /storage/.config) , which is writable and can be used to load/start modules or additional software packages.
Modification of root password (and adding/changing other things to the readonly filesystem) can only be done by compiling Openelec yourself or by using this method: http://wiki.openelec.tv/index.php/Mksquashfs_Add-on_how-to



You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list