1 \ DebXO installer script
42 : has-target? ( devspec$ -- flag )
46 nr-targets 1+ to nr-targets
53 : disk-size ( devspec$ -- #MB )
54 open-dev ?dup 0<> if ( ih )
55 dup " #blocks" rot $call-method ( ih #blocks )
57 \ we're assuming a block size of 512 bytes
58 d# 512 um* ( ih #bytes )
59 d# 1,000,000 um/mod ( ih rem #MB )
60 rot close-dev swap drop ( #MB )
64 \ dup " block-size" rot $call-method ( ih size x )
65 \ rot close-dev drop ( size.lo )
73 \ : disk-size ( devspec$ -- #MB )
74 \ open-dev ?dup 0<> if ( ih )
75 \ dup " size" rot $call-method ( ih size.lo size.hi )
76 \ rot close-dev drop ( size.lo )
78 \ \ fuck your signed 32bit division.. d# 100000 / ( #MB ).
84 : debxo-find-targets ( -- help0$ 'func0 'icon0 ... helpk$ 'funck 'iconk )
87 \ check for the existence of nandflash (XO-1)
88 " /nandflash" has-target? if
90 ['] choose-nand-item spi.icon
92 \ check for internal EMMC (XO-1.5, XO-1.75)
93 " int:0" has-target? if
95 " int:0" disk-size decimal ( #MB )
96 <# " MB)" hold$ u#s " Internal MMC (" hold$ u#>
99 ['] choose-emmc-item spi.icon
103 " ext:0" has-target? if
105 " ext:0" disk-size decimal ( #MB )
106 <# " MB)" hold$ u#s " SD Card (" hold$ u#>
109 ['] choose-sd-item sdcard.icon
112 \ check for up to 4 USB drives
114 i <# " /disk" hold$ u# " /usb/scsi@" hold$ u#> string2 pack
118 64 alloc-mem >r ( i )
119 <# u# " USB Disk #" hold$ u#> r@ place
120 string2 count disk-size decimal ( #MB )
121 <# " MB)" hold$ u#s " (" hold$ u#> r@ $cat
124 i <# u# " ['] choose-usb-item-" hold$ u#> evaluate usb.icon
128 \ TODO: multiple usb disks?
129 \ differentiate between installer disk & extra disk..
133 : debxo-installer-menu ( -- )
134 \ populate stack w/ icon/target list
137 \ last entry on the list
138 " Abort installation"
139 ['] quit-item quit.icon
143 nr-targets 1+ to cols
153 ['] debxo-installer-menu to root-menu