Compare commits

..

2 Commits

Author SHA1 Message Date
ec3af7f664 Fixed get os version in SHELL
Signed-off-by: Maxim Logaev <maxlogaev@proton.me>
2024-03-31 03:17:16 +03:00
fa4755138f Changes to get os version API for migrating to git
Signed-off-by: Maxim Logaev <maxlogaev@proton.me>
2024-03-31 02:22:34 +03:00
14 changed files with 132 additions and 126 deletions

View File

@ -872,8 +872,8 @@ for i,v in ipairs(img_files) do
-- note that .revision and .kernel.mnt must begin with . -- note that .revision and .kernel.mnt must begin with .
-- to prevent tup from tracking them -- to prevent tup from tracking them
if build_type == "rus" if build_type == "rus"
then str='$(LANG=ru_RU.utf8 date -u +"[автосборка %d %b %Y %R, r$(get-current-revision)]"|iconv -f utf8 -t cp866)' then str='$(LANG=ru_RU.utf8 date -u +"[автосборка %d %b %Y %R, g$(git rev-parse --short HEAD)]"|iconv -f utf8 -t cp866)'
else str='$(date -u +"[auto-build %d %b %Y %R, r$(get-current-revision)]")' else str='$(date -u +"[autobuild %d %b %Y %R, g$(git rev-parse --short HEAD)]")'
end end
str = string.gsub(str, "%$", "\\$") -- escape $ as \$ str = string.gsub(str, "%$", "\\$") -- escape $ as \$
str = string.gsub(str, "%%", "%%%%") -- escape % as %% str = string.gsub(str, "%%", "%%%%") -- escape % as %%
@ -899,7 +899,7 @@ end
-- generate tup rule for kolibri.iso -- generate tup rule for kolibri.iso
if tup.getconfig("INSERT_REVISION_ID") ~= "" if tup.getconfig("INSERT_REVISION_ID") ~= ""
then volume_id = "KolibriOS r`get-current-revision`" then volume_id = "KolibriOS g`git rev-parse --short HEAD`"
else volume_id = "KolibriOS" else volume_id = "KolibriOS"
end end
tup.definerule{inputs = input_deps, command = tup.definerule{inputs = input_deps, command =

View File

@ -1,8 +1,9 @@
if tup.getconfig("NO_FASM") ~= "" then return end if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > %o", {"lang.inc"}) tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > %o", {"lang.inc"})
tup.rule({"kernel.asm", extra_inputs = {"lang.inc"}}, "fasm -m 262144 %f %o " .. tup.getconfig("KERPACK_CMD"), "kernel.mnt") tup.rule("./version-gen.sh", {extra_outputs={"ver.inc", "ver_boot.inc"}})
tup.rule({"kernel.asm", extra_inputs = {"lang.inc", "ver.inc", "ver_boot.inc"}}, "fasm -m 262144 %f %o " .. tup.getconfig("KERPACK_CMD"), "kernel.mnt")
--tup.rule({"kernel.asm", extra_inputs = {"lang.inc"}}, "fasm -m 262144 %f %o -s %o.fas" .. tup.getconfig("KERPACK_CMD"), {"kernel.mnt", extra_outputs = {"kernel.mnt.fas"}}) --tup.rule({"kernel.asm", extra_inputs = {"lang.inc"}}, "fasm -m 262144 %f %o -s %o.fas" .. tup.getconfig("KERPACK_CMD"), {"kernel.mnt", extra_outputs = {"kernel.mnt.fas"}})
--tup.rule({"kernel.mnt.fas", extra_inputs = {"kernel.mnt"}}, "symbols %f %o", "kernel.mnt.sym") --tup.rule({"kernel.mnt.fas", extra_inputs = {"kernel.mnt"}}, "symbols %f %o", "kernel.mnt.sym")
--tup.rule({"kernel.mnt.fas", extra_inputs = {"kernel.mnt"}}, "listing %f %o", "kernel.mnt.lst") --tup.rule({"kernel.mnt.fas", extra_inputs = {"kernel.mnt"}}, "listing %f %o", "kernel.mnt.lst")
tup.rule({"kernel.asm", extra_inputs = {"lang.inc"}}, "fasm -m 262144 %f %o -dextended_primary_loader=1" .. tup.getconfig("KERPACK_CMD"), "kernel.mnt.ext_loader") tup.rule({"kernel.asm", extra_inputs = {"lang.inc", "ver.inc", "ver_boot.inc"}}, "fasm -m 262144 %f %o -dextended_primary_loader=1" .. tup.getconfig("KERPACK_CMD"), "kernel.mnt.ext_loader")
tup.rule({"kernel.asm", extra_inputs = {"lang.inc"}}, "fasm -m 262144 %f %o -dpretest_build=1 -ddebug_com_base=0xe9", "kernel.mnt.pretest") tup.rule({"kernel.asm", extra_inputs = {"lang.inc", "ver.inc", "ver_boot.inc"}}, "fasm -m 262144 %f %o -dpretest_build=1 -ddebug_com_base=0xe9", "kernel.mnt.pretest")

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -31,18 +31,6 @@ macro line_space {
} }
d80x25_top: d80x25_top:
line_full_top line_full_top
if __REV__ > 0
cur_line_pos = 75
store byte ' ' at d80x25_top+cur_line_pos+1
rev_var = __REV__
while rev_var > 0
store byte rev_var mod 10 + '0' at d80x25_top+cur_line_pos
cur_line_pos = cur_line_pos - 1
rev_var = rev_var / 10
end while
store byte ' ' at d80x25_top+cur_line_pos
store dword ' SVN' at d80x25_top+cur_line_pos-4
end if
space_msg: space_msg:
line_space line_space

