Commit 9a05506e authored by SCUCCS-CST-SRA's avatar SCUCCS-CST-SRA
Browse files

Merge branch 'devel-fix-compile-errors' into 'devel'

fix: devel fix compile errors

See merge request scuccs-cst-sra-group/loos!9
parents e3adab46 ba91048d
No related merge requests found
Showing with 17 additions and 332 deletions
+17 -332
1 deleted 100644 → 0
make[1]: Nothing to be done for 'archive'.
make[1]: Nothing to be done for 'archive'.
make[1]: Nothing to be done for 'archive'.
loongarch64-unknown-linux-gnu-ld -T /root/kernel/scripts/loongarch64.lds -m elf64loongarch -o /root/kernel/build/kernel /root/kernel/build/core.a /root/kernel/build/lolibc.a /root/kernel/build/driver.a
loongarch64-unknown-linux-gnu-objcopy -O binary /root/kernel/build/kernel /root/kernel/build/kernel.bin
cp /root/kernel/build/kernel.bin /root/kernel/kernel.bin
make -C tools/ clean
make[1]: Entering directory '/root/kernel/tools'
# sudo qemu-nbd -d /dev/nbd2
rm -f uImage kernel.img kernel.bin
make[1]: Leaving directory '/root/kernel/tools'
make -C tools/
make[1]: Entering directory '/root/kernel/tools'
cp ../build/kernel.bin .
# qemu-img create kernel.bin 2G -f qcow2
# # sudo modprobe nbd maxparts=12
# sudo qemu-nbd -c /dev/nbd2 kernel.bin
# # echo 'label: dos' | sudo sfdisk /dev/nbd5
# # sudo sfdisk -a /dev/nbd5
# echo -e 'n\n\n\n\n\n\nw\nq\n'| sudo fdisk /dev/nbd2
# # sudo parted /dev/nbd2 --script ---pretend-input-tty mklabel msdos mkpart primary ext4 1049kB 2147MB
# sudo mkfs.ext4 /dev/nbd2p1
# sudo mount /dev/nbd2p1 /media
# sudo mkdir /media/boot
# sudo cp /media/boot
# sudo umount /media/boot
# sudo qemu-nbd -d /dev/nbd2
qemu-img create kernel.img 2G -f raw
Formatting 'kernel.img', fmt=raw size=2147483648
mkfs.ext4 kernel.img
Discarding device blocks: 0/524288 done
Creating filesystem with 524288 4k blocks and 131072 inodes
Filesystem UUID: 9337561a-2780-4829-82e8-526ac7fa4fe4
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: 0/16 done
Writing inode tables: 0/16 done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: 0/16 done
mount kernel.img /media
mkdir /media/boot
cp kernel.bin /media/boot/kernel.bin
umount /media
# sudo losetup -fP kernel.img
# sudo losetup -a
# echo -e 'n\n\n\n\n\n\nw\n' | sudo fdisk /dev/loop0
make[1]: Leaving directory '/root/kernel/tools'
cp tools/kernel.img /root/kernel/qemu/2k1000/2kfs.img
clear
scsi reset; load scsi 0:0 0x9000000090000000 /boot/kernel.bin ; go 0x9000000090000000
cd /root/kernel/qemu; ./runqemu
W: /etc/qemu-ifup: no bridge for guest interface found
WARNING: Image format was not specified for './2k1000/u-boot-with-spl.bin' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
WARNING: Image format was not specified for './disk' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
WARNING: Image format was not specified for './2k1000/2kfs.img' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
WARNING: Image format was not specified for './2k1000/sdcard.img' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
hda-duplex: hda_audio_init: cad 0
audio: Could not init `oss' audio driver
ram=0x233bcc0
length=852992 must be 16777216 bytes,run command:
trucate -s 16777216 file
to resize file
oobsize = 64
qemu-system-loongarch64: warning: nic pci-synopgmac.1 has no peer
qemu-system-loongarch64: warning: nic e1000e.0 has no peer
hda-duplex: hda_audio_reset
hda-duplex: hda_audio_reset
intel-hda: intel_hda_update_irq: level 0 [intx]
_ __ __ _ _ ___ ___ __ _ _ / ___ __ \
| | | | | |\ | | __ [__ | | |\ | | | __ | \ |
|___ |__| |__| | \| |__] ___] |__| | \| \ |__] |__/ /
Trying to boot from SPI
U-Boot 2022.04 (Jan 26 2024 - 15:42:00 +0800)
CPU: LA264
Speed: Cpu @ 900 MHz/ Mem @ 400 MHz/ Bus @ 125 MHz
Model: loongson-2k1000
Board: LS2K1000-DP
DRAM: 1 GiB
Core: 74 devices, 20 uclasses, devicetree: board
cam_disable:1, vpu_disable:1, pcie0_enable:0, pcie1_enable:1
Loading Environment from SPIFlash... SF: Detected gd25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment
Cannot get ddc bus
In: serial
Out: serial
Err: serial vidconsole
eth0: using random MAC address - 9a:cf:d9:0b:a6:30
eth1: using random MAC address - 72:08:3e:f4:22:61
Net: eth0: ethernet@40040000, eth1: ethernet@40050000
************************** Notice **************************
Press c to enter u-boot console, m to enter boot menu
************************************************************
Bus otg@40000000: dwc2_usb otg@40000000: Core Release: 0.000
dwc2_usb otg@40000000: SNPSID invalid (not DWC2 OTG device): 00000000
Port not available.
Bus ehci@40060000: USB EHCI 1.00
Bus ohci@40070000: USB OHCI 1.0
scanning bus ehci@40060000 for devices... 3 USB Device(s) found
scanning bus ohci@40070000 for devices... 2 USB Device(s) found
init ls_trigger_boot and set it default value
init ls_trigger_u_kernel and set it default value
init ls_trigger_u_rootfs and set it default value
init ls_trigger_u_uboot and set it default value
Saving Environment to SPIFlash... Erasing SPI flash...Writing to SPI flash...done
OK
Autoboot in 0 seconds
SF: Detected gd25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
device 0 offset 0xf0000, size 0x10000
SF: 65536 bytes @ 0xf0000 Read: OK
Reset SCSI
scanning bus for devices...
Target spinup took 0 ms.
Target spinup took 0 ms.
Target spinup took 0 ms.
SATA link 3 timeout.
SATA link 4 timeout.
SATA link 5 timeout.
AHCI 0001.0000 32 slots 6 ports 1.5 Gbps 0x3f impl SATA mode
flags: 64bit ncq only
Device 0: (0:0) Vendor: ATA Prod.: QEMU HARDDISK Rev: 2.5+
Type: Hard Disk
Capacity: 2048.0 MB = 2.0 GB (4194304 x 512)
Device 1: (1:0) Vendor: ATA Prod.: QEMU HARDDISK Rev: 2.5+
Type: Hard Disk
Capacity: 64.0 MB = 0.0 GB (131072 x 512)
Device 2: (2:0) Vendor: ATA Prod.: QEMU HARDDISK Rev: 2.5+
Type: Hard Disk
Capacity: 64.0 MB = 0.0 GB (131072 x 512)
** No partition table - scsi 0 **
Couldn't find partition scsi 0:1
Can't set block device
Wrong Image Format for bootm command
ERROR: can't get kernel image!
Bootcmd="setenv bootargs ${bootargs} root=/dev/sda${syspart} mtdparts=${mtdparts} video=${video}; sf probe;sf read ${fdt_addr} dtb;scsi reset;ext4load scsi 0:${syspart} ${loadaddr} /boot/uImage;bootm "
Boot Kernel failed. Kernel not found or bad.
=> scsi reset; load scsi 0:0 0x9000000090000000 /boot/kernel.bin ; go 0x9000000090000000
Reset SCSI
scanning bus for devices...
Device 0: (0:0) Vendor: ATA Prod.: QEMU HARDDISK Rev: 2.5+
Type: Hard Disk
Capacity: 2048.0 MB = 2.0 GB (4194304 x 512)
Device 1: (1:0) Vendor: ATA Prod.: QEMU HARDDISK Rev: 2.5+
Type: Hard Disk
Capacity: 64.0 MB = 0.0 GB (131072 x 512)
Device 2: (2:0) Vendor: ATA Prod.: QEMU HARDDISK Rev: 2.5+
Type: Hard Disk
Capacity: 5066549580896269.0 MB = 4947802325094.0 GB (10376293541675558928 x 512)
36296 bytes read in 8 ms (4.3 MiB/s)
## Starting application at 0x9000000090000000 ...
Hello, KMain
Warning: page_size is 0
========== START test_brk ==========
Before alloc,heap pos: 9793
After alloc,heap pos: 9857
Alloc again,heap pos: 9921
========== END test_brk ==========
========== START test_chdir ==========
id: 34, arg1: FFFFFFFFFFFFFF9C, arg2: 25D0, arg3: 1B6
syscall not implemented
========== START test_clone ==========
id: 220, arg1: 11, arg2: 2A98, arg3: 0
syscall not implemented
========== START test_close ==========
close 3 success.
========== END test_close ==========
========== START test_dup ==========
id: 23, arg1: 1, arg2: 2580, arg3: C
syscall not implemented
========== START test_dup2 ==========
--- Assert Fatal ! ---
========== START test_execve ==========
id: 221, arg1: 2550, arg2: 900000009001F740, arg3: 900000009001F738
syscall not implemented
========== START test_exit ==========
id: 220, arg1: 11, arg2: 0, arg3: C
syscall not implemented
========== START test_fork ==========
id: 220, arg1: 11, arg2: 0, arg3: C
syscall not implemented
========== START test_fstat ==========
-1 -1
0xFFFFFFFFFFFFFFFF
buf->st_size: 15968256
fstat ret: -1
--- Assert Fatal ! ---
========== START test_getcwd ==========
getcwd: successfully!
========== END test_getcwd ==========
@@ ========== START test_getpid ==========
getpid success.
pid = 13
========== END test_getpid ==========
========== START test_getppid ==========
getppid success. ppid : 14
========== END test_getppid ==========
========== START test_gettimeofday ==========
id: 169, arg1: 900000009001F720, arg2: 0, arg3: C
syscall not implemented
========== START test_mkdir ==========
id: 34, arg1: FFFFFFFFFFFFFF9C, arg2: 25E0, arg3: 1B6
syscall not implemented
========== START test_mmap ==========
-1 -1
file len: 0
mmap content:
id: 215, arg1: 9000000093629030, arg2: 0, arg3: 1
syscall not implemented
Directory: mnt
-1 -1
========== START test_mmap ==========
-1 -1
file len: 0
mmap content:
id: 215, arg1: 9000000093629040, arg2: 0, arg3: 1
syscall not implemented
-1 -1
========== START test_mmap ==========
-1 -1
file len: 0
mmap content:
id: 215, arg1: 9000000093629050, arg2: 0, arg3: 1
syscall not implemented
========== START test_mount ==========
Mounting dev:/dev/vdb to ./mnt
id: 40, arg1: 2700, arg2: 2740, arg3: 2678
syscall not implemented
========== START test_munmap ==========
-1 -1
file len: 0
id: 215, arg1: 9000000093629060, arg2: 0, arg3: 3
syscall not implemented
========== START test_open ==========
-1 -1
--- Assert Fatal ! ---
========== START test_openat ==========
-1 -1
open dir fd: -1
-1 -1
openat fd: -1
--- Assert Fatal ! ---
========== START test_pipe ==========
id: 59, arg1: 26C8, arg2: 0, arg3: 80
syscall not implemented
========== START test_read ==========
-1 -1
--- Assert Fatal ! ---
========== START test_sleep ==========
id: 169, arg1: 900000009001F730, arg2: 0, arg3: C
syscall not implemented
========== START test_statx ==========
statx ret: 0
statx: dev: 0, inode: 0, mode: 0, size: 0, atime: 0, mtime: 0, ctime: 0
========== END test_statx ==========
Directory: test_chdir
I am test_echo.
execve success.
========== END main ==========
Directory: test_mkdir
-1 -1
I am test_echo.
execve success.
========== END main ==========
========== START test_times ==========
id: 153, arg1: 2628, arg2: 2590, arg3: C
syscall not implemented
========== START test_umount ==========
Mounting dev:/dev/vda2 to ./mnt
id: 40, arg1: 26D8, arg2: 2718, arg3: 2660
syscall not implemented
========== START test_uname ==========
Uname: Linux localhost 5.10.149 #1 SMP PREEMPT Tun Jan 31 05:44:42 UTC 2023 LoongArch64
========== END test_uname ==========
========== START test_unlink ==========
-1 -1
--- Assert Fatal ! ---
========== START test_wait ==========
id: 220, arg1: 11, arg2: 0, arg3: C
syscall not implemented
========== START test_waitpid ==========
id: 220, arg1: 11, arg2: 0, arg3: C
syscall not implemented
========== START test_write ==========
Hello operating system contest.
========== END test_write ==========
========== START test_yield ==========
id: 220, arg1: 11, arg2: 0, arg3: C
syscall not implemented
File deleted
......@@ -9,9 +9,9 @@ SECTIONS
.text : {
*(._start)
*(.text)
. = ALIGN(0x4000);
_tlbrentry = .;
*(tlbrentry)
. = ALIGN(0x1000);
*(tlbentry)
}
. = ALIGN(16);
......@@ -28,11 +28,13 @@ SECTIONS
_stack_top = ALIGN(16);
. = _stack_top + 0x4000;
_stack_pointer = .;
end = .;
_end = .;
_heap_start = ALIGN(0x4000);
_heap_start = ALIGN(0x1000);
_heap_end = _heap_start + 0x20000;
kernel_end = .;
_kernel_end = .;
kernel_end = .;
}
......@@ -187,16 +187,16 @@ static inline uint32_t r_csr_stlbps() {
asm volatile("csrrd %0, 0x1e" : "=r" (x) );
return x;
}
static inline void w_csr_stlbps(uint32_t x) {
asm volatile("csrwr %0, 0x1e" : : "r" (x));
}
static inline uint64_t r_csr_tlbrera() {
uint64_t x;
asm volatile("csrrd %0, 0x89" : "=r" (x) );
return x;
}
// static inline void w_csr_stlbps(uint32_t x) {
// asm volatile("csrwr %0, 0x1e" : : "r" (x));
// }
//
//
// static inline uint64_t r_csr_tlbrera() {
// uint64_t x;
// asm volatile("csrrd %0, 0x89" : "=r" (x) );
// return x;
// }
static inline uint64_t r_csr_tlbrbadv() {
uint64_t x;
asm volatile("csrrd %0, 0x89" : "=r" (x) );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment