Giter Club home page Giter Club logo

mtd_runtime_partition's Introduction

mtd_runtime_partition

This is some old code I wrote a few years ago to resize MTD partitions on an embedded MPC875 system while Linux is running.

It is based off of Linux MTD Utils and involves a user-space Linux utility and a MTD driver patch. I used the following links as a starting point:

My code assumes the following partition structure:

  • mtd0: linux
  • mtd1: jffs2
  • mtd2: uboot config
  • mtd3: must not initially exist
  1. User provides the hex value for number of bytes by which to expand mtd0.
  2. It works by sending a custom MTDPARTITIONSHIFT message to the driver telling it to move mtd1 over.
  3. The driver actually resizes mtd0 to the desired size, but instead of shrinking mtd1 it creates a new partition mtd3 of the correct start position and size that mtd1 should have been (at the time I could not figure out how to shrink mtd1).

This allowed me to create a script that burned a new image into mtd0 and moved my JFFS2 files over from the original mtd1 to the new mtd3. On restart, the new Linux image contained an updated Device Tree with the new partition boundaries/sizes.

Usage example:

./mtd_runtime_partition 0x200000

For more details see: "Resize MTD partitions at runtime"

Note: I am no longer maintaining this, just posting it in case anyone is trying to tackle a similar issue and need a starting point.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.