113 lines
2.8 KiB
Markdown
113 lines
2.8 KiB
Markdown
# Bootloader Update Manager
|
|
|
|
A C-based web application for updating kernel, device-tree, and U-Boot environment files on Orange Pi Zero 2W.
|
|
|
|
## Features
|
|
|
|
- **Web Interface**: Modern, responsive UI for easy file management
|
|
- **Kernel Update**: Upload `Image.gz` to boot partition
|
|
- **Device-Tree Update**: Upload `sun50i-h618-orangepi-zero2w.dtb`
|
|
- **U-Boot Environment**: Upload `uboot.env`
|
|
- **extlinux.conf Editor**: View and edit boot configuration
|
|
- **Progress Bar**: Real-time upload progress tracking
|
|
- **Auto-mount**: Automatically mounts `/dev/mmcblk1p1` to `/media`
|
|
- **Large File Support**: Upload files up to 200MB
|
|
|
|
## Requirements
|
|
|
|
- GCC compiler
|
|
- [Mongoose](https://mongoose.ws) - Embedded web server
|
|
- [cJSON](https://github.com/DaveGamble/cJSON) - JSON parser
|
|
- Root privileges (for mounting devices)
|
|
|
|
### Installing Dependencies
|
|
|
|
**Ubuntu/Debian:**
|
|
```bash
|
|
# Install mongoose (or build from source)
|
|
sudo apt-get install libmongoose-dev
|
|
|
|
# Install cJSON
|
|
sudo apt-get install libcjson-dev
|
|
```
|
|
|
|
**Build from source:**
|
|
```bash
|
|
# Mongoose
|
|
git clone https://github.com/cesanta/mongoose.git
|
|
cd mongoose && make && sudo make install
|
|
|
|
# cJSON
|
|
git clone https://github.com/DaveGamble/cJSON.git
|
|
cd cJSON && mkdir build && cd build && cmake .. && make && sudo make install
|
|
```
|
|
|
|
## Building
|
|
|
|
```bash
|
|
make
|
|
```
|
|
|
|
## Running
|
|
|
|
```bash
|
|
sudo make run
|
|
# or
|
|
sudo ./up
|
|
```
|
|
|
|
The server will start on **http://localhost:8080**
|
|
|
|
## API Endpoints
|
|
|
|
| Endpoint | Method | Description |
|
|
|----------|--------|-------------|
|
|
| `/api/upload` | POST | Upload files (kernel, dtb, uboot) |
|
|
| `/api/extlinux` | GET | Read extlinux.conf |
|
|
| `/api/extlinux` | POST | Write extlinux.conf |
|
|
| `/api/progress` | GET | Get upload progress |
|
|
| `/api/mount` | GET | Get mount status |
|
|
|
|
## Upload Parameters
|
|
|
|
For `/api/upload`:
|
|
- `type`: File type (`kernel`, `dtb`, or `uboot`)
|
|
- `file`: The file to upload
|
|
|
|
## File Locations
|
|
|
|
| Type | Destination File |
|
|
|------|------------------|
|
|
| Kernel | `/media/Image.gz` |
|
|
| Device-Tree | `/media/sun50i-h618-orangepi-zero2w.dtb` |
|
|
| U-Boot Env | `/media/uboot.env` |
|
|
| Extlinux | `/media/extlinux.conf` |
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
.
|
|
├── main.c # Main application (C server)
|
|
├── index.html # Web interface HTML
|
|
├── style.css # Web interface styles
|
|
├── app.js # Frontend JavaScript
|
|
├── Makefile # Build configuration
|
|
└── README.md # This file
|
|
```
|
|
|
|
## Screenshots
|
|
|
|
The web interface includes:
|
|
- System status panel showing mount state
|
|
- Tabbed upload interface for different file types
|
|
- Real-time progress bar during uploads
|
|
- Full-featured text editor for extlinux.conf
|
|
|
|
## Security Notes
|
|
|
|
⚠️ **Warning**: This application requires root privileges to mount devices. Use with caution and ensure proper access controls in production environments.
|
|
|
|
## License
|
|
|
|
MIT License
|