View File

@ -24,7 +24,7 @@ org 0
; struct kernel_header ; struct kernel_header
jmp start_of_code ; jump jmp start_of_code ; jump
db 'KolibriOS ' ; signature db 'KolibriOS ' ; signature
db 'v0.7.7.0+ ',13,10,13,10,0 ; version include "ver_boot.inc" ; version
dd B32-KERNEL_BASE ; offset of the kernel's 32-bit entry point dd B32-KERNEL_BASE ; offset of the kernel's 32-bit entry point
include "boot/bootstr.inc" ; language-independent boot messages include "boot/bootstr.inc" ; language-independent boot messages

View File

@ -1,11 +1,11 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
СИСТЕМНЫЕ ФУНКЦИИ ОПЕРАЦИОННОЙ СИСТЕМЫ Kolibri 0.7.7.0 СИСТЕМНЫЕ ФУНКЦИИ KolibriOS 0.7.7-0+
Номер функции помещается в регистр eax. Номер функции помещается в регистр eax.
Вызов системной функции осуществляется командой "int 0x40". Вызов системной функции осуществляется командой "int 0x40".
@ -952,7 +952,7 @@ picture rb Xsize*Ysize*4 ; 32 бита
eax - SF_SYSTEM (18) eax - SF_SYSTEM (18)
ebx - SSF_INFO_DISC_SYS (11) ebx - SSF_INFO_DISC_SYS (11)
====================================================================== ======================================================================
========== Функция 18, подфункция 13 - получить версию ядра. ========= ========== Функция 18, подфункция 13 - получить версию ОС. ===========
====================================================================== ======================================================================
Параметры: Параметры:
* eax = 18 - номер функции * eax = 18 - номер функции
@ -962,25 +962,22 @@ picture rb Xsize*Ysize*4 ; 32 бита
Возвращаемое значение: Возвращаемое значение:
* функция не возвращает значения * функция не возвращает значения
но, если указатель в ecx недопустимый, например, но, если указатель в ecx недопустимый, например,
регион [ecx, ecx + 9) пересекается с памятью ядра, регион [ecx, ecx + 16) пересекается с памятью ядра,
то тогда функция возвращает -1 то тогда функция возвращает -1
Замечания:
* В данный момент используется только часть буфера размером
9 байт. Тем не менее рекомендуется использовать буфер
размером 16 байт для будущей совместимости, в будущем могут быть
добавлены некоторые поля.
Структура буфера: Структура буфера:
db a,b,c,d для версии a.b.c.d db major, minor, patch - git-тег
db 0: зарезервировано db 0 - зарезервировано для выравнивания git-тега до dword;
dd REV - номер svn-ревизии ядра dw offset - количество коммитов от git-тега;
Для ядра Kolibri 0.7.7.0+: db 'hash', 0 - нуль-терминированная строка git-хэша.
db 0,7,7,0 Например для KolibriOS v0.7.7-8672-g99ffedbae:
db 0,7,7
db 0 db 0
dd 1675 dw 8672
db '99ffedbae', 0
---------------------- Константы для регистров: ---------------------- ---------------------- Константы для регистров: ----------------------
eax - SF_SYSTEM (18) eax - SF_SYSTEM (18)
ebx - SSF_KERNEL_VERSION (13) ebx - SSF_KERNEL_VERSION/SSF_OS_VERSION (13)
====================================================================== ======================================================================
====================== Функция 18, подфункция 14 ===================== ====================== Функция 18, подфункция 14 =====================
======= Ожидать начала обратного хода луча развёртки монитора. ======= ======= Ожидать начала обратного хода луча развёртки монитора. =======

