Skip to content

Commit

Permalink
- fix the filesystem build procedure for filesystem on the flash device
Browse files Browse the repository at this point in the history
- add a macro to allow selecting the root device at the kernel compile time
- remove blkdiscard as it does not compile
  • Loading branch information
palainp committed Nov 24, 2024
1 parent 9e6066d commit af0d584
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
4 changes: 3 additions & 1 deletion Kernel/platform/platform-esp8266/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ image.elf: kernel.ld addresses.ld $(KOBJS)
$(CROSS_CC) -T kernel.ld -T addresses.ld -flto -mlongcalls -nostdlib -o image.elf \
$(KOBJS)

filesystem.img::
filesystem.img:
./update-flash.sh

filesystem.ftl: filesystem.img
Expand All @@ -81,6 +81,8 @@ filesystem.ftl: filesystem.img

filesystem.elf: filesystem.ftl
xtensa-lx106-elf-objcopy -I binary -O elf32-xtensa-le --change-section-vma .data=0x40220000 filesystem.ftl filesystem.elf
xtensa-lx106-elf-ld -Tdata 0x40220000 -o filesystem2.elf filesystem.elf
mv filesystem2.elf filesystem.elf

fburn: filesystem.elf
esptool elf2image filesystem.elf
Expand Down
20 changes: 15 additions & 5 deletions Kernel/platform/platform-esp8266/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,18 @@ for further file storage and swap.

## Building

The kernel needs to know the boot device, therefore, depending on your setup,
you will need to run one of the following. If your root device is the flash:
```
make TARGET=esp866 kernel diskimage
make TARGET=esp866 DEFAULT_BOOT=hda kernel
```
If your root device in the SD card:
```
make TARGET=esp866 DEFAULT_BOOT=hdb1 kernel diskimage
```
Then you can build the application and the filesystem:
```
make TARGET=esp866 diskimage
```

You need the `xtensa-lx106-elf` gcc toolchain --- install the
Expand Down Expand Up @@ -63,13 +73,13 @@ Remember to also connect the SD card's GND to any ESP8266 GND pin and Vcc to

The console is UART0, and runs at 115200 baud.

Doing `make -C Kernel/platform-esp8266 burn` will flash the kernel onto the device
connected on `/dev/ttyUSB0` with this command:
Doing `make -C Kernel/platform/platform-esp8266 burn` will flash the kernel
onto the device connected on `/dev/ttyUSB0` with this command:

`esptool --port /dev/ttyUSB0 write_flash 0x00000 image.elf-0x00000.bin 0x10000 image.elf-0x10000.bin -ff 80m -fm dio'

Doing `make -C Kernel/platform-esp8266 fburn` will flash the filesystem onto
the device in the same manner.
Doing `make -C Kernel/platform/platform-esp8266 fburn` will flash the
filesystem onto the device in the same manner.

## Swap

Expand Down
7 changes: 7 additions & 0 deletions Kernel/platform/platform-esp8266/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,14 @@ extern uint8_t _code_top[];
/* We need a tidier way to do this from the loader */
#define CMDLINE NULL /* Location of root dev name */

#if DEFAULT_BOOT==hda
#define BOOTDEVICE 0x0000 /* hda */
#elif DEFAULT_BOOT==hdb1
#define BOOTDEVICE 0x0011 /* hdb1 */
#else
#error "You must call make with either DEFAULT_BOOT=hda or DEFAULT_BOOT=hdb1"
#endif

#define SWAPDEV (swap_dev) /* wherever */

#define CONFIG_DYNAMIC_SWAP
Expand Down
4 changes: 2 additions & 2 deletions Kernel/platform/platform-esp8266/update-flash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ cd /bin
bget ../../../Applications/util/banner
bget ../../../Applications/util/basename
bget ../../../Applications/util/bd
bget ../../../Applications/util/blkdiscard
# bget ../../../Applications/util/blkdiscard
bget ../../../Applications/util/cal
bget ../../../Applications/util/cat
bget ../../../Applications/util/chgrp
Expand Down Expand Up @@ -175,7 +175,7 @@ bget ../../../Applications/util/yes
chmod 0755 banner
chmod 0755 basename
chmod 0755 bd
chmod 0755 blkdiscard
# chmod 0755 blkdiscard
chmod 0755 cal
chmod 0755 cat
chmod 0755 chgrp
Expand Down

0 comments on commit af0d584

Please sign in to comment.