-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate_odroid_image
More file actions
executable file
·805 lines (707 loc) · 24 KB
/
Copy pathcreate_odroid_image
File metadata and controls
executable file
·805 lines (707 loc) · 24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
#!/bin/bash
# Last update: 2015-01-21
# *****************************************************
# !! REMEMBER TO SET PARAMETERS IN FILE "second-stage *
# *****************************************************
if [ "$(id -u)" != "0" ]; then
echo "Script must be run as root !"
exit 0
fi
echo ""
date
echo "Creating Ubuntu/Debian SD Card instalation for Odroid-C1"
echo "========================================================"
echo ""
_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd $_DIR
# =====================================================
# ==== P A R A M E T E R S ============================
# =====================================================
# *****************************************************
# Set the base name of your image. *
# Distro name is automaticaty appended *
# --------------------------------------------------- *
# IF image_name="", image file won't be created, *
# instalation will be created in local directories *
# linux-$distro & boot-$distro *
# YOU CAN CREATE THE IMAGE LATER RUNNING: *
# sudo ./image_from_dir <directory> [yes|no] *
# yes|no - create or not ext4 only system *
# --------------------------------------------------- *
# IF image_name is BLOCK DEVICE (/dev/sdX) *
# LINUX filesystem will be created directly on it *
# Partition must exist ! *
# IF _format="" partition will NOT be formated *
# otherwyse it will be formated with specified format *
# *****************************************************
#image_name=""
image_name="emlid-rt"
#image_name="/dev/sdX2"
# *****************************************************
# Filesystem type for linux partition *
# *****************************************************
#_format="btrfs"
_format="ext4"
# =====================================================
# IF YOU WANT TO HAVE BOOT FILES ON EXT4 PARTITION =
# AND NOT ON SEPARATE FAT16 PARTITION =
# set _boot_on_ext4="yes" and =
# FAT partitin won't be created =
# =====================================================
_boot_on_ext4="no"
# *****************************************************
# SD Card partitions sizes in MB (1024 * 1024 bytes) *
# *****************************************************
fatsize=64
linuxsize=1800
# *****************************************************
# Select ubuntu/debian distribution and repository *
# SELECT ONLY ONE distro AND ONE repo *
# *****************************************************
# === Ubuntu ===
#distro="precise"
distro="trusty"
#distro="utopic"
repo="http://ports.ubuntu.com/ubuntu-ports"
# === Debian ===
#distro="wheezy"
#distro="jessie"
#repo="http://ftp.hr.debian.org/debian"
# *****************************************************
# Path to odroid u-boot files *
# *****************************************************
BL1="uboot/bl1.bin.hardkernel"
UBOOT="uboot/u-boot.bin"
# ******************************************************
# If you want to xz compress the image and make md5sum *
# set _compress="yes" *
# ******************************************************
_compress="no"
# ^^^^ P A R A M E T E R S ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if [ "${_format}" = "btrfs" ]; then
_boot_on_ext4="no"
fi
# === CHECK DESTINATION ============================================
if [ ! "${image_name}" = "" ]; then
if [ -b $image_name ] && [ "${_boot_on_ext4}" = "yes" ]; then
# === ON BLOCK DEVICE ======================================
echo "Creating filesystem on block device ${image_name} ..."
sdcard=""
odir="_mnt"
bootdir="boot-$distro-sd"
_boot_on_ext4="yes"
_directsd="yes"
# ==========================================================
else
# === ON IMAGE FILE ======================
if [ "${_boot_on_ext4}" = "yes" ] ; then
sdcard="$distro-$image_name-nofat.img"
else
sdcard="$distro-$image_name.img"
fi
odir="linux-$distro-$image_name"
bootdir="boot-$distro-$image_name"
# ========================================
fi
else
# === IN LOCAL DIRECTORY ===
sdcard=""
odir="linux-$distro"
bootdir="boot-$distro"
vfatuuid="6E35-5356"
ext4uuid="e139ce78-9841-40fe-8823-96a304a09859"
# ==========================
fi
# ==================================================================
# ============================================
if [ "${distro}" = "" ]; then
echo "Distribution must be specified."
exit 0
fi
if [ "${repo}" = "" ]; then
echo "Repository must be specified."
exit 0
fi
# ============================================
_excode=0
# **** show progress *******
proc_wait() {
spin='-\|/'
i=0
while kill -0 $1 2>/dev/null
do
i=$(( (i+1) %4 ))
printf "\r$2 ${spin:$i:1}"
sleep .1
done
_excode=$?
if [ $_excode -eq 0 ]
then
printf "\rOK. \n"
else
printf "\rERROR. \n"
fi
}
# **************************
if [ "${_format}" = "btrfs" ] ; then
_mntopt="-o compress-force=lzo"
else
_mntopt=""
fi
# ======================================================================
# IF CREATING ON IMMAGE, PREPARE SD CARD IMAGE FOR ODROID - UBUNTU BOOT
# ----------------------------------------------------------------------
if [ ! "${sdcard}" = "" ]; then
echo "Using disk image \"$sdcard\""
if [ ! -f $BL1 ]; then
echo "Error: $BL1 not found."
exit 1
fi
if [ ! -f $UBOOT ]; then
echo "Error: $UBOOT not found."
exit 1
fi
# remove old image files
rm ${sdcard} > /dev/null 2>&1
rm ${sdcard}1 > /dev/null 2>&1
rm ${sdcard}2 > /dev/null 2>&1
rm ${sdcard}u > /dev/null 2>&1
if [ "${_compress}" = "yes" ]; then
rm ${sdcard}.md5sum > /dev/null 2>&1
rm ${sdcard}.xz > /dev/null 2>&1
rm ${sdcard}.xz.md5sum > /dev/null 2>&1
fi
if [ $linuxsize -eq 0 ]; then
linuxsize=1024
fi
if [ "${_boot_on_ext4}" = "yes" ] ; then
_ersz=$(expr $linuxsize + 2)
else
_ersz=$(expr $fatsize + $linuxsize + 2)
fi
echo "Creating bootable SD card image $sdcard, please wait ..."
echo ""
dd if=/dev/zero of=${sdcard} bs=1M count=$_ersz > /dev/null 2>&1
echo "Creating partition images, please wait ..."
if [ "${_boot_on_ext4}" = "yes" ] ; then
dd if=/dev/zero of=${sdcard}1 bs=1M count=$linuxsize > /dev/null 2>&1
else
dd if=/dev/zero of=${sdcard}1 bs=1M count=$fatsize > /dev/null 2>&1
dd if=/dev/zero of=${sdcard}2 bs=1M count=$linuxsize > /dev/null 2>&1
fi
sync
sleep 2
# Create msdos partition table
echo ""
echo "Creating new filesystem on $sdcard..."
echo -e "o\nw" | fdisk ${sdcard} > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR."
exit 0
fi
sync
echo " New filesystem created on SD card."
echo ""
echo "Partitioning SD card $sdcard..."
if [ "${_boot_on_ext4}" = "yes" ] ; then
echo " Creating ext4"
sext4=3072
if [ $linuxsize == 0 ]; then
eext4=""
else
eext4=$(expr $linuxsize \* 1024 \* 1024 / 512 + $sext4 - 1)
fi
echo -e "n\np\n1\n$sext4\n$eext4\nt\n83\nw" | fdisk ${sdcard} > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR."
exit 0
fi
else
sfat=3072
efat=$(expr $fatsize \* 1024 \* 1024 / 512 + $sfat - 1)
echo " Creating fat & ext4"
sext4=$(expr $efat + 1)
if [ $linuxsize == 0 ]; then
eext4=""
else
eext4=$(expr $linuxsize \* 1024 \* 1024 / 512 + $sext4 - 1)
fi
echo -e "n\np\n1\n$sfat\n$efat\nn\np\n2\n$sext4\n$eext4\nt\n1\n6\nt\n2\n83\nw" | fdisk ${sdcard} > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR."
exit 0
fi
fi
echo " OK."
sync
sleep 2
#echo -e "p\nq\n" | fdisk ${sdcard}
echo ""
if [ ! "${_boot_on_ext4}" = "yes" ] ; then
echo "Formating fat partition ..."
mkfs -t vfat -n BOOT ${sdcard}1 > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR formating fat partition."
exit 0
fi
vfatuuid=`blkid -s UUID -o value ${sdcard}1`
echo " fat partition formated."
echo "Formating linux partition, please wait ..."
if [ "${_format}" = "btrfs" ] ; then
# format as btrfs
mkfs.btrfs -f -L $distro ${sdcard}2 > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR formating btrfs partition."
exit 1
fi
else
mkfs -F -t ext4 -L $distro ${sdcard}2 > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR formating ext4 partition."
exit 1
fi
#tune2fs -o journal_data_writeback ${sdcard}2 > /dev/null 2>&1
#if [ $? -ne 0 ]; then
# echo "ERROR tuning ext4 partition."
# exit 0
#fi
#tune2fs -O ^has_journal ${sdcard}2 > /dev/null 2>&1
#if [ $? -ne 0 ]; then
# echo "ERROR tuning ext4 partition."
# exit 0
#fi
fi
ext4uuid=`blkid -s UUID -o value ${sdcard}2`
else
echo "Formating linux partition, please wait ..."
if [ "${_format}" = "btrfs" ] ; then
# format as btrfs
mkfs.btrfs -f -L $distro ${sdcard}2 > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR formating btrfs partition."
exit 1
fi
else
mkfs -F -t ext4 -L $distro ${sdcard}1 > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR formating ext4 partition."
exit 0
fi
#tune2fs -o journal_data_writeback ${sdcard}1 > /dev/null 2>&1
#if [ $? -ne 0 ]; then
# echo "ERROR tuning ext4 partition."
# exit 0
#fi
#tune2fs -O ^has_journal ${sdcard}1 > /dev/null 2>&1
#if [ $? -ne 0 ]; then
# echo "ERROR tuning ext4 partition."
# exit 0
#fi
fi
ext4uuid=`blkid -s UUID -o value ${sdcard}1`
fi
echo " linux partition formated."
echo ""
echo "Instaling u-boot to $sdcard ..."
dd if=$BL1 of=${sdcard} bs=1 count=442 conv=notrunc > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR installing u-boot."
exit 0
fi
dd if=$BL1 of=${sdcard} bs=512 skip=1 seek=1 conv=notrunc > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR installing u-boot."
exit 0
fi
dd if=$UBOOT of=${sdcard} bs=512 seek=64 conv=notrunc > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR installing u-boot."
exit 0
fi
sync
dd if=${sdcard} of=${sdcard}u bs=512 count=3072 > /dev/null 2>&1
rm ${sdcard}
echo "U-boot installed to $sdcard."
else
echo "Creating root filesistem in local directory $odir..."
fi
# ======================================================================
# Prepare directories
if [ ! "${_boot_on_ext4}" = "yes" ] ; then
if [ ! -d $bootdir ]; then
mkdir -p $bootdir
fi
rm $bootdir/* > /dev/null 2>&1
sync
umount $bootdir > /dev/null 2>&1
fi
if [ ! -d $odir ]; then
mkdir -p $odir
fi
rm -rf $odir/* > /dev/null 2>&1
sync
# =============================================
# IF USING PHISICAL PARTITION, FORMAT AND MOUNT
# =============================================
if [ "${_directsd}" = "yes" ] ; then
umount $image_name > /dev/null 2>&1
if [ "${_format}" = "ext4" ] ; then
# ** formating as ext4
if ! mkfs.ext4 -F -L linux_e ${image_name} > /dev/null 2>&1; then
echo "ERROR formating $image_name."
exit 1
fi
partprobe -s ${image_name} > /dev/null 2>&1
fi
if [ "${_format}" = "btrfs" ] ; then
# format as btrfs
if ! mkfs.btrfs -f -L linux_b ${image_name} > /dev/null 2>&1; then
echo "ERROR formating $image_name."
exit 1
fi
partprobe -s ${image_name} > /dev/null 2>&1
if ! mount -o compress=lzo $image_name $odir; then
echo "ERROR mounting $image_name."
exit 1
fi
else
# do not format, only mount
if ! mount $image_name $odir; then
echo "ERROR mounting $image_name."
exit 1
fi
fi
ext4uuid=`blkid -s UUID -o value ${image_name}`
echo "${image_name} mounted to ${odir}."
rm -rf $odir/* > /dev/null 2>&1
sync
else
umount $odir > /dev/null 2>&1
sleep 1
fi
# ===========================================
# IF USING SD CARD OR IMAGE, MOUNT PARTITIONS
# ===========================================
if [ ! "${sdcard}" = "" ]; then
echo ""
echo "Mounting SD Card partitions..."
if [ ! "${_boot_on_ext4}" = "yes" ] ; then
if ! mount ${sdcard}1 $bootdir; then
echo "ERROR mounting partitions..."
exit 1
fi
if ! mount ${_mntop} ${sdcard}2 $odir; then
echo "ERROR mounting partitions..."
umount $bootdir
exit 1
fi
echo "SD Card partitions mounted to $odir & $bootdir"
else
if ! mount ${_mntop} ${sdcard}1 $odir; then
echo "ERROR mounting partitions..."
if [ ! "${_boot_on_ext4}" = "yes" ] ; then
umount $bootdir
fi
exit 1
fi
fi
echo "SD Card partition mounted to $odir"
fi
#===================================================================================================================
# =========================
# DEBOOTSTRAP UBUNTU DISTRO
# =========================
echo ""
echo "DEBOOTSTRAP, FIRST STAGE"
debootstrap --arch armhf --foreign --verbose --variant=minbase --include=wget $distro $odir $repo > /dev/null 2>&1 &
pid=$!
proc_wait $pid "please wait"
if [ $_excode -ne 0 ]; then
echo "ERROR IN DEBOOTSTRAP!"
exit 0
fi
# ***************************
# ** CREATE NEW sources.list:
# ***************************
echo "Creating \"sources.list\""
case ${distro} in trusty|utopic|precise)
cat > $odir/sources.list << _EOF_
deb $repo/ $distro main restricted universe multiverse
deb-src $repo/ $distro main restricted universe multiverse
deb $repo/ $distro-updates main restricted universe multiverse
deb-src $repo/ $distro-updates main restricted universe multiverse
deb $repo/ $distro-security main restricted universe multiverse
deb $repo/ $distro-backports main restricted universe multiverse
deb http://deb.odroid.in/c1/ trusty main
deb http://deb.odroid.in/ trusty main
_EOF_
;;*)
cat > $odir/sources.list << _EOF_
deb $repo/ $distro main contrib non-free
deb-src $repo/ $distro main contrib non-free
deb $repo/ $distro-updates main contrib non-free
deb-src $repo/ $distro-updates main contrib non-free
deb $repo/ $distro-backports main contrib non-free
deb-src $repo/ $distro-backports main contrib non-free
deb http://deb.odroid.in/c1/ trusty main
deb http://deb.odroid.in/ trusty main
_EOF_
;;esac
if [ "${distro}" = "utopic" ] ; then
# kodi from hardkernel repository needs some lib's from trusty !!!
echo "deb $repo/ trusty main universe" >> $odir/sources.list
fi
# make necessary directories and copy some files
mkdir -p $odir/etc/default > /dev/null 2>&1
if [ ! "${_boot_on_ext4}" = "yes" ] ; then
mkdir -p $odir/media/boot
fi
mkdir -p $odir/media/odroid
mkdir -p $odir/usr/local/bin
cp /etc/timezone $odir/etc
cp /usr/bin/qemu-arm-static $odir/usr/bin
cp second-stage $odir/second-stage
cp wallpaper.png $odir/ > /dev/null 2>&1
#======================================================================================
if ! chroot $odir /usr/bin/qemu-arm-static -cpu cortex-a9 /bin/bash /second-stage; then
mv $odir/install.log . > /dev/null 2>&1
echo "================================================"
echo "ERROR on second-stage, instalation NOT FINISHED."
echo "================================================"
exit 1
fi
if [ ! -f $odir/_OK_ ]; then
mv $odir/install.log . > /dev/null 2>&1
echo "================================================"
echo "ERROR on second-stage, instalation NOT FINISHED."
echo "================================================"
exit 1
fi
#======================================================================================
rm $odir/_OK_ > /dev/null 2>&1
rm $odir/second-stage > /dev/null 2>&1
mv $odir/install.log ./install-${distro}.log > /dev/null 2>&1
# Copy scripts
cp fs_resize $odir/usr/local/bin
cp install_desktop $odir/usr/local/bin
cp install_mini_desktop $odir/usr/local/bin
# Copy boot files
if [ ! "${_boot_on_ext4}" = "yes" ] ; then
mv $odir/media/boot/* $bootdir
cp $odir/boot/* $bootdir
cp $bootdir/uInitrd $odir/boot
cp $bootdir/boot.ini $odir/boot > /dev/null 2>&1
fi
# Test
if [ ! -f $odir/boot/uInitrd ]; then
echo "============================="
echo "WARNING: uInird NOT CREATED !"
echo "============================="
#exit 0
fi
sync
rm -rf $odir/dev/*
rm -rf $odir/proc/*
rm -rf $odir/run/*
rm -rf $odir/sys/*
rm -rf $odir/tmp/*
echo ""
# ***************
# Create fstab
# ***************
echo "Creating \"fstab\""
echo "# Odroid fstab" > $odir/etc/fstab
echo "" >> $odir/etc/fstab
if [ "${_format}" = "btrfs" ] ; then
echo "UUID=$ext4uuid / btrfs noatime,nodiratime,compress=lzo 0 1" >> $odir/etc/fstab
else
# echo "#UUID=$ext4uuid / ext4 errors=remount-ro,noatime,nodiratime,data=writeback 0 1" >> $odir/etc/fstab
echo "UUID=$ext4uuid / ext4 errors=remount-ro,noatime,nodiratime 0 1" >> $odir/etc/fstab
fi
if [ ! "${_boot_on_ext4}" = "yes" ] ; then
echo "UUID=${vfatuuid} /media/boot vfat defaults,rw,owner,flush,umask=000 0 0" >> $odir/etc/fstab
fi
echo "tmpfs /tmp tmpfs nodev,nosuid,mode=1777 0 0" >> $odir/etc/fstab
# ******************************
# CREATE Odroid-C1 boot.ini file
# You can modify parameters
# ******************************
if [ "${_boot_on_ext4}" = "yes" ] ; then
if [ "${_directsd}" = "yes" ] ; then
_ul1="fatload mmc 0:1 0x21000000 uImage"
_ul2="fatload mmc 0:1 0x22000000 uInitrd"
_ul3="fatload mmc 0:1 0x21800000 meson8b_odroidc.dtb"
else
_ul1="ext4load mmc 0:1 0x21000000 boot/uImage"
_ul2="ext4load mmc 0:1 0x22000000 boot/uInitrd"
_ul3="ext4load mmc 0:1 0x21800000 boot/meson8b_odroidc.dtb"
fi
_bootd="$odir/boot/boot.ini"
else
_ul1="fatload mmc 0:1 0x21000000 uImage"
_ul2="fatload mmc 0:1 0x22000000 uInitrd"
_ul3="fatload mmc 0:1 0x21800000 meson8b_odroidc.dtb"
_bootd="$bootdir/boot.ini"
fi
echo "Creating \"boot.ini\""
cat > $_bootd << _EOF_
ODROIDC-UBOOT-CONFIG
# Possible screen resolutions
# Uncomment only a single Line! The line with setenv written.
# At least one mode must be selected.
# setenv m "vga" # 640x480
# setenv m "480p" # 720x480
# setenv m "576p" # 720x576
# setenv m "800x480p60hz" # 800x480
# setenv m "800x600p60hz" # 800x600
# setenv m "1024x600p60hz" # 1024x600
# setenv m "1024x768p60hz" # 1024x768
# setenv m "1360x768p60hz" # 1360x768
# setenv m "1366x768p60hz" # 1366x768
# setenv m "1440x900p60hz" # 1440x900
# setenv m "1600x900p60hz" # 1600x900
# setenv m "1680x1050p60hz" # 1680x1050
# setenv m "720p" # 720p 1280x720
# setenv m "800p" # 1280x800
# setenv m "sxga" # 1280x1024
setenv m "1080p" # 1080P 1920x1080
# setenv m "1920x1200" # 1920x1200
# HDMI DVI Mode Configuration
setenv vout_mode "hdmi"
# setenv vout_mode "dvi"
# HDMI BPP Mode
setenv m_bpp "32"
# setenv m_bpp "24"
# setenv m_bpp "16"
# UHS Card Configuration
# Uncomment the line below to __DISABLE__ UHS-1 MicroSD support
# This might break boot for some brand models of cards.
#setenv disableuhs "disableuhs"
# Disable VPU (Video decoding engine, Saves RAM!!!)
# 0 = disabled
# 1 = enabled
setenv vpu "1"
# Disable HDMI Output (Again, saves ram!)
# 0 = disabled
# 1 = enabled
setenv hdmioutput "1"
# Default Console Device Setting
# setenv condev "console=ttyS0,115200n8" # on serial port
# setenv condev "console=tty0" # on display (HDMI)
setenv condev "console=ttyS0,115200n8 console=tty0" # on both
# Set Linux partition UUID
setenv linuuid "$ext4uuid"
# Boot Arguments
setenv bootargs "root=UUID=\${linuuid} rootwait ro \${condev} no_console_suspend vdaccfg=0xa000 logo=osd1,loaded,0x7900000,720p,full dmfc=3 cvbsmode=576cvbs hdmimode=\${m} m_bpp=\${m_bpp} vout=\${vout_mode} \${disableuhs}"
# Booting
$_ul1
$_ul2
$_ul3
fdt addr 21800000
if test "\${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi
if test "\${hdmioutput}" = "0"; then fdt rm /mesonfb; fi
bootm 0x21000000 0x22000000 0x21800000
_EOF_
cp $_bootd ./$distro-boot.ini > /dev/null 2>&1
sync
# IF CREATING IMAGE unmount and create final image
if [ ! "${sdcard}" = "" ]; then
if [ ! "${_boot_on_ext4}" = "yes" ] ; then
if ! umount $bootdir; then
echo "ERROR unmounting fat partition."
exit 0
fi
rm -rf $bootdir/* > /dev/null 2>&1
rmdir $bootdir > /dev/null 2>&1
fi
if ! umount $odir; then
echo "ERROR unmounting ext4 partitions."
exit 0
fi
rm -rf $odir/* > /dev/null 2>&1
rmdir $odir > /dev/null 2>&1
sync
echo "Creating SDCard image..."
dd if=${sdcard}u of=${sdcard} > /dev/null 2>&1
if [ -f ${sdcard}1 ]; then
dd if=${sdcard}1 of=${sdcard} bs=1M conv=notrunc oflag=append > /dev/null 2>&1
fi
if [ -f ${sdcard}2 ]; then
dd if=${sdcard}2 of=${sdcard} bs=1M conv=notrunc oflag=append > /dev/null 2>&1
fi
if [ "${_compress}" = "yes" ]; then
echo "Compressing image..."
xz -z -k -9 -f -v $sdcard
md5sum $sdcard > $sdcard.md5sum
md5sum $sdcard.xz > $sdcard.xz.md5sum
fi
fi
if [ "${_directsd}" = "yes" ] ; then
if ! umount $odir; then
echo "ERROR unmounting ext4 partitions."
fi
fi
echo ""
date
echo ""
echo "************************************************************"
echo "Instalation finished."
echo ""
if [ ! "${sdcard}" = "" ]; then
echo "You have bootable Odroid-C1 SD Card image \"${sdcard}\"."
echo "Use dd to copy to your SDCard"
echo " e.g. sudo dd if=$sdcard of=/dev/<your_sdcard> bs=1M"
else
if [ "${_directsd}" = "yes" ] ; then
echo "You have Odroid-C1 $distro instalation on $image_name."
else
if [ ! "${_boot_on_ext4}" = "yes" ] ; then
echo "Copy files from $bootdir to SD Card boot partition"
echo " e.g. cp $bootdir/* <path_to_sdcard_boot_mount>"
echo " and rsync $odir to SD Card ext4 partition."
echo " e.g. sudo rsync -r -t -p -o -g -x -v --progress --delete -l -H -D --numeric-ids -s $PWD/$odir/ <path_to_sdcard_ext4_mount>/"
else
echo "Rsync files from $odir to SD Card ext4 partition"
echo " e.g. sudo rsync -r -t -p -o -g -x -v --progress --delete -l -H -D --numeric-ids -s $PWD/$odir/ <path_to_sdcard_ext4_mount>/"
fi
echo "UPDATE \"/etc/fstab\" AND \"boot.ini\" WITH SDCard PARTITIONS UUID's if necessary!"
echo ""
echo "Or create SDCard image running:"
echo " sudo ./image_from_dir $odir [yes|no]"
echo " yes|no - create or not ext4 only system"
fi
echo ""
echo "You can chroot into \"$odir\" to make additional changes:"
if [ "${_directsd}" = "yes" ] ; then
echo " mount $image_name $odir"
fi
echo " chroot $odir /usr/bin/qemu-arm-static -cpu cortex-a9 /bin/bash"
fi
echo ""
echo "************************************************************"
echo "* AFTER BOOTING: *"
echo "* -------------------------------------------------------- *"
echo "* To resize linux partition to fill sd card run: *"
echo "* sudo fs_resize *"
echo "* -------------------------------------------------------- *"
echo "* To install desktop run: *"
echo "* sudo install_desktop *"
echo "* or, for minimal lxde *"
echo "* sudo install_mini_desktop *"
echo "* DON'T FORGET TO RESIZE SD CARD IF NECESSARY *"
echo "* AND ENABLE VIDEO MEMORY IN \"boot.ini\" *"
echo "* -------------------------------------------------------- *"
echo "* To configure your local settings use: *"
echo "* sudo dpkg-reconfigure tzdata *"
echo "* sudo dpkg-reconfigure keyboard-configuration *"
echo "* sudo dpkg-reconfigure locales *"
echo "* sudo dpkg-reconfigure console-setup *"
echo "* #change your system's locale entries by modifying *"
echo "* #the file /etc/default/locale (e.g. en_US.UTF-8) *"
echo "* sudo locale-gen <your_locale> (e.g en_US.UTF-8) *"
echo "* sudo dpkg-reconfigure locales *"
echo "************************************************************"
echo ""
echo ""
exit 0