View File

@ -1,11 +1,11 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SYSTEM FUNCTIONS of OS Kolibri 0.7.7.0 SYSTEM FUNCTIONS of KolibriOS 0.7.7-0+
Number of the function is located in the register eax. Number of the function is located in the register eax.
The call of the system function is executed by "int 0x40" command. The call of the system function is executed by "int 0x40" command.
@ -944,7 +944,7 @@ Remarks:
eax - SF_SYSTEM (18) eax - SF_SYSTEM (18)
ebx - SSF_INFO_DISC_SYS (11) ebx - SSF_INFO_DISC_SYS (11)
====================================================================== ======================================================================
========== Function 18, subfunction 13 - get kernel version. ========= ========== Function 18, subfunction 13 - get OS version. =============
====================================================================== ======================================================================
Parameters: Parameters:
* eax = 18 - function number * eax = 18 - function number
@ -954,25 +954,22 @@ Parameters:
Returned value: Returned value:
* function does not return value * function does not return value
but if pointer in ecx is illegal, for example, but if pointer in ecx is illegal, for example,
[ecx, ecx + 9) region intersects with kernel memory, [ecx, ecx + 16) region intersects with kernel memory,
then function returns -1 then function returns -1
Remarks:
* At the moment only the part of the buffer by a size
9 bytes is used. Nevertheless it is recommended to use
16 byte buffer for the future compatibility, in the future
some fields can be added.
Structure of the buffer: Structure of the buffer:
db a,b,c,d for version a.b.c.d db major, minor, patch - git-tag;
db 0: reserved db 0 - reserved for alignment to dword;
dd REV - kernel SVN revision number dw offset - number of commits after git-tag;
For Kolibri 0.7.7.0+ kernel: db 'hash', 0 - a null-terminated git-hash string.
db 0,7,7,0 For example for KolibriOS v0.7.7-8672-g99ffedbae:
db 0,7,7
db 0 db 0
dd 1675 dw 8672
db '99ffedbae', 0
---------------------- Constants for registers: ---------------------- ---------------------- Constants for registers: ----------------------
eax - SF_SYSTEM (18) eax - SF_SYSTEM (18)
ebx - SSF_KERNEL_VERSION (13) ebx - SSF_KERNEL_VERSION/SSF_OS_VERSION (13)
====================================================================== ======================================================================
======= Function 18, subfunction 14 - wait for screen retrace. ======= ======= Function 18, subfunction 14 - wait for screen retrace. =======
====================================================================== ======================================================================

View File

@ -91,7 +91,7 @@ pci_data_sel = pci_data_32-gdts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; That is a loading and initialization code that also draws the blue screen ; That is a loading and initialization code that also draws the blue screen
; menu with svn revision number near top right corner of the screen. ; menu with version in the upper left corner of the screen.
include "bootbios.inc" include "bootbios.inc"
use32 use32
@ -712,10 +712,10 @@ end if
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; show SVN version of kernel on the message board ; show Git-hash of kernel on the message board
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov eax, [version_inf.rev] mov eax, version_inf.hash
DEBUGF 1, "K : kernel SVN r%d\n", eax DEBUGF 1, "K : kernel GIT %s\n", eax
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; show CPU count on the message board ; show CPU count on the message board
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@ -2400,9 +2400,7 @@ endg
iglobal iglobal
version_inf: version_inf:
db 0,7,7,0 ; version 0.7.7.0 include 'ver.inc'
db 0
.rev dd __REV__
.size = $ - version_inf .size = $ - version_inf
endg endg
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -4576,8 +4574,6 @@ end if
include "data32.inc" include "data32.inc"
__REV__ = __REV
if ~ lang eq sp if ~ lang eq sp
diff16 "end of kernel code",0,$ diff16 "end of kernel code",0,$
end if end if

