📄 elix.tcl
字号:
::grid ${m}.modules -sticky nsew -padx 4 -pady 4 -columnspan 3 ::grid rowconfigure ${m} 0 -weight 0 ::grid rowconfigure ${m} 1 -weight 1 ::grid columnconfigure ${m} 0 -weight 1 ::grid columnconfigure ${m} 1 -weight 1 ::grid columnconfigure ${m} 2 -weight 1 pack ${child}.args -side top -fill x -anchor w -padx 4 -pady 4 pack ${child}.sources -side top -fill x -anchor w -padx 4 -pady 4 pack ${child}.modules -side top -fill x -anchor w -padx 4 -pady 4 } method AddTarget {nb page} { global sn_options elix_options # Ugly, but S-N standard. set xstep 30 set page [${nb} subwidget ${page}] set frame [tixLabelFrame ${page}.frame -label [get_indep String\ ElixTarget] -background $sn_options(def,layout-bg)] set child [${frame} subwidget frame] pack ${frame} -side top -fill x Entry& ${child}.hostname -label [get_indep String ElixTargetHostname]\ -labelwidth ${xstep} -textvariable elix_options(target-hostname) LabelEntryButton& ${child}.bootimage -labelwidth ${xstep}\ -text [get_indep String ElixFilesysBootimage]\ -variable elix_options(file-boot-image) tixLabelFrame ${child}.ip -label [get_indep String ElixTargetIP]\ -background $sn_options(def,layout-bg) set ip [${child}.ip subwidget frame] set frames [list ${ip}.static] # -padx value here comes from radioframe + its own # padding. radiobutton ${ip}.kernel -text [get_indep String ElixTargetKernel]\ -variable elix_options(target-ip-sel) -value kernel -padx 10\ -command [list ${this} radio_update {} ${frames}] radiobutton ${ip}.dhcp -text [get_indep String ElixTargetDHCP]\ -variable elix_options(target-ip-sel) -value dhcp -padx 10\ -command [list ${this} radio_update {} ${frames}] set s [radioframe ${ip}.static -text [get_indep String\ ElixTargetStatic] -variable elix_options(target-ip-sel)\ -value static -command [list ${this} radio_update ${ip}.static\ ${frames}]] Entry& ${s}.ip -label [get_indep String ElixTargetStaticIP]\ -labelwidth ${xstep} -textvariable elix_options(target-ip) Entry& ${s}.mask -label [get_indep String ElixTargetStaticMask]\ -labelwidth ${xstep} -textvariable elix_options(target-mask) Entry& ${s}.broad -labelwidth ${xstep} -label [get_indep String\ ElixTargetStaticBroadcast]\ -textvariable elix_options(target-broadcast) Entry& ${s}.gateway -labelwidth ${xstep} -label [get_indep String\ ElixTargetStaticGateway] -textvariable elix_options(target-gateway) pack ${s}.ip ${s}.mask ${s}.broad ${s}.gateway -side top -anchor w\ -fill x -padx 4 -pady 4 pack ${ip}.kernel ${ip}.dhcp -side top -anchor w -padx 4 -pady 4 pack ${ip}.static -fill x -side top -anchor w -padx 4 -pady 4 pack ${child}.hostname ${child}.bootimage ${child}.ip -fill x\ -side top -anchor w -padx 4 -pady 4 # FIXME: mount points here switch -- $elix_options(target-ip-sel) { kernel - dhcp { radio_update {} ${frames} } static { radio_update ${ip}.static ${frames} } } } method AddMount {nb page} { global sn_options elix_options set page [${nb} subwidget ${page}] set frame [tixLabelFrame ${page}.frame -label [get_indep String\ ElixMounts] -background $sn_options(def,layout-bg)] set child [${frame} subwidget frame] pack ${frame} -side top -fill x # FIXME: don't hard-code text here. message ${child}.message -aspect 1000 -text "Enter one mount entry per\ line. Each entry consists of three whitespace-separated fields:\ device, mount point, and filesystem type" set mount_widget [text ${child}.modules] ${mount_widget} insert end [join $elix_options(mount-points) \n] pack ${child}.message ${mount_widget} -side top -fill x -padx 4 -pady 4 } # Set EL/IX defaults in project database. proc set_defaults {} { paf_db_proj put elix-dbg-interface ethernet paf_db_proj put elix-dbg-portnumber 9999 paf_db_proj put elix-dbg-targettty /dev/ttyS0 paf_db_proj put elix-dbg-hosttty /dev/ttyS0 paf_db_proj put elix-dbg-speed 9600 paf_db_proj put elix-kernel-args "" paf_db_proj put elix-kernel-sources "" paf_db_proj put elix-file-system romfs paf_db_proj put elix-file-minix-path "" paf_db_proj put elix-file-nfs-path "" paf_db_proj put elix-file-rom-path "" paf_db_proj put elix-file-boot-image "" paf_db_proj put elix-kernel-modules all paf_db_proj put elix-kernel-module-list "" paf_db_proj put elix-target-hostname "" paf_db_proj put elix-target-ip-sel kernel paf_db_proj put elix-target-ip "" paf_db_proj put elix-target-mask "" paf_db_proj put elix-target-broadcast "" paf_db_proj put elix-target-gateway "" paf_db_proj put elix-kernel-module-list "" paf_db_proj put elix-file-minix-choice relative paf_db_proj put elix-file-minix-blocks "" paf_db_proj put elix-file-minix-inodes "" paf_db_proj put elix-file-minix-extra 10 paf_db_proj put elix-mount-points "" } # Return list of key names. proc keys {} { return {dbg-interface dbg-portnumber dbg-targettty dbg-hosttty\ dbg-speed kernel-args kernel-sources file-system file-boot-image\ file-nfs-path file-minix-path file-rom-path kernel-modules\ kernel-module-list target-hostname target-ip-sel target-ip\ target-mask target-broadcast target-gateway file-minix-choice\ file-minix-blocks file-minix-inodes file-minix-extra mount-points} } # Fill an array with info we care about from the database. proc fill {an} { upvar ${an} vals foreach item [keys] { set vals(${item}) [paf_db_proj get -key elix-${item}] } } # Return path to EL/IX sources. proc source_path {} { # FIXME: is this right? global sn_home return [file join ${sn_home} share elix] } # Create the config.pl command line. proc make_config_command {arch builddir} { global sn_options sn_path fill options # FIXME: probably don't need path here. set command [list [file join $sn_path(bindir) config.pl]] lappend command --arch=${arch} lappend command --elix-cfg=${builddir}.elix lappend command --elix-path=[source_path] lappend command --boot-image=$options(file-boot-image) if {$options(file-system) == "nfs"} { lappend command --nfsroot=$options(file-nfs-path) } else { set ram --ramdisk if {$options(file-system) == "minix"} { append ram :template=$options(file-minix-path) append ram :type=minix if {$options(file-minix-choice) == "relative"} { append ram :extra=$options(file-minix-extra) } else { append ram :blocks=$options(file-minix-blocks) append ram :inodes=$options(file-minix-inodes) } } else { append ram :template=$options(file-rom-path) append ram :type=romfs } lappend command ${ram} } # Debug page. set debug --debug append debug :$options(dbg-interface) append debug :gdbinit=${builddir}.sngdb if {$options(dbg-interface) == "serial"} { append debug :target=$options(dbg-targettty) append debug :host=$options(dbg-hosttty) append debug :baud=$options(dbg-speed) } else { append debug :port=$options(dbg-portnumber) } lappend command ${debug} # Kernel page set kernel --kernel append kernel :path=$options(kernel-sources) if {$options(kernel-modules) != "monolithic"} { if {$options(kernel-modules) == "all"} { append kernel :all-modules } foreach m $options(kernel-module-list) { if {${m} != ""} { append kernel :module=${m} } } } lappend command ${kernel} lappend command --kernel-args=$options(kernel-args) set target --net switch -- $options(target-ip-sel) { kernel { append target :kernel } dhcp { append target :dhcp } static { append target :ip=$options(target-ip) append target :mask=$options(target-mask) append target :broadcast=$options(target-broadcast) append target :gateway=$options(target-gateway) } } append target :hostname=$options(target-hostname) lappend command ${target} # Mount points page. set mount --mount foreach line $options(mount-points) { set line [string trim ${line}] if {${line} == ""} { continue } regsub -all -- "\[ \t\]+" ${line} " " line set split [split ${line}] # Supply trailing arguments if not provided by # user. if {[llength ${split}] < 4} { lappend split MS_MGC_VAL } if {[llength ${split}] < 5} { lappend split NULL } append mount :mp=[join ${split} ,] } if {${mount} != "--mount"} { lappend command ${mount} } return [join ${command} " "] } method exitPreferences {} { # FIXME: set wait var, etc. itcl::delete object ${this} } method apply {{terminate 1}} { # FIXME: verify options. global elix_options if {${module_widget} != ""} { set elix_options(kernel-module-list) [split\ [${module_widget} get 1.0 end] \n] } if {${mount_widget} != ""} { set elix_options(mount-points) [split [${mount_widget} get 1.0\ end] \n] } foreach item [keys] { paf_db_proj put elix-${item} $elix_options(${item}) } paf_db_proj sync if {${terminate}} { exitPreferences } } method save_cb {} { apply 0 save_default_settings } # List of all tty devices we support. protected ttys # Name of text widget holding list of selected modules. protected module_widget "" # Name of text widget holding mount point information. protected mount_widget ""}proc sn_elix_preferences {} { set p .proj-elix if {! [winfo exists ${p}]} { Elix& ${p} } else { ${p} raise }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -