mirror of
https://github.com/CCLeonOS/LeonOS.git
synced 2026-03-03 15:17:01 +00:00
feat: 更新 LeonOS 版本至 0.1.2 并优化启动流程
- 更新 installer.lua 和 bios.lua 中的版本号至 0.1.2 - 修改 shell 界面标题为 "LeonOS Shell" - 在 bios.lua 中添加启动步骤的打印信息,便于调试 - 调整 shell.lua 中控制台清理逻辑的位置
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
_G._HOST = _G._HOST .. " (LeonOS 0.1.1)"
|
_G._HOST = _G._HOST .. " (LeonOS 0.1.2)"
|
||||||
|
print("LeonBIOS")
|
||||||
|
print("Starting...")
|
||||||
local fs = rawget(_G, "fs")
|
local fs = rawget(_G, "fs")
|
||||||
|
|
||||||
_G._RC_ROM_DIR = _RC_ROM_DIR or (...) and fs.exists("/rc") and "/rc" or "/rom"
|
_G._RC_ROM_DIR = _RC_ROM_DIR or (...) and fs.exists("/rc") and "/rc" or "/rom"
|
||||||
@@ -16,13 +17,13 @@ if fs.exists("/.start_rc.lua") and not (...) then
|
|||||||
_sd()
|
_sd()
|
||||||
while true do coroutine.yield() end
|
while true do coroutine.yield() end
|
||||||
end
|
end
|
||||||
|
print("[OK] Boot step 1")
|
||||||
local function pull(tab, key)
|
local function pull(tab, key)
|
||||||
local func = tab[key]
|
local func = tab[key]
|
||||||
tab[key] = nil
|
tab[key] = nil
|
||||||
return func
|
return func
|
||||||
end
|
end
|
||||||
|
print("[OK] Boot step 2")
|
||||||
-- this is overwritten further down but `load` needs it
|
-- this is overwritten further down but `load` needs it
|
||||||
local expect = function(_, _, _, _) end
|
local expect = function(_, _, _, _) end
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ local rc = {
|
|||||||
_VERSION = {
|
_VERSION = {
|
||||||
major = 0,
|
major = 0,
|
||||||
minor = 1,
|
minor = 1,
|
||||||
patch = 1
|
patch = 2
|
||||||
},
|
},
|
||||||
queueEvent = pull(os, "queueEvent"),
|
queueEvent = pull(os, "queueEvent"),
|
||||||
startTimer = pull(os, "startTimer"),
|
startTimer = pull(os, "startTimer"),
|
||||||
@@ -53,7 +54,7 @@ local rc = {
|
|||||||
|
|
||||||
-- and a few more
|
-- and a few more
|
||||||
rc.pushEvent = rc.queueEvent
|
rc.pushEvent = rc.queueEvent
|
||||||
|
print("[OK] Boot step 3")
|
||||||
function rc.shutdown()
|
function rc.shutdown()
|
||||||
shutdown()
|
shutdown()
|
||||||
while true do coroutine.yield() end
|
while true do coroutine.yield() end
|
||||||
@@ -63,7 +64,7 @@ function rc.reboot()
|
|||||||
reboot()
|
reboot()
|
||||||
while true do coroutine.yield() end
|
while true do coroutine.yield() end
|
||||||
end
|
end
|
||||||
|
print("[OK] Boot step 4")
|
||||||
local timer_filter = {}
|
local timer_filter = {}
|
||||||
function rc.pullEventRaw(filter)
|
function rc.pullEventRaw(filter)
|
||||||
expect(1, filter, "string", "nil")
|
expect(1, filter, "string", "nil")
|
||||||
@@ -93,7 +94,7 @@ function rc.pullEvent(filter)
|
|||||||
|
|
||||||
return table.unpack(sig, 1, sig.n)
|
return table.unpack(sig, 1, sig.n)
|
||||||
end
|
end
|
||||||
|
print("[OK] Boot step 5")
|
||||||
function rc.sleep(time, no_term)
|
function rc.sleep(time, no_term)
|
||||||
local id = rc.startTimer(time)
|
local id = rc.startTimer(time)
|
||||||
local thread = require("rc.thread").id()
|
local thread = require("rc.thread").id()
|
||||||
@@ -103,12 +104,12 @@ function rc.sleep(time, no_term)
|
|||||||
local _, tid = (no_term and rc.pullEventRaw or rc.pullEvent)("timer")
|
local _, tid = (no_term and rc.pullEventRaw or rc.pullEvent)("timer")
|
||||||
until tid == id
|
until tid == id
|
||||||
end
|
end
|
||||||
|
print("[OK] Boot step 6")
|
||||||
function rc.version()
|
function rc.version()
|
||||||
return string.format("LeonOS %d.%d.%d",
|
return string.format("LeonOS %d.%d.%d",
|
||||||
rc._VERSION.major, rc._VERSION.minor, rc._VERSION.patch)
|
rc._VERSION.major, rc._VERSION.minor, rc._VERSION.patch)
|
||||||
end
|
end
|
||||||
|
print("[OK] Boot step 7")
|
||||||
-- Lua 5.1? meh
|
-- Lua 5.1? meh
|
||||||
if _VERSION == "Lua 5.1" then
|
if _VERSION == "Lua 5.1" then
|
||||||
local old_load = load
|
local old_load = load
|
||||||
@@ -156,7 +157,7 @@ if _VERSION == "Lua 5.1" then
|
|||||||
end, func)
|
end, func)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
print("[OK] Boot step 8")
|
||||||
local startup = _RC_ROM_DIR .. "/startup"
|
local startup = _RC_ROM_DIR .. "/startup"
|
||||||
local files = fs.list(startup)
|
local files = fs.list(startup)
|
||||||
table.sort(files)
|
table.sort(files)
|
||||||
@@ -181,9 +182,9 @@ for i=1, #files, 1 do
|
|||||||
local file = startup .. "/" .. files[i]
|
local file = startup .. "/" .. files[i]
|
||||||
assert(loadfile(file))(rc)
|
assert(loadfile(file))(rc)
|
||||||
end
|
end
|
||||||
|
print("[OK] Boot step 9")
|
||||||
expect = require("cc.expect").expect
|
expect = require("cc.expect").expect
|
||||||
|
|
||||||
local thread = require("rc.thread")
|
local thread = require("rc.thread")
|
||||||
|
print("[OK] Computer load&check system done. Starting operating system...")
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ local old_bg = term.getBackgroundColor()
|
|||||||
term.setTextColor(colors.white)
|
term.setTextColor(colors.white)
|
||||||
term.setBackgroundColor(colors.cyan)
|
term.setBackgroundColor(colors.cyan)
|
||||||
term.at(1, 1).clearLine()
|
term.at(1, 1).clearLine()
|
||||||
term.at(1, 1).write("=== Shell Command Line ===")
|
term.at(1, 1).write("=== LeonOS Shell ===")
|
||||||
|
|
||||||
-- 恢复颜色设置
|
-- 恢复颜色设置
|
||||||
term.setTextColor(old_fg)
|
term.setTextColor(old_fg)
|
||||||
@@ -81,21 +81,21 @@ end
|
|||||||
|
|
||||||
local history = {}
|
local history = {}
|
||||||
while true do
|
while true do
|
||||||
-- 先清除控制台内容,但保留顶部应用栏
|
|
||||||
local w, h = term.getSize()
|
|
||||||
term.setTextColor(colors.white)
|
|
||||||
term.setBackgroundColor(colors.black)
|
|
||||||
for y=2, h do
|
|
||||||
term.at(1, y).clearLine()
|
|
||||||
end
|
|
||||||
term.at(1, 2)
|
|
||||||
|
|
||||||
term.setTextColor(colors.yellow)
|
|
||||||
rc.write("$ "..shell.dir().." >>> ")
|
|
||||||
term.setTextColor(colors.white)
|
|
||||||
|
|
||||||
local text = term.read(nil, history, shell.complete)
|
|
||||||
if #text > 0 then
|
if #text > 0 then
|
||||||
|
-- 先清除控制台内容,但保留顶部应用栏
|
||||||
|
local w, h = term.getSize()
|
||||||
|
term.setTextColor(colors.white)
|
||||||
|
term.setBackgroundColor(colors.black)
|
||||||
|
for y=2, h do
|
||||||
|
term.at(1, y).clearLine()
|
||||||
|
end
|
||||||
|
term.at(1, 2)
|
||||||
|
|
||||||
|
term.setTextColor(colors.yellow)
|
||||||
|
rc.write("$ "..shell.dir().." >>> ")
|
||||||
|
term.setTextColor(colors.white)
|
||||||
|
|
||||||
|
local text = term.read(nil, history, shell.complete)
|
||||||
history[#history+1] = text
|
history[#history+1] = text
|
||||||
local ok, err = shell.run(text)
|
local ok, err = shell.run(text)
|
||||||
if not ok and err then
|
if not ok and err then
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
-- LeonOS installer
|
-- LeonOS installer
|
||||||
local INSTALLER_VERSION = "0.1.1"
|
local INSTALLER_VERSION = "0.1.2"
|
||||||
local DEFAULT_ROM_DIR = "/rc"
|
local DEFAULT_ROM_DIR = "/rc"
|
||||||
|
|
||||||
print("Start loading LeonOS installer...")
|
print("Start loading LeonOS installer...")
|
||||||
|
|||||||
Reference in New Issue
Block a user