首页 > 编程知识 正文

diskpart命令分区教程,常用的分区命令

时间:2023-05-06 03:05:12 阅读:259328 作者:2535

最近在调试鸿蒙的qemu项目,对于鸿蒙官方给出的qemu构建指导,对一些疑点做了些了解,记录下来避免后续反复产生疑问。

sudo modprobe mtdram total_size=65536 erase_size=256
sudo mtdpart add /dev/mtd0 kernel 0 10223616
sudo mtdpart add /dev/mtd0 kernel 10223616 10485760
sudo mtdpart add /dev/mtd0 root 10485760 56623104
sudo nandwrite -p /dev/mtd1 out/qemu_arm_virt_ca7/OHOS_Image.bin
echo -e “bootargs=root=cfi-flash fstype=jffs2 rootaddr=0xA00000 rootsize=27Mx0” | sudo nandwrite -p /dev/mtd2 -
sudo nandwrite -p /dev/mtd3 out/qemu_arm_virt_ca7/rootfs_jffs2.img
sudo dd if=/dev/mtd0 of=flash.img
sudo chown USERNAME flash.img
sudo rmmod mtdram

以上摘自Qemu ARM Virt 教程
对于modprobe, mtdpart, nandwrite, rmmod四个命令的解释:

modprobe maguangyao@ubuntu-15:~/workspace/code$ modprobe --helpUsage: modprobe [options] [-i] [-b] modulename modprobe [options] -a [-i] [-b] modulename [modulename...] modprobe [options] -r [-i] modulename modprobe [options] -r -a [-i] modulename [modulename...] modprobe [options] -c modprobe [options] --dump-modversions filenameManagement Options: -a, --all Consider every non-argument to be a module name to be inserted or removed (-r) -r, --remove Remove modules instead of inserting --remove-dependencies Also remove modules depending on it -R, --resolve-alias Only lookup and print alias and exit --first-time Fail if module already inserted or removed -i, --ignore-install Ignore install commands -i, --ignore-remove Ignore remove commands -b, --use-blacklist Apply blacklist to resolved alias. -f, --force Force module insertion or removal. implies --force-modversions and --force-vermagic --force-modversion Ignore module's version --force-vermagic Ignore module's version magicQuery Options: -D, --show-depends Only print module dependencies and exit -c, --showconfig Print out known configuration and exit -c, --show-config Same as --showconfig --show-modversions Dump module symbol version and exit --dump-modversions Same as --show-modversionsGeneral Options: -n, --dry-run Do not execute operations, just print out -n, --show Same as --dry-run -C, --config=FILE Use FILE instead of default search paths -d, --dirname=DIR Use DIR as filesystem root for /lib/modules -S, --set-version=VERSION Use VERSION instead of `uname -r` -s, --syslog print to syslog, not stderr -q, --quiet disable messages -v, --verbose enables more messages -V, --version show version -h, --help show this help

modprobe用来加载内核模块,如mtdram模块。mtdram模块加载完成后,会生成一个mtd设备/dev/mtd0。

mtdpart maguangyao@ubuntu-15:~/workspace/code$ mtdpart --helpUsage: mtdpart add [OPTION] <MTD_DEVICE> <PART_NAME> <START> <SIZE> mtdpart del [OPTION] <MTD_DEVICE> <PART_NUMBER>Adds a partition to an MTD device, or remove an existing partition from it. -h, --help Display this help and exit --version Output version information and exitSTART location and SIZE of the partition are in bytes. They should align oneraseblock size.

mtdpart用于给mtd设备添加分区或者删除分区。add的情况下,生成的/dev/mtd1,/dev/mtd2…

nandwrite maguangyao@ubuntu-15:~/workspace/code$ nandwrite --helpUsage: nandwrite [OPTION] MTD_DEVICE [INPUTFILE|-]Writes to the specified MTD device. -a, --autoplace Use auto OOB layout -m, --wxdblbad Mark blocks bad if write fails -n, --noecc Write without ecc -N, --noskipbad Write without bad block skipping -o, --oob Input contains oob data -O, --onlyoob Input contains oob data and only write the oob part -s addr, --start=addr Set output start address (default is 0) -p, --pad Pad writes to page size -b, --blockalign=1|2|4 Set multiple of eraseblocks to align to --input-skip=length Skip |length| bytes of the input file --input-size=length Only read |length| bytes of the input file -q, --quiet Don't display progress messages -h, --help Display this help and exit --version Output version information and exit

写分区,可以是上述添加分区后的设备名,如/dev/mtd1。

rmmod maguangyao@ubuntu-15:~/workspace/code$ rmmod --helpUsage: rmmod [options] modulename ...Options: -f, --force forces a module unload and may crash your machine. This requires Forced Module Removal option in your kernel. DANGEROUS -s, --syslog print to syslog, not stderr -v, --verbose enables more messages -V, --version show version -h, --help show this help

删除内核模块,如mtdram,同时删除/dev/mtd0及其范围内的所有分区。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。