View File

@ -1,20 +1,10 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
__REV = 0
macro $Revision a {
match =: Num =$,a \{
if __REV < Num
__REV = Num
end if
\}
}
macro ignore_empty_revision_keyword { macro ignore_empty_revision_keyword {
; svn keywords are neither substituted by git-svn nor catched by $Revision ; svn keywords are neither substituted by git-svn nor catched by $Revision
; macro above, ignore them to not fail the build ; macro above, ignore them to not fail the build

27
kernel/trunk/version-gen.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
# Copyright (C) KolibriOS team 2024. All rights reserved
# Distributed under terms of the GNU General Public License
full_ver=$(git describe --tag --long)
version=$(echo $full_ver | cut -d'-' -f1 | cut -c 2-)
offset=$(echo $full_ver | cut -d'-' -f2)
hash=$(echo $full_ver | cut -d'-' -f3 | cut -c 2-)
major=$(echo $version | cut -d'.' -f1)
minor=$(echo $version | cut -d'.' -f2)
patch=$(echo $version | cut -d'.' -f3)
short_ver=$(printf %-14s "$major.$minor.$patch-$offset")
cat > ver_boot.inc << EOF
db '$short_ver', 13,10,13,10,0
EOF
cat > ver.inc << EOF
db $major, $minor, $patch
db 0
dw $offset
.hash db '$hash', 0
EOF

View File

@ -759,6 +759,34 @@ KOSAPI void _ksys_shutdown(uint32_t shd_param)
asm_inline("int $0x40" ::"a"(18), "b"(9), "c"(shd_param)); asm_inline("int $0x40" ::"a"(18), "b"(9), "c"(shd_param));
} }
/*========= Function 18, subfunction 13 - get OS version. ========*/
#define KSYS_VER_HASH_LEN 9
typedef struct {
union {
struct {
uint8_t major;
uint8_t minor;
uint8_t patch;
uint8_t __reserved;
};
uint32_t value;
} tag;
uint16_t offset;
char hash[KSYS_VER_HASH_LEN + 1];
} ksys_os_ver_t;
KOSAPI int _ksys_get_os_ver(ksys_os_ver_t *ver)
{
int status;
asm_inline(
"int $0x40"
: "=a"(status)
: "a"(18), "b"(13), "c"(ver));
return status;
}
/*========= Function 18, subfunction 16 - get size of free RAM. ========*/ /*========= Function 18, subfunction 16 - get size of free RAM. ========*/
KOSAPI size_t _ksys_get_ram_size(void) KOSAPI size_t _ksys_get_ram_size(void)

View File

