From f5e0f96e84728c3f41e13b10d9c1e22ae578aaef Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Sun, 4 Oct 2020 16:53:59 +0000 Subject: [PATCH] Add extended_primary_loader to autobuild. * Build fat1x, fat32, cdfs, after_win loaders. * Set use_lba=1 by default in fat32 loader. * Build kolibri.raw: flash / hdd image. * Add example config.ini file. * Add an option (config file and screen) to not load ramdisk image. * Add an option (config file only) to set /sys path. Now you can boot without a ramdisk from a storage that is supported by the kernel itself, i.e. without loadable drivers. Thus you can not load the system without a ramdisk from SATA/AHCI and USB drives. git-svn-id: svn://kolibrios.org@8091 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/Tupfile.lua | 38 ++++++++++++++++++- kernel/trunk/Tupfile.lua | 4 +- kernel/trunk/boot/bootcode.inc | 20 +++++++++- kernel/trunk/boot/booten.inc | 9 +++-- kernel/trunk/boot/bootru.inc | 8 ++-- kernel/trunk/boot/parsers.inc | 15 +++++++- kernel/trunk/boot/preboot.inc | 7 +++- kernel/trunk/boot/rdload.inc | 7 ---- kernel/trunk/boot/uefi4kos.asm | 28 ++++++++------ .../after_win/Tupfile.lua | 2 + .../extended_primary_loader/cdfs/Tupfile.lua | 2 + .../extended_primary_loader/cdfs/bootsect.asm | 3 +- .../extended_primary_loader/config.ini | 15 ++++++++ .../extended_primary_loader/fat1x/Tupfile.lua | 3 ++ .../extended_primary_loader/fat32/Tupfile.lua | 3 ++ .../fat32/bootsect.asm | 2 +- kernel/trunk/const.inc | 12 +++--- kernel/trunk/data16.inc | 1 + kernel/trunk/fs/parse_fn.inc | 11 ++++++ kernel/trunk/kernel.asm | 16 +++++++- kernel/trunk/readme-ext-loader.txt | 5 +++ tup.config.template | 3 +- 22 files changed, 171 insertions(+), 43 deletions(-) create mode 100644 kernel/trunk/bootloader/extended_primary_loader/after_win/Tupfile.lua create mode 100644 kernel/trunk/bootloader/extended_primary_loader/cdfs/Tupfile.lua create mode 100644 kernel/trunk/bootloader/extended_primary_loader/config.ini create mode 100644 kernel/trunk/bootloader/extended_primary_loader/fat1x/Tupfile.lua create mode 100644 kernel/trunk/bootloader/extended_primary_loader/fat32/Tupfile.lua diff --git a/data/Tupfile.lua b/data/Tupfile.lua index 3258abc6f4..fdae6cc156 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -790,7 +790,6 @@ end -- generate tup rule for kolibri.img tup.definerule{inputs = input_deps, command = make_img_command, outputs = output_deps} -tup.definerule{inputs = {"../kernel/trunk/boot/uefi4kos.asm", "kolibri.img", "../kernel/trunk/kernel.bin"}, command = "fasm ../kernel/trunk/boot/uefi4kos.asm %o", outputs = {"kolibri.efi"}} -- generate command and dependencies for mkisofs input_deps = {"kolibri.img"} @@ -822,3 +821,40 @@ for i,v in ipairs(distr_extra_files) do else tup.definerule{inputs = {v.group or v[2]}, command = cmd, outputs = {"distribution_kit/" .. v[1]}} end end + + +-- generate tup rule for kolibri.efi +tup.definerule{inputs = {"../kernel/trunk/boot/uefi4kos.asm", "kolibri.img", "../kernel/trunk/kernel.bin.ext_loader"}, + command = "fasm -dUEFI=1 -dextended_primary_loader=1 ../kernel/trunk/boot/uefi4kos.asm %o", + outputs = {"kolibri.efi"}} + +input_deps = {"kolibri.img", "../kernel/trunk/bootloader/extended_primary_loader/fat32/kordldr.f32.bin", "../kernel/trunk/bootloader/extended_primary_loader/fat32/bootsect.bin", "../kernel/trunk/kernel.mnt.ext_loader"} +make_raw_command = '^ MKIMG kolibri.raw^ ' -- for tup: don't write full command to logs +make_raw_command = make_raw_command .. "dd if=/dev/zero of=kolibri.raw bs=1048576 count=64 2>&1" +make_raw_command = make_raw_command .. " && parted --script kolibri.raw mktable msdos" +make_raw_command = make_raw_command .. " && parted --script kolibri.raw unit MiB mkpart primary fat32 1 100%%" +make_raw_command = make_raw_command .. " && parted --script kolibri.raw set 1 boot on" +bootsector = "../kernel/trunk/bootloader/extended_primary_loader/fat32/bootsect.bin" +make_raw_command = make_raw_command .. " && mformat -i kolibri.raw@@1M -v KOLIBRIOS -T 129024 -h 16 -s 32 -H 2048 -c 1 -F -B " .. bootsector .. " ::" +make_raw_command = make_raw_command .. " && mcopy -moi kolibri.raw@@1M ../kernel/trunk/kernel.mnt.ext_loader ::KERNEL.MNT" +make_raw_command = make_raw_command .. " && mcopy -moi kolibri.raw@@1M kolibri.img ::KOLIBRI.IMG" +make_raw_command = make_raw_command .. " && mcopy -moi kolibri.raw@@1M ../kernel/trunk/bootloader/extended_primary_loader/fat32/kordldr.f32.bin ::KORDLDR.F32" +make_raw_command = make_raw_command .. " && mcopy -moi kolibri.raw@@1M ../kernel/trunk/bootloader/extended_primary_loader/config.ini ::CONFIG.INI" + +make_raw_command = make_raw_command .. ' && mmd -i kolibri.raw@@1M ::KOLIBRIOS' + +-- make folders +table.sort(img_dirs) +for i,v in ipairs(img_dirs) do + if v ~= img_dirs[i-1] then + make_raw_command = make_raw_command .. ' && mmd -i kolibri.raw@@1M "::KOLIBRIOS/' .. v .. '"' + end +end + +for i,v in ipairs(img_files) do + local_file = v[2] + make_raw_command = make_raw_command .. ' && mcopy -moi kolibri.raw@@1M "' .. local_file .. '" "::KOLIBRIOS/' .. v[1] .. '"' +end + +-- generate tup rule for kolibri.raw +tup.definerule{inputs = input_deps, command = make_raw_command, outputs = {"kolibri.raw"}} diff --git a/kernel/trunk/Tupfile.lua b/kernel/trunk/Tupfile.lua index d5827cd76d..d0fe85b6a5 100644 --- a/kernel/trunk/Tupfile.lua +++ b/kernel/trunk/Tupfile.lua @@ -1,5 +1,7 @@ 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({"bootbios.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o ", "bootbios.bin") +tup.rule({"bootbios.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o -dextended_primary_loader=1", "bootbios.bin.ext_loader") tup.rule({"kernel.asm", extra_inputs = {"bootbios.bin", "lang.inc"}}, "fasm -m 65536 %f %o " .. tup.getconfig("KERPACK_CMD"), "kernel.mnt") -tup.rule({"kernel.asm", extra_inputs = {"lang.inc"}}, "fasm -m 65536 %f %o -dUEFI=1", "kernel.bin") +tup.rule({"kernel.asm", extra_inputs = {"bootbios.bin.ext_loader", "lang.inc"}}, "fasm -m 65536 %f %o -dextended_primary_loader=1" .. tup.getconfig("KERPACK_CMD"), "kernel.mnt.ext_loader") +tup.rule({"kernel.asm", extra_inputs = {"lang.inc"}}, "fasm -m 65536 %f %o -dUEFI=1 -dextended_primary_loader=1", "kernel.bin.ext_loader") diff --git a/kernel/trunk/boot/bootcode.inc b/kernel/trunk/boot/bootcode.inc index ef20a46029..e0dc69e983 100644 --- a/kernel/trunk/boot/bootcode.inc +++ b/kernel/trunk/boot/bootcode.inc @@ -667,7 +667,7 @@ end if jnz .show_remarks ; e) preboot_device = from where to boot? if defined extended_primary_loader - _ask_question bdev,'12',preboot_device ; range accepted for answer: 1-2 + _ask_question bdev,'13',preboot_device ; range accepted for answer: 1-3 else _ask_question bdev,'14',preboot_device ; range accepted for answer: 1-4 end if @@ -970,9 +970,25 @@ end if ; BOOT DEVICE mov al, [preboot_device] - dec al +if defined extended_primary_loader + cmp al, RD_LOAD_FROM_MEMORY + jnz @f + mov al, RD_LOAD_FROM_NONE +@@: +end if mov [es:BOOT_LO.rd_load_from], al +; /sys path + mov eax, dword[preboot_syspath+0] + mov dword[es:BOOT_LO.syspath+0], eax + mov eax, dword[preboot_syspath+4] + mov dword[es:BOOT_LO.syspath+4], eax + mov eax, dword[preboot_syspath+8] + mov dword[es:BOOT_LO.syspath+8], eax + mov eax, dword[preboot_syspath+12] + mov dword[es:BOOT_LO.syspath+12], eax + + ; GET MEMORY MAP include '../detect/biosmem.inc' diff --git a/kernel/trunk/boot/booten.inc b/kernel/trunk/boot/booten.inc index f32aa5a979..d323a9c992 100644 --- a/kernel/trunk/boot/booten.inc +++ b/kernel/trunk/boot/booten.inc @@ -27,10 +27,10 @@ s_vesa db "Version of VESA: " gr_mode db "Select a videomode: ",13,10,0 -ask_bd db "Add disks visible by BIOS emulated in V86-mode? [1-yes, 2-no]: ",0 +ask_bd db "Add disks visible by BIOS emulated in V86-mode? [1-yes, 2-no]: ",0 if defined extended_primary_loader -bdev db "Load ramdisk from [1-floppy; 2-kolibri.img]: ",0 +bdev db "Load ramdisk from [1-floppy; 2-kolibri.img; 3-don't load]: ",0 else bdev db "Load ramdisk from [1-floppy; 2-C:\kolibri.img (FAT32);" db 13,10,186," " @@ -75,9 +75,10 @@ ask_launcher db "Start first application (LAUNCHER) after kernel is loaded? [1 preboot_device_msg db " [e] Floppy image: ",0 if defined extended_primary_loader -preboot_device_msgs dw 0,pdm1,pdm2,0 +preboot_device_msgs dw 0,pdm1,pdm2,pdm3,0 pdm1 db "real floppy",13,10,0 pdm2 db "C:\kolibri.img (FAT32)",13,10,0 +pdm3 db "do not use floppy image",13,10,0 else preboot_device_msgs dw 0,pdm1,pdm2,pdm3,pdm4,0 pdm1 db "real floppy",13,10,0 @@ -103,4 +104,4 @@ remark1 db "Default values were selected to match most of configurations, b remark2 db "If the system does not boot, try to disable option [b]. If the system gets",0 remark3 db "stuck after booting, enable option [c], disable option [d] and make photo.",0 remarks dw remark1, remark2, remark3 -num_remarks = 3 \ No newline at end of file +num_remarks = 3 diff --git a/kernel/trunk/boot/bootru.inc b/kernel/trunk/boot/bootru.inc index ad8889a418..1affe59ed1 100644 --- a/kernel/trunk/boot/bootru.inc +++ b/kernel/trunk/boot/bootru.inc @@ -30,7 +30,8 @@ gr_mode cp866 "Выберите видеорежим: ",13,10,0 ask_bd cp866 "Добавить диски, видимые через BIOS в режиме V86? [1-да, 2-нет]: ",0 if defined extended_primary_loader -bdev cp866 "Загрузить образ из [1-дискета; 2-kolibri.img из папки загрузки]: ",0 +bdev cp866 "Загрузить образ из [1-дискета; 2-kolibri.img из папки загрузки;",13,10 + cp866 "║ 3-не загружать]: ",0 else bdev cp866 "Загрузить образ из [1-дискета; 2-C:\kolibri.img (FAT32);",13,10 cp866 "║ 3-использовать уже загруженный образ;",13,10 @@ -73,9 +74,10 @@ ask_launcher cp866 "Запустить первую программу (LAUNC preboot_device_msg cp866 " [e] Образ дискеты: ",0 if defined extended_primary_loader -preboot_device_msgs dw 0,pdm1,pdm2,0 +preboot_device_msgs dw 0,pdm1,pdm2,pdm3,0 pdm1 cp866 "настоящая дискета",13,10,0 pdm2 cp866 "kolibri.img из папки загрузки",13,10,0 +pdm3 cp866 "не загружать образ рамдиска",13,10,0 else preboot_device_msgs dw 0,pdm1,pdm2,pdm3,pdm4,0 pdm1 cp866 "настоящая дискета",13,10,0 @@ -101,4 +103,4 @@ remark1 cp866 "Значения по умолчанию выбраны дл remark2 cp866 "Вас не грузится система, попробуйте отключить пункт [b]. Если она зависла",0 remark3 cp866 "после запуска, включите пункт [c], отключите пункт [d] и сделайте фото лога.",0 remarks dw remark1, remark2, remark3 -num_remarks = 3 \ No newline at end of file +num_remarks = 3 diff --git a/kernel/trunk/boot/parsers.inc b/kernel/trunk/boot/parsers.inc index 7129f205f9..74d2e40779 100644 --- a/kernel/trunk/boot/parsers.inc +++ b/kernel/trunk/boot/parsers.inc @@ -74,12 +74,25 @@ parse_imgfrom: jc .nothing cmp al, 1 jb .nothing - cmp al, 2 + cmp al, 3 ja .nothing mov [es:preboot_device], al .nothing: ret +parse_syspath: +; everything except spaces + mov bx, preboot_syspath +.next_char: + call parse_char + jc .done + mov [es:bx], al + inc bx + jmp .next_char +.done: + mov byte[es:bx], 0 ; terminator + ret + parse_char: ; skip spaces and return the next character or CF if EOF. cmp si, dx diff --git a/kernel/trunk/boot/preboot.inc b/kernel/trunk/boot/preboot.inc index 0199ef1039..1492e181f8 100644 --- a/kernel/trunk/boot/preboot.inc +++ b/kernel/trunk/boot/preboot.inc @@ -27,9 +27,12 @@ preboot_debug db 0 ; load kernel in debug mode? (1-yes, 2-no) preboot_launcher db 0 ; start launcher after kernel is loaded? (1-yes, 2-no) preboot_dma db 0 ; use DMA for access to HDD (1-always, 2-only for read, 3-never) preboot_device db 0 ; device to load ramdisk from - ; 0-floppy 1-harddisk 2-kernel restart - ; 3-format ram disk 4-don't use ramdisk + ; 1-floppy 2-harddisk 3-kernel restart + ; 4-format ram disk 5-don't use ramdisk + ; !!!! 0 - autodetect !!!! preboot_biosdisk db 0 ; use V86 to access disks through BIOS (1-yes, 2-no) +preboot_syspath db '/RD/1',0 ; path to /sys dir + rb 20-($-preboot_syspath) if defined extended_primary_loader ; timeout in 1/18th of second for config settings screen preboot_timeout dw PREBOOT_TIMEOUT*18 diff --git a/kernel/trunk/boot/rdload.inc b/kernel/trunk/boot/rdload.inc index db6c736f95..fd3650efbb 100644 --- a/kernel/trunk/boot/rdload.inc +++ b/kernel/trunk/boot/rdload.inc @@ -75,13 +75,6 @@ read_ramdisk: call register_ramdisk jmp yes_sys_on_hd ;----------------------------------------------------------------------------- -; Register ramdisk file system -register_ramdisk: - mov esi, boot_initramdisk - call boot_log - call ramdisk_init - ret -;----------------------------------------------------------------------------- iglobal align 4 read_image_fsinfo: diff --git a/kernel/trunk/boot/uefi4kos.asm b/kernel/trunk/boot/uefi4kos.asm index 0faf784809..fc5aaa81b0 100644 --- a/kernel/trunk/boot/uefi4kos.asm +++ b/kernel/trunk/boot/uefi4kos.asm @@ -3,7 +3,7 @@ entry main section '.text' code executable readable - + include '../struct.inc' include '../macros.inc' include '../const.inc' @@ -204,14 +204,14 @@ main: cli - mov rsi, kernel_bin_data_begin + mov rsi, kernel_data_begin mov rdi, KERNEL_BASE - mov rcx, (kernel_bin_data_end - kernel_bin_data_begin + 7) / 8 + mov rcx, (kernel_data_end - kernel_data_begin + 7) / 8 rep movsq - mov rsi, kolibri_img_data_begin + mov rsi, ramdisk_data_begin mov rdi, RAMDISK_BASE - mov rcx, (kolibri_img_data_end - kolibri_img_data_begin + 7 ) / 8 + mov rcx, (ramdisk_data_end - ramdisk_data_begin + 7 ) / 8 rep movsq xor esi, esi @@ -232,8 +232,10 @@ main: mov word[esi + BOOT_LO.apm_code_16], 0 mov word[esi + BOOT_LO.apm_data_16], 0 mov byte[esi + BOOT_LO.bios_hd_cnt], 0 - mov word[esi + BOOT_LO.sys_disk], 'r1' ; boot from /rd/1 - + mov rsi, syspath + mov rdi, BOOT_LO.syspath + mov ecx, 32 + rep movsb lgdt [cs:GDTR] @@ -428,17 +430,19 @@ msg_success du 'Success!',13,10,0 msg_error du 'Error!',13,10,0 msg du 79 dup ' ',13,10,0 +syspath db '/RD/1',0 + memory_map rb MEMORY_MAP_SIZE gop_buffer rb GOP_BUFFER_SIZE -kernel_bin_data_begin: -file '../kernel.bin' -kernel_bin_data_end: +kernel_data_begin: +file '../kernel.bin.ext_loader' +kernel_data_end: -kolibri_img_data_begin: +ramdisk_data_begin: file '../../../data/kolibri.img' -kolibri_img_data_end: +ramdisk_data_end: align 16 data fixups diff --git a/kernel/trunk/bootloader/extended_primary_loader/after_win/Tupfile.lua b/kernel/trunk/bootloader/extended_primary_loader/after_win/Tupfile.lua new file mode 100644 index 0000000000..1f704dfbff --- /dev/null +++ b/kernel/trunk/bootloader/extended_primary_loader/after_win/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("kordldr.win.asm", "fasm %f %o", "kordldr.win.bin") diff --git a/kernel/trunk/bootloader/extended_primary_loader/cdfs/Tupfile.lua b/kernel/trunk/bootloader/extended_primary_loader/cdfs/Tupfile.lua new file mode 100644 index 0000000000..75b9668db3 --- /dev/null +++ b/kernel/trunk/bootloader/extended_primary_loader/cdfs/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("bootsect.asm", "fasm %f %o ", "bootsect.bin") diff --git a/kernel/trunk/bootloader/extended_primary_loader/cdfs/bootsect.asm b/kernel/trunk/bootloader/extended_primary_loader/cdfs/bootsect.asm index 64c9f01a58..4694e005e8 100644 --- a/kernel/trunk/bootloader/extended_primary_loader/cdfs/bootsect.asm +++ b/kernel/trunk/bootloader/extended_primary_loader/cdfs/bootsect.asm @@ -50,7 +50,8 @@ real_start: ; get file system information ; scan for Primary Volume Descriptor db 66h - movi eax, 10h-1 + push 10h-1 + pop eax pvd_scan_loop: mov cx, 1 inc eax diff --git a/kernel/trunk/bootloader/extended_primary_loader/config.ini b/kernel/trunk/bootloader/extended_primary_loader/config.ini new file mode 100644 index 0000000000..f39fc14e10 --- /dev/null +++ b/kernel/trunk/bootloader/extended_primary_loader/config.ini @@ -0,0 +1,15 @@ +; boot time parameters for KolibriOS + +; timeout in seconds for config settings screen +timeout=5 + +; width*height +resolution=1024*768 + +; where to load ramdisk from +; 2 - /hd0/1/kolibri.img +; 3 - don't load ramdisk +;imgfrom=3 + +; which directory to use as /sys +;syspath=/HD0/1/KOLIBRIOS diff --git a/kernel/trunk/bootloader/extended_primary_loader/fat1x/Tupfile.lua b/kernel/trunk/bootloader/extended_primary_loader/fat1x/Tupfile.lua new file mode 100644 index 0000000000..d9aa6800c7 --- /dev/null +++ b/kernel/trunk/bootloader/extended_primary_loader/fat1x/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("bootsect.asm", "fasm %f %o", "bootsect.bin") +tup.rule("kordldr.f1x.asm", "fasm %f %o", "kordldr.f1x.bin") diff --git a/kernel/trunk/bootloader/extended_primary_loader/fat32/Tupfile.lua b/kernel/trunk/bootloader/extended_primary_loader/fat32/Tupfile.lua new file mode 100644 index 0000000000..5a4b92f2b4 --- /dev/null +++ b/kernel/trunk/bootloader/extended_primary_loader/fat32/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("bootsect.asm", "fasm %f %o", "bootsect.bin") +tup.rule("kordldr.f32.asm", "fasm %f %o", "kordldr.f32.bin") diff --git a/kernel/trunk/bootloader/extended_primary_loader/fat32/bootsect.asm b/kernel/trunk/bootloader/extended_primary_loader/fat32/bootsect.asm index 69f16c4590..d93c7979a6 100644 --- a/kernel/trunk/bootloader/extended_primary_loader/fat32/bootsect.asm +++ b/kernel/trunk/bootloader/extended_primary_loader/fat32/bootsect.asm @@ -24,7 +24,7 @@ ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;***************************************************************************** -use_lba = 0 +use_lba = 1 org 0x7C00 jmp start nop diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index 105c4ecb1c..086f9ca4c5 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -683,11 +683,11 @@ struct e820entry type dd ? ends -RD_LOAD_FROM_FLOPPY = 0 -RD_LOAD_FROM_HD = 1 -RD_LOAD_FROM_MEMORY = 2 -RD_LOAD_FROM_FORMAT = 3 -RD_LOAD_FROM_NONE = 4 +RD_LOAD_FROM_FLOPPY = 1 +RD_LOAD_FROM_HD = 2 +RD_LOAD_FROM_MEMORY = 3 +RD_LOAD_FROM_FORMAT = 4 +RD_LOAD_FROM_NONE = 5 struct boot_data bpp db ? ; bits per pixel @@ -721,7 +721,7 @@ struct boot_data kernel_restart dw ? sys_disk dw ? ; Device to mount on /sys/, see loader_doc.txt for details acpi_rsdp dd ? - rb 0x1f + syspath rb 0x1f bios_hd_cnt db ? ; number of BIOS hard disks bios_hd rb 0x80 ; BIOS hard disks memmap_block_cnt dd ? ; available physical memory map: number of blocks diff --git a/kernel/trunk/data16.inc b/kernel/trunk/data16.inc index 42d80fd8e1..79fbb26984 100644 --- a/kernel/trunk/data16.inc +++ b/kernel/trunk/data16.inc @@ -77,6 +77,7 @@ config_file_variables: config_variable 'vbemode', parse_vbemode config_variable 'biosdisks', parse_biosdisks config_variable 'imgfrom', parse_imgfrom + config_variable 'syspath', parse_syspath dw 0 ; data for image file loading, look in PrimaryLoader.txt image_file_struct: diff --git a/kernel/trunk/fs/parse_fn.inc b/kernel/trunk/fs/parse_fn.inc index 25c9070b43..cc2dfe5a44 100644 --- a/kernel/trunk/fs/parse_fn.inc +++ b/kernel/trunk/fs/parse_fn.inc @@ -28,6 +28,16 @@ proc Parser_params locals buff rb 4 ; for test cd endl +if defined extended_primary_loader + mov ecx, sysdir_path + mov [ecx-64], dword 'sys' + mov [ecx-2], byte 3 + mov esi, BOOT.syspath + mov edi, sysdir_path-1 + mov ecx, 20 + rep movsb + ret +else mov ax, [BOOT.sys_disk] mov ecx, sysdir_path mov [ecx-64], dword 'sys' @@ -61,6 +71,7 @@ proc Parser_params jne .next_cd @@: ret +end if .hard_disk: sub al, '1' diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index e8dc6526e8..576d4cefa6 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -138,7 +138,11 @@ pci_data_sel = pci_data_32-gdts ; places revision number there. if ~ defined UEFI bootbios: - file 'bootbios.bin' + if ~ defined extended_primary_loader + file 'bootbios.bin' + else + file 'bootbios.bin.ext_loader' + end if if __REV__ > 0 cur_pos = 0 cnt = 0 @@ -697,8 +701,10 @@ endg call PIT_init ; Register ramdisk file system +if ~ defined extended_primary_loader cmp [BOOT.rd_load_from], RD_LOAD_FROM_HD ; will be loaded later je @f +end if cmp [BOOT.rd_load_from], RD_LOAD_FROM_NONE je @f call register_ramdisk @@ -1099,6 +1105,14 @@ boot_log: ret +;----------------------------------------------------------------------------- +; Register ramdisk file system +register_ramdisk: + mov esi, boot_initramdisk + call boot_log + call ramdisk_init + ret + ; in: edx -> APPDATA for OS/IDLE slot ; in: ebx = stack base proc setup_os_slot diff --git a/kernel/trunk/readme-ext-loader.txt b/kernel/trunk/readme-ext-loader.txt index e330ffb5b0..f7e2087b19 100644 --- a/kernel/trunk/readme-ext-loader.txt +++ b/kernel/trunk/readme-ext-loader.txt @@ -48,3 +48,8 @@ biosdisks=<включить доступ к дискам через BIOS> - бу imgfrom=<источник рамдиска>. 1 - грузить дискету, 2 - грузить файл kolibri.img, находящийся рядом с первичным загрузчиком. Умолчальное значение 1 при загрузке с дискеты и 2 в противном случае. + +syspath=<путь к директории /sys> - строка. +Умолчальное значение /RD/1. Может быть и не корнем раздела, например +/HD0/1/KOLIBRIOS. Ядро должно уметь работать с носителем без подгружаемых +драйверов. diff --git a/tup.config.template b/tup.config.template index ee1c0fb107..6d693cc694 100644 --- a/tup.config.template +++ b/tup.config.template @@ -39,7 +39,8 @@ # CONFIG_KERPACK_CMD=&& kerpack %o # CONFIG_PESTRIP_CMD=&& EXENAME=%o fasm $(ROOT)/data/common/pestrip.asm %o -### BUILD_TYPE, if set, enables building kolibri.img and kolibri.iso. +### BUILD_TYPE, if set, enables building kolibri.img, kolibri.iso and +### kolibri.raw. ### Must match subdirectory name in $(ROOT)/data. ### Requires Linux. # CONFIG_BUILD_TYPE=eng