Simplify partition setup
To prepare part1 for grub, part2 for userdata
This commit is contained in:
parent
f05e017d45
commit
f110f85498
2
Makefile
2
Makefile
@ -65,7 +65,7 @@ disk.img: disk.sfdisk userspace
|
|||||||
# Before having filesystem support, just dump the user prog into the first partition
|
# Before having filesystem support, just dump the user prog into the first partition
|
||||||
strip userspace/user -o userspace/user.strip
|
strip userspace/user -o userspace/user.strip
|
||||||
$(eval file_size:=$(shell du -b userspace/user.strip|awk '{print $$1}' | xargs printf "%016d" )) \
|
$(eval file_size:=$(shell du -b userspace/user.strip|awk '{print $$1}' | xargs printf "%016d" )) \
|
||||||
sed '1s/^/$(file_size)/' userspace/user.strip | dd of=disk.img seek=2048 bs=512
|
sed '1s/^/$(file_size)/' userspace/user.strip | dd of=disk.img seek=34816 bs=512
|
||||||
|
|
||||||
# NASM without preprocessing
|
# NASM without preprocessing
|
||||||
%.o:%.asm
|
%.o:%.asm
|
||||||
|
@ -45,7 +45,7 @@ void idleThread(void *arg)
|
|||||||
#define FILE_MAX_SIZE 64 // In nb of sectors
|
#define FILE_MAX_SIZE 64 // In nb of sectors
|
||||||
void loadUserSpace()
|
void loadUserSpace()
|
||||||
{
|
{
|
||||||
struct ata_partition *part = ATAGetPartition(0);
|
struct ata_partition *part = ATAGetPartition(1);
|
||||||
|
|
||||||
if (part == NULL) {
|
if (part == NULL) {
|
||||||
printf("No user partition found\n");
|
printf("No user partition found\n");
|
||||||
@ -72,8 +72,8 @@ void loadUserSpace()
|
|||||||
sectorToRead = DIV_ROUND_UP(sizeInt, DISK_SECTOR_SIZE) - 1;
|
sectorToRead = DIV_ROUND_UP(sizeInt, DISK_SECTOR_SIZE) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sectorToRead > FILE_MAX_SIZE - 1) {
|
if (sectorToRead > FILE_MAX_SIZE - 1 || sectorToRead <= 0) {
|
||||||
printf("File too long");
|
printf("Invalid file size: %d (sector)\n", sectorToRead);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,5 @@ device: disk.img
|
|||||||
unit: sectors
|
unit: sectors
|
||||||
sector-size: 512
|
sector-size: 512
|
||||||
|
|
||||||
disk.img1 : start= 2048, size= 10240, type=83
|
disk.img1 : start= 2048, size= 32768, type=6, bootable
|
||||||
disk.img2 : start= 12288, size= 10240, type=b
|
disk.img2 : start= 34816, size= 30720, type=83
|
||||||
disk.img3 : start= 22528, size= 43008, type=e
|
|
||||||
|
Loading…
Reference in New Issue
Block a user