3 # Copyright © 2010-2017
4 # Waldemar Brodkorb <wbx@openadk.org>
5 # Thorsten Glaser <tg@mirbsd.org>
7 # Provided that these terms and disclaimer and all copyright notices
8 # are retained or reproduced in an accompanying document, permission
9 # is granted to deal in this work without restriction, including un‐
10 # limited rights to use, publicly perform, distribute, sell, modify,
11 # merge, give away, or sublicence.
13 # This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
14 # the utmost extent permitted by applicable law, neither express nor
15 # implied; without malicious intent or gross negligence. In no event
16 # may a licensor, author or contributor be held liable for indirect,
17 # direct, other damage, loss, or other issues arising in any way out
18 # of dealing in the work, even if advised of the possibility of such
19 # damage or existence of a defect, except proven that it results out
20 # of said person’s immediate fault when using the work as intended.
22 # Alternatively, this work may be distributed under the terms of the
23 # General Public License, any version, as published by the Free Soft-
26 # Prepare a USB stick or CF/SD/MMC card or hard disc for installation
30 HOST
=$
(gcc
-dumpmachine)
34 (*:$ADK_TOPDIR/host_
$HOST/usr
/bin
:*) ;;
35 (*) export PATH
=$PATH:$ADK_TOPDIR/host_
$HOST/usr
/bin
;;
38 test -n "$KSH_VERSION" ||
exec mksh
"$me" "$@"
39 if test -z "$KSH_VERSION"; then
40 echo >&2 Fatal error
: could not run myself with mksh
!
44 ### run with mksh from here onwards ###
48 if (( USER_ID
)); then
49 print
-u2 Installation is only possible as root
!
53 ADK_TOPDIR
=$
(realpath .
)
69 Syntax: $me [-f filesystem] [-c cfgfssize] [-d datafssize] [-k] [-n] [-g]
70 [-p panictime] [±q] [-s serialspeed] [±t] <target> <device> <archive>
71 Partition sizes are in MiB. Filesystem type is currently ignored (ext4).
72 To keep filesystem on data partition use -k.
73 Use -n to not format boot/root partition.
74 Defaults: -c 1 -p 10 -s 115200; -t = enable serial console
79 while getopts "c:d:f:ghknp:qs:t" ch
; do
81 (c
) if (( (cfgfs
= OPTARG
) < 0 || cfgfs
> 16 )); then
82 print
-u2 "$me: -c $OPTARG out of bounds"
85 (d
) if (( (datafssz
= OPTARG
) < 0 )); then
86 print
-u2 "$me: -d $OPTARG out of bounds"
89 (f
) if [[ $OPTARG != @
(ext2|ext3|ext4|xfs
) ]]; then
90 print
-u2 "$me: filesystem $OPTARG invalid"
97 (p
) if (( (panicreboot
= OPTARG
) < 0 || panicreboot
> 300 )); then
98 print
-u2 "$me: -p $OPTARG out of bounds"
103 (s
) if [[ $OPTARG != @
(96|
192|
384|
576|
1152)00 ]]; then
104 print
-u2 "$me: serial speed $OPTARG invalid"
114 shift $
((OPTIND
- 1))
116 (( $# == 3 )) || usage
1
121 tools
="bc mkfs.ext4 mkfs.vfat tune2fs partprobe"
127 print
-u2 Sorry
, not ported to the OS
"'$ostype'" yet.
131 for tool
in $tools; do
132 print
-n Checking
if $tool is installed...
133 if whence
-p $tool >/dev
/null
; then
147 (banana-pro|orange-pi0|pcengines-apu|phytec-wega|raspberry-pi|raspberry-pi0|raspberry-pi2|raspberry-pi3|raspberry-pi3-64|solidrun-imx6|solidrun-clearfog|default
) ;;
149 print
-u2 "Unknown target '$target', exiting"
152 if [[ ! -b $tgt ]]; then
153 print
-u2 "'$tgt' is not a block device, exiting"
156 if [[ ! -f $src ]]; then
157 print
-u2 "'$src' is not a file, exiting"
160 (( quiet
)) || print
"Installing $src on $tgt."
164 R
=/Volumes
/ADKROOT
; diskutil unmount
$R
165 B
=/Volumes
/ADKBOOT
; diskutil unmount
$B
166 D
=/Volumes
/ADKDATA
; diskutil unmount
$D
168 rootpart
=${basedev}s1
169 datapart
=${basedev}s2
170 if [[ $target = raspberry-pi ||
$target = raspberry-pi0 ||
$target = raspberry-pi2 ||
$target = raspberry-pi3 ||
$target = raspberry-pi3-64 ||
$target = phytec-wega
]]; then
171 bootpart
=${basedev}s1
172 rootpart
=${basedev}s2
173 datapart
=${basedev}s3
175 match
=\'${basedev}\''?(s+([0-9]))'
179 (( quiet
)) || print
"Unmounting filesystem on ${1}..."
180 diskutil unmount
"$1"
183 (( quiet
)) || print
"Creating filesystem on ${2}..."
184 if [[ $3 = ext4
]]; then
187 if [[ $3 = vfat
]]; then
190 diskutil eraseVolume
$fstype "$2" "$1"
198 if [[ $basedev = /dev
/loop
* ]]; then
199 (( quiet
)) || print
"${tgt} is a loop device"
203 rootpart
=${basedev}${partitionsep}1
204 datapart
=${basedev}${partitionsep}2
205 if [[ $target = raspberry-pi ||
$target = raspberry-pi0 ||
$target = raspberry-pi2 ||
$target = raspberry-pi3 ||
$target = raspberry-pi3-64
]]; then
206 bootpart
=${basedev}${partitionsep}1
207 rootpart
=${basedev}${partitionsep}2
208 datapart
=${basedev}${partitionsep}3
211 match
=\'${basedev}${partitionsep}\''+([0-9])'
213 (( quiet
)) || print
"Mounting filesystem on ${1}..."
214 mount
-t "$3" "$1" "$2"
217 (( quiet
)) || print
"Unmounting filesystem on ${1}..."
221 (( quiet
)) || print
"Creating filesystem on ${1}..."
225 tune2fs
-c 0 -i 0 "$1"
231 while read -p dev rest
; do
232 eval [[ \
$dev = $match ]] ||
continue
233 print
-u2 "Block device $tgt is in use, please umount first."
237 if (( !quiet
)); then
238 print
"WARNING: This will overwrite $basedev - type Yes to continue!"
240 [[ $x = Yes
]] ||
exit 0
243 if ! T
=$
(mktemp
-d /tmp
/openadk.XXXXXXXXXX
); then
244 print
-u2 Error creating temporary directory.
247 if [[ $ostype != Darwin
]]; then
251 mkdir
-p "$R" "$B" "$D"
255 dksz
=$
(dkgetsz
"$tgt")
258 # n̲a̲m̲e̲ p̲a̲r̲t̲#̲0̲ p̲̲a̲r̲t̲#̲1̲ p̲̲a̲r̲t̲#̲2̲ p̲̲a̲r̲t̲#̲3̲
259 # default: 0x83(system) 0x83(?data) -(unused) 0x88(cfgfs)
260 # raspberry: 0x0B(boot) 0x83(system) 0x83(?data) 0x88(cfgfs)
265 # boot(raspberry) - fixed (100 MiB)
266 # cfgfs - fixed (parameter, max. 16 MiB)
267 # data - flexible (parameter)
268 # system - everything else
270 if [[ $target = raspberry-pi ||
$target = raspberry-pi0 ||
$target = raspberry-pi2 ||
$target = raspberry-pi3 ||
$target = raspberry-pi3-64 ||
$target = phytec-wega
]]; then
274 print
-u2 "Cannot combine GRUB with $target"
284 (( cyls
= dksz
/ heads
/ secs
))
285 if (( cyls
< (bootfssz
+ cfgfs
+ datafssz
+ 2) )); then
286 print
-u2 "Size of $tgt is $dksz, this looks fishy?"
291 if stat
-qs .
>/dev
/null
2>&1; then
292 statcmd
='stat -f %z' # BSD stat (or so we assume)
294 statcmd
='stat -c %s' # GNU stat
298 tar -xOf "$src" boot
/grub
/core.img
>"$T/core.img"
299 integer coreimgsz
=$
($statcmd "$T/core.img")
303 if (( coreimgsz
< 1024 )); then
304 print
-u2 core.img is probably too small
: $coreimgsz
308 if (( coreimgsz
> 65024 )); then
309 print
-u2 core.img is larger than
64K-512
: $coreimgsz
313 (( coreendsec
= (coreimgsz
+ 511) / 512 ))
314 if [[ $basedev = /dev
/svnd
+([0-9]) ]]; then
315 # BSD svnd0 mode: protect sector #1
318 corepatchofs
=$
((0x614))
321 corepatchofs
=$
((0x414))
323 # partition offset: at least coreendsec+1 but aligned on a multiple of secs
324 #(( partofs = ((coreendsec / secs) + 1) * secs ))
325 # we just use 2048 all the time, since some loaders are longer
327 if [[ $target = raspberry-pi ||
$target = raspberry-pi0 ||
$target = raspberry-pi2 ||
$target = raspberry-pi3 ||
$target = raspberry-pi3-64 ||
$target = phytec-wega
]]; then
328 (( spartofs
= partofs
+ (100 * 2048) ))
333 (( quiet
)) ||
if (( grub
)); then
334 print Preparing MBR and GRUB2...
336 print Preparing MBR...
338 dd if=/dev
/zero of
="$T/firsttrack" count
=$partofs 2>/dev
/null
339 # add another MiB to clear the first partition
340 dd if=/dev
/zero bs
=1048576 count
=1 >>"$T/firsttrack" 2>/dev
/null
341 echo $corestartsec $coreendsec | mksh
"$ADK_TOPDIR/scripts/bootgrub.mksh" \
342 -A -g $
((cyls
- bootfssz
- cfgfs
- datafssz
)):$heads:$secs -M 1:0x83 \
343 -O $spartofs |
dd of
="$T/firsttrack" conv
=notrunc
2>/dev
/null
344 (( grub
)) && dd if="$T/core.img" of
="$T/firsttrack" conv
=notrunc \
345 seek
=$corestartsec 2>/dev
/null
346 # set partition where it can find /boot/grub
347 (( grub
)) && print
-n '\0\0\0\0' | \
348 dd of
="$T/firsttrack" conv
=notrunc bs
=1 seek
=$corepatchofs 2>/dev
/null
350 # create cfgfs partition (mostly taken from bootgrub.mksh)
352 typeset
-Uui8 thecode
354 set -A g_code
$cyls $heads $secs
355 (( psz
= g_code
[0] * g_code
[1] * g_code
[2] ))
356 (( pofs
= (cyls
- cfgfs
) * g_code
[1] * g_code
[2] ))
357 set -A o_code
# g_code equivalent for partition offset
358 (( o_code
[2] = pofs
% g_code
[2] + 1 ))
359 (( o_code
[1] = pofs
/ g_code
[2] ))
360 (( o_code
[0] = o_code
[1] / g_code
[1] + 1 ))
361 (( o_code
[1] = o_code
[1] % g_code
[1] + 1 ))
362 # boot flag; C/H/S offset
363 thecode
[mbrpno
++]=0x00
364 (( thecode
[mbrpno
++] = o_code
[1] - 1 ))
365 (( cylno
= o_code
[0] > 1024 ?
1023 : o_code
[0] - 1 ))
366 (( thecode
[mbrpno
++] = o_code
[2] |
((cylno
& 0x0300) >> 2) ))
367 (( thecode
[mbrpno
++] = cylno
& 0x00FF ))
368 # partition type; C/H/S end
369 (( thecode
[mbrpno
++] = 0x88 ))
370 (( thecode
[mbrpno
++] = g_code
[1] - 1 ))
371 (( cylno
= g_code
[0] > 1024 ?
1023 : g_code
[0] - 1 ))
372 (( thecode
[mbrpno
++] = g_code
[2] |
((cylno
& 0x0300) >> 2) ))
373 (( thecode
[mbrpno
++] = cylno
& 0x00FF ))
374 # partition offset, size (LBA)
375 (( thecode
[mbrpno
++] = pofs
& 0xFF ))
376 (( thecode
[mbrpno
++] = (pofs
>> 8) & 0xFF ))
377 (( thecode
[mbrpno
++] = (pofs
>> 16) & 0xFF ))
378 (( thecode
[mbrpno
++] = (pofs
>> 24) & 0xFF ))
379 (( pssz
= psz
- pofs
))
380 (( thecode
[mbrpno
++] = pssz
& 0xFF ))
381 (( thecode
[mbrpno
++] = (pssz
>> 8) & 0xFF ))
382 (( thecode
[mbrpno
++] = (pssz
>> 16) & 0xFF ))
383 (( thecode
[mbrpno
++] = (pssz
>> 24) & 0xFF ))
384 # write partition table entry
387 while (( curptr
< 16 )); do
388 ostr
=$ostr\\0${thecode[curptr++]#8#}
391 dd of
="$T/firsttrack" conv
=notrunc bs
=1 seek
=$
((0x1EE)) 2>/dev
/null
393 if (( datafssz
)); then
394 # create data partition (copy of the above :)
396 typeset
-Uui8 thecode
398 set -A g_code
$cyls $heads $secs
399 (( psz
= (cyls
- cfgfs
) * g_code
[1] * g_code
[2] ))
400 (( pofs
= (cyls
- cfgfs
- datafssz
) * g_code
[1] * g_code
[2] ))
401 set -A o_code
# g_code equivalent for partition offset
402 (( o_code
[2] = pofs
% g_code
[2] + 1 ))
403 (( o_code
[1] = pofs
/ g_code
[2] ))
404 (( o_code
[0] = o_code
[1] / g_code
[1] + 1 ))
405 (( o_code
[1] = o_code
[1] % g_code
[1] + 1 ))
406 # boot flag; C/H/S offset
407 thecode
[mbrpno
++]=0x00
408 (( thecode
[mbrpno
++] = o_code
[1] - 1 ))
409 (( cylno
= o_code
[0] > 1024 ?
1023 : o_code
[0] - 1 ))
410 (( thecode
[mbrpno
++] = o_code
[2] |
((cylno
& 0x0300) >> 2) ))
411 (( thecode
[mbrpno
++] = cylno
& 0x00FF ))
412 # partition type; C/H/S end
413 (( thecode
[mbrpno
++] = 0x83 ))
414 (( thecode
[mbrpno
++] = g_code
[1] - 1 ))
415 (( cylno
= (g_code
[0] - cfgfs
) > 1024 ?
1023 : g_code
[0] - cfgfs
- 1 ))
416 (( thecode
[mbrpno
++] = g_code
[2] |
((cylno
& 0x0300) >> 2) ))
417 (( thecode
[mbrpno
++] = cylno
& 0x00FF ))
418 # partition offset, size (LBA)
419 (( thecode
[mbrpno
++] = pofs
& 0xFF ))
420 (( thecode
[mbrpno
++] = (pofs
>> 8) & 0xFF ))
421 (( thecode
[mbrpno
++] = (pofs
>> 16) & 0xFF ))
422 (( thecode
[mbrpno
++] = (pofs
>> 24) & 0xFF ))
423 (( pssz
= psz
- pofs
))
424 (( thecode
[mbrpno
++] = pssz
& 0xFF ))
425 (( thecode
[mbrpno
++] = (pssz
>> 8) & 0xFF ))
426 (( thecode
[mbrpno
++] = (pssz
>> 16) & 0xFF ))
427 (( thecode
[mbrpno
++] = (pssz
>> 24) & 0xFF ))
428 # write partition table entry
431 while (( curptr
< 16 )); do
432 ostr
=$ostr\\0${thecode[curptr++]#8#}
435 dd of
="$T/firsttrack" conv
=notrunc bs
=1 seek
=$
((0x1CE)) 2>/dev
/null
438 if [[ $target = raspberry-pi ||
$target = raspberry-pi0 ||
$target = raspberry-pi2 ||
$target = raspberry-pi3 ||
$target = raspberry-pi3-64 ||
$target = phytec-wega
]]; then
439 # move system and data partition from #0/#1 to #1/#2
440 dd if="$T/firsttrack" bs
=1 skip
=$
((0x1BE)) count
=32 of
="$T/x" 2>/dev
/null
441 dd of
="$T/firsttrack" conv
=notrunc bs
=1 seek
=$
((0x1CE)) if="$T/x" 2>/dev
/null
442 # create boot partition (copy of the above :)
444 typeset
-Uui8 thecode
446 set -A g_code
$cyls $heads $secs
449 set -A o_code
# g_code equivalent for partition offset
450 (( o_code
[2] = pofs
% g_code
[2] + 1 ))
451 (( o_code
[1] = pofs
/ g_code
[2] ))
452 (( o_code
[0] = o_code
[1] / g_code
[1] + 1 ))
453 (( o_code
[1] = o_code
[1] % g_code
[1] + 1 ))
454 # boot flag; C/H/S offset
455 thecode
[mbrpno
++]=0x00
456 (( thecode
[mbrpno
++] = o_code
[1] - 1 ))
457 (( cylno
= o_code
[0] > 1024 ?
1023 : o_code
[0] - 1 ))
458 (( thecode
[mbrpno
++] = o_code
[2] |
((cylno
& 0x0300) >> 2) ))
459 (( thecode
[mbrpno
++] = cylno
& 0x00FF ))
460 # partition type; C/H/S end
461 (( thecode
[mbrpno
++] = 0x0B ))
462 (( thecode
[mbrpno
++] = g_code
[1] - 1 ))
463 (( cylno
= (spartofs
/ 2048) > 1024 ?
1023 : (spartofs
/ 2048) - 1 ))
464 (( thecode
[mbrpno
++] = g_code
[2] |
((cylno
& 0x0300) >> 2) ))
465 (( thecode
[mbrpno
++] = cylno
& 0x00FF ))
466 # partition offset, size (LBA)
467 (( thecode
[mbrpno
++] = pofs
& 0xFF ))
468 (( thecode
[mbrpno
++] = (pofs
>> 8) & 0xFF ))
469 (( thecode
[mbrpno
++] = (pofs
>> 16) & 0xFF ))
470 (( thecode
[mbrpno
++] = (pofs
>> 24) & 0xFF ))
471 (( pssz
= psz
- pofs
))
472 (( thecode
[mbrpno
++] = pssz
& 0xFF ))
473 (( thecode
[mbrpno
++] = (pssz
>> 8) & 0xFF ))
474 (( thecode
[mbrpno
++] = (pssz
>> 16) & 0xFF ))
475 (( thecode
[mbrpno
++] = (pssz
>> 24) & 0xFF ))
476 # write partition table entry
479 while (( curptr
< 16 )); do
480 ostr
=$ostr\\0${thecode[curptr++]#8#}
483 dd of
="$T/firsttrack" conv
=notrunc bs
=1 seek
=$
((0x1BE)) 2>/dev
/null
488 [[ -c /dev
/arandom
]] && rnddev
=/dev
/arandom
489 dd if=$rnddev bs
=4 count
=1 2>/dev
/null | \
490 dd of
="$T/firsttrack" conv
=notrunc bs
=1 seek
=$
((0x1B8)) 2>/dev
/null
492 dd of
="$T/firsttrack" conv
=notrunc bs
=1 seek
=$
((0x1BC)) 2>/dev
/null
493 partuuid
=$
(dd if="$T/firsttrack" bs
=1 count
=4 skip
=$
((0x1B8)) 2>/dev
/null | \
494 hexdump -e '1/4 "%08x"')-0$
((syspartno
+1))
496 ((keep
)) ||
if (( datafssz
)); then
497 (( quiet
)) || print Cleaning out data partition...
498 dd if=/dev
/zero of
="$tgt" bs
=1048576 count
=1 seek
=$
((cyls
- cfgfs
- datafssz
)) > /dev
/null
2>&1
500 (( quiet
)) || print Cleaning out root partition...
501 dd if=/dev
/zero bs
=1048576 of
="$tgt" count
=1 seek
=$
((spartofs
/ 2048)) > /dev
/null
2>&1
503 (( quiet
)) ||
if (( grub
)); then
504 print Writing MBR and GRUB2 to target device... system PARTUUID
=$partuuid
506 print Writing MBR to target device... system PARTUUID
=$partuuid
508 dd if="$T/firsttrack" of
="$tgt" > /dev
/null
2>&1
510 if [[ $ostype = Linux
]]; then
518 fwdir
=$
(dirname "$src")
521 (banana-pro|orange-pi0
)
522 dd if="$fwdir/u-boot-sunxi-with-spl.bin" of
="$tgt" bs
=1024 seek
=8 > /dev
/null
2>&1
525 dd if="$fwdir/u-boot-spl.kwb" of
="$tgt" bs
=512 seek
=1 > /dev
/null
2>&1
528 dd if="$fwdir/SPL" of
="$tgt" bs
=1024 seek
=1 > /dev
/null
2>&1
529 dd if="$fwdir/u-boot.img" of
="$tgt" bs
=1024 seek
=69 > /dev
/null
2>&1
531 (raspberry-pi|raspberry-pi0|raspberry-pi2|raspberry-pi3|raspberry-pi3-64
)
532 (( noformat
)) || create_fs
"$bootpart" ADKBOOT vfat
535 (( noformat
)) || create_fs
"$bootpart" ADKBOOT ext4
539 (( noformat
)) || create_fs
"$rootpart" ADKROOT ext4
540 (( noformat
)) || tune_fs
"$rootpart"
542 (( quiet
)) || print Extracting installation archive...
543 mount_fs
"$rootpart" "$R" ext4
544 xz
-dc "$src" |
(cd "$R"; tar -xpf -)
546 if (( datafssz
)); then
547 mkdir
-m0755 "$R"/data
548 ((keep
)) || create_fs
"$datapart" ADKDATA ext4
549 ((keep
)) || tune_fs
"$datapart"
551 (raspberry-pi|raspberry-pi0|raspberry-pi2|raspberry-pi3|raspberry-pi3-64|phytec-wega
)
552 echo "/dev/mmcblk0p3 /data ext4 rw 0 0" >> "$R"/etc
/fstab
554 (banana-pro|orange-pi0|solidrun-imx6|solidrun-clearfog
)
555 echo "/dev/mmcblk0p2 /data ext4 rw 0 0" >> "$R"/etc
/fstab
560 (( quiet
)) || print Finishing up with bootloader and kernel ...
562 (raspberry-pi|raspberry-pi0|raspberry-pi2|raspberry-pi3|raspberry-pi3-64
)
563 mount_fs
"$bootpart" "$B" vfat
564 for x
in "$R"/boot
/*; do
565 [[ -e "$x" ]] && mv -f "$R"/boot
/* "$B/"
568 for x
in "$fwdir"/*.dtb
; do
569 [[ -e "$x" ]] && cp "$fwdir"/*.dtb
"$B/"
572 # use static dtoverlay, rename to *.dtb
574 for x
in "$fwdir"/overlays
/*.dtbo
; do
575 y
=$
(basename ${x} .dtbo
)
576 [[ -e "$x" ]] && cp "$fwdir"/overlays
/${y}.dtbo
"$B/"overlays
/${y}.dtb
581 mount_fs
"$bootpart" "$B" ext4
582 for x
in "$R"/boot
/*; do
583 [[ -e "$x" ]] && mv -f "$R"/boot
/* "$B/"
586 for x
in "$fwdir"/*.dtb
; do
587 [[ -e "$x" ]] && cp "$fwdir"/*.dtb
"$B/"
593 for x
in "$fwdir"/*.dtb
; do
594 [[ -e "$x" ]] && cp "$fwdir"/*.dtb
"$R/boot/"
597 mkimage
-A arm
-O linux
-T script -C none
-a 0 -e 0 \
598 -n "SolidrunClearfog" \
599 -d $fwdir/boot.
script.clearfog
$R/boot
/boot.scr.uimg
602 for x
in "$fwdir"/*.dtb
; do
603 [[ -e "$x" ]] && cp "$fwdir"/*.dtb
"$R/boot/"
606 mkimage
-A arm
-O linux
-T script -C none
-a 0 -e 0 \
608 -d $fwdir/boot.
script.imx6
$R/boot
/boot.scr.uimg
611 for x
in "$fwdir"/*.dtb
; do
612 [[ -e "$x" ]] && cp "$fwdir"/*.dtb
"$R/boot/"
615 mkimage
-A arm
-O linux
-T script -C none
-a 0 -e 0 \
617 -d $fwdir/boot.
script.opi
$R/boot
/boot.scr.uimg
620 for x
in "$fwdir"/*.dtb
; do
621 [[ -e "$x" ]] && cp "$fwdir"/*.dtb
"$R/boot/"
624 mkimage
-A arm
-O linux
-T script -C none
-a 0 -e 0 \
626 -d $fwdir/boot.
script.bpi
$R/boot
/boot.scr.uimg
631 dd if=$rnddev bs
=16 count
=1 >>etc
/.rnd
2>/dev
/null
632 (( quiet
)) || print Fixing up permissions...
635 [[ -f usr
/bin
/sudo
]] && chmod 4755 usr
/bin
/sudo
638 (( quiet
)) || print Configuring GRUB2 bootloader...
643 if (( serial
)); then
644 print serial
--unit=0 --speed=$speed
645 print terminal_output serial
646 print terminal_input serial
647 consargs
="console=ttyS0,$speed console=tty0"
649 print terminal_output console
650 print terminal_input console
651 consargs
="console=tty0"
654 print
'menuentry "GNU/Linux (OpenADK)" {'
655 linuxargs
="root=PARTUUID=$partuuid $consargs"
656 (( panicreboot
)) && linuxargs
="$linuxargs panic=$panicreboot"
657 print
"\tlinux /boot/kernel $linuxargs"
659 ) >boot
/grub
/grub.cfg
662 (( quiet
)) || print Finishing up...
665 if (( datafssz
)); then