@ -6,16 +6,16 @@ void get_str_meminfo(char *str) {
} }
int cmd_kfetch(char param[]) { int cmd_kfetch(char param[]) {
char *str_krnl_ver = malloc(64); char str_krnl_ver[64];
get_str_kernel_version(str_krnl_ver, "%d.%d.%d.%d. SVN-rev.: %d"); get_str_kernel_version(str_krnl_ver, "v%d.%d.%d-%d-g%s");
char *str_uptime = malloc(64); char str_uptime[64];
get_str_uptime(str_uptime, "%d day(s), %d:%d:%d.%d"); get_str_uptime(str_uptime, "%d day(s), %d:%d:%d.%d");
char *str_resolution = malloc(24); char str_resolution[24];
ksys_pos_t resol = _ksys_screen_size(); ksys_pos_t resol = _ksys_screen_size();
sprintf(str_resolution, "%u x %u", resol.x + 1, resol.y + 1); sprintf(str_resolution, "%u x %u", resol.x + 1, resol.y + 1);
char *str_cpu_info = malloc(16); char str_cpu_info[16];
get_str_cpu_info(str_cpu_info); get_str_cpu_info(str_cpu_info);
char *str_meminfo = malloc(24); char str_meminfo[24];
get_str_meminfo(str_meminfo); get_str_meminfo(str_meminfo);
printf(/*"\033[0;34;40m \033[0m\n\r"*/ printf(/*"\033[0;34;40m \033[0m\n\r"*/
@ -42,12 +42,7 @@ int cmd_kfetch(char param[]) {
"\033[0;34;40m \033[0;31;40m \033[0;34;40m \033[0;31;40m.\033[0;1;30;40m8\033[0;5;37;45m@\033[0;5;35;44m:\033[0;1;30;45m8\033[0;5;34;44m \033[0;5;35;45m \033[0;1;34;44m8\033[0;1;35;45m.\033[0;5;34;40mX\033[0;34;40m@\033[0;32;40mS\033[0;31;40m \033[0;34;40m \033[0m\n\r" "\033[0;34;40m \033[0;31;40m \033[0;34;40m \033[0;31;40m.\033[0;1;30;40m8\033[0;5;37;45m@\033[0;5;35;44m:\033[0;1;30;45m8\033[0;5;34;44m \033[0;5;35;45m \033[0;1;34;44m8\033[0;1;35;45m.\033[0;5;34;40mX\033[0;34;40m@\033[0;32;40mS\033[0;31;40m \033[0;34;40m \033[0m\n\r"
"\033[0;34;40m \033[0;31;40m \033[0;34;40m \033[0;31;40m \033[0;34;40m.;\033[0;1;30;40m8\033[0;1;30;44m8\033[0;34;40m8\033[0;5;34;40m8\033[0;32;40m%%\033[0;34;40m8;\033[0;32;40m;\033[0;31;40m.\033[0;32;40m \033[0;31;40m \033[0;34;40m \033[0m\n\r" "\033[0;34;40m \033[0;31;40m \033[0;34;40m \033[0;31;40m \033[0;34;40m.;\033[0;1;30;40m8\033[0;1;30;44m8\033[0;34;40m8\033[0;5;34;40m8\033[0;32;40m%%\033[0;34;40m8;\033[0;32;40m;\033[0;31;40m.\033[0;32;40m \033[0;31;40m \033[0;34;40m \033[0m\n\r"
"\033[0;34;40m \033[0;31;40m \033[0;34;40m \033[0;32;40m .\033[0;31;40m .:\033[0;32;40m.\033[0;31;40m.\033[0;32;40m.\033[0;31;40m.\033[0;32;40m.\033[0;31;40m \033[0;32;40m \033[0;34;40m \033[0m\n\r", "\033[0;34;40m \033[0;31;40m \033[0;34;40m \033[0;32;40m .\033[0;31;40m .:\033[0;32;40m.\033[0;31;40m.\033[0;32;40m.\033[0;31;40m.\033[0;32;40m.\033[0;31;40m \033[0;32;40m \033[0;34;40m \033[0m\n\r",
"\033[0;36mOS\033[0m: KolibriOS", "\033[0;36mKernel\033[0m: ", str_krnl_ver, "\033[0;36mUptime\033[0m: ", str_uptime, "\033[0;36mResolution\033[0m: ", str_resolution, "\033[0;36mCPU\033[0m: ", str_cpu_info, "\033[0;36mMemory\033[0m: ", str_meminfo); "\033[0;36mOS\033[0m: KolibriOS", "\033[0;36mVersion\033[0m: ", str_krnl_ver, "\033[0;36mUptime\033[0m: ", str_uptime, "\033[0;36mResolution\033[0m: ", str_resolution, "\033[0;36mCPU\033[0m: ", str_cpu_info, "\033[0;36mMemory\033[0m: ", str_meminfo);
free(str_krnl_ver);
free(str_uptime);
free(str_resolution);
free(str_cpu_info);
free(str_meminfo);
return TRUE; return TRUE;
} }

View File

@ -1,31 +1,21 @@
void get_str_kernel_version(char *str, const char *fmt) { void get_str_kernel_version(char *str, const char *fmt) {
char *kvbuf; ksys_os_ver_t ver;
char *vA, *vB, *vC, *vD; _ksys_get_os_ver(&ver);
unsigned *Rev; sprintf(str, fmt, ver.tag.major, ver.tag.minor, ver.tag.patch, ver.offset, ver.hash);
kvbuf = malloc(16);
kol_get_kernel_ver(kvbuf);
vA = kvbuf+0;
vB = kvbuf+1;
vC = kvbuf+2;
vD = kvbuf+3;
Rev = (unsigned*)(kvbuf + 5);
sprintf (str, fmt, *vA, *vB, *vC, *vD, *Rev);
free(kvbuf);
} }
void get_str_cpu_info(char *str) { void get_str_cpu_info(char *str) {
unsigned a, b, c, d; unsigned a, b, c, d;
asm ("cpuid" : __asm__ __volatile__(
"=a" (a), "cpuid"
:"=a" (a),
"=b" (b), "=b" (b),
"=c" (c), "=c" (c),
"=d" (d): "=d" (d):
"a"(0)); "a"(0)
);
str[0] = (b & 0x000000ff) >> 0; str[0] = (b & 0x000000ff) >> 0;
str[1] = (b & 0x0000ff00) >> 8; str[1] = (b & 0x0000ff00) >> 8;
@ -46,7 +36,7 @@ void get_str_cpu_info(char *str) {
int cmd_ver(char param[]) { int cmd_ver(char param[]) {
if (!strcmp(param, "kernel")) { if (!strcmp(param, "kernel")) {
get_str_kernel_version(tmpstr, CMD_VER_FMT1); get_str_kernel_version(tmpstr, " KolibriOS v%d.%d.%d-%d-g%s\n\r");
printf(tmpstr); printf(tmpstr);
return TRUE; return TRUE;
} }
@ -61,4 +51,3 @@ int cmd_ver(char param[]) {
printf (" Shell v%s\n\r", SHELL_VERSION); printf (" Shell v%s\n\r", SHELL_VERSION);
return TRUE; return TRUE;
} }

View File

@ -59,7 +59,6 @@ const command_t COMMANDS[]=
#define CMD_SLEEP_USAGE " sleep <time in the 1/100 of second>\n\r" #define CMD_SLEEP_USAGE " sleep <time in the 1/100 of second>\n\r"
#define CMD_TOUCH_USAGE " touch <filename>\n\r" #define CMD_TOUCH_USAGE " touch <filename>\n\r"
#define CMD_UPTIME_FMT " Uptime: %d day(s), %d:%d:%d.%d\n\r" #define CMD_UPTIME_FMT " Uptime: %d day(s), %d:%d:%d.%d\n\r"
#define CMD_VER_FMT1 " KolibriOS v%d.%d.%d.%d. Kernel SVN-rev.: %d\n\r"
#define CMD_WAITFOR_FMT " Awaing finish PID %d\n\r" #define CMD_WAITFOR_FMT " Awaing finish PID %d\n\r"
#define EXEC_STARTED_FMT " '%s' started. PID = %d\n\r" #define EXEC_STARTED_FMT " '%s' started. PID = %d\n\r"
#define EXEC_SCRIPT_ERROR_FMT "Error in '%s' : script must start with #SHS line\n\r" #define EXEC_SCRIPT_ERROR_FMT "Error in '%s' : script must start with #SHS line\n\r"

View File

@ -59,7 +59,6 @@ const command_t COMMANDS[]=
#define CMD_SLEEP_USAGE " sleep <¨­â¥à¢ « ¢ á®âëå ¤®«ïx ᥪ㭤ë>\n\r" #define CMD_SLEEP_USAGE " sleep <¨­â¥à¢ « ¢ á®âëå ¤®«ïx ᥪ㭤ë>\n\r"
#define CMD_TOUCH_USAGE " touch <¨¬ï ä ©« >\n\r" #define CMD_TOUCH_USAGE " touch <¨¬ï ä ©« >\n\r"
#define CMD_UPTIME_FMT " Uptime: %d ¤­¥©, %d:%d:%d.%d\n\r" #define CMD_UPTIME_FMT " Uptime: %d ¤­¥©, %d:%d:%d.%d\n\r"
#define CMD_VER_FMT1 " KolibriOS v%d.%d.%d.%d. SVN-ॢ. ï¤à : %d\n\r"
#define CMD_WAITFOR_FMT " Ž¦¨¤ ¥¬ § ¢¥à襭¨ï PID %d\n\r" #define CMD_WAITFOR_FMT " Ž¦¨¤ ¥¬ § ¢¥à襭¨ï PID %d\n\r"
#define EXEC_STARTED_FMT " '%s' § ¯ã饭. PID = %d\n\r" #define EXEC_STARTED_FMT " '%s' § ¯ã饭. PID = %d\n\r"
#define EXEC_SCRIPT_ERROR_FMT "Žè¨¡ª  ¢ '%s' : áªà¨¯â ¤®«¦¥­ ­ ç¨­ âìáï á® áâà®çª¨ #SHS\n\r" #define EXEC_SCRIPT_ERROR_FMT "Žè¨¡ª  ¢ '%s' : áªà¨¯â ¤®«¦¥­ ­ ç¨­ âìáï á® áâà®çª¨ #SHS\n\r"