sudo apt-get install qemu qemu-user-static binfmt-support
update-binfmts --display
qemu-aarch64 (enabled): ...... qemu-microblaze (enabled): ...... qemu-arm (enabled): ...... qemu-m68k (enabled): ...... qemu-ppc64abi32 (enabled): ...... qemu-sparc64 (enabled): ...... qemu-sparc (enabled): ...... qemu-sh4 (enabled): ...... qemu-sh4eb (enabled): ...... qemu-sparc32plus (enabled): ...... qemu-ppc64 (enabled): ...... qemu-ppc (enabled): ...... qemu-mipsel (enabled): ...... qemu-alpha (enabled): ...... qemu-mips (enabled): ...... qemu-cris (enabled): ...... qemu-s390x (enabled): ...... qemu-armeb (enabled): ......
sudo mkdir ~/rpi_image cd ~/rpi_image sudo wget http://downloads.raspberrypi.org/raspbian/images/raspbian-2015-05-07/2015-05-05-raspbian-wheezy.zip sudo unzip 2015-05-05-raspbian-wheezy.zip sudo rm 2015-05-05-raspbian-wheezy.zip
sudo fdisk -lu 2015-05-05-raspbian-wheezy.img
Disk 2015-05-05-raspbian-wheezy.img: 3276 MB, 3276800000 bytes 255 heads, 63 sectors / tracks, 398 cylinders, total 6,400,000 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical / physical): 512 bytes / 512 bytes I / O size (minimum / optimal): 512 bytes / 512 bytes Disk ID: 0xa6202af7 Device Zagr Start End Blocks Id System 2015-05-05-raspbian-wheezy.img1 8192 122879 57344 with W95 FAT32 (LBA) 2015-05-05-raspbian-wheezy.img2 122880 6399999 3138560 83 Linux
sudo chmod 775 2015-05-05-raspbian-wheezy.img sudo dd if=/dev/zero bs=1M count=1024 >> 2015-05-05-raspbian-wheezy.img
sudo losetup -f --show 2015-05-05-raspbian-wheezy.img sudo losetup -f --show -o $((122880*512)) 2015-05-05-raspbian-wheezy.img
sudo parted /dev/loop0
GNU Parted 2.3 / Dev / loop0 is used Welcome to GNU Parted! Type 'help' to view the list of commands.
(parted) print
Model: Loopback device (loop) Disk / dev / loop0: 4351MB Sector size (logical / physical): 512B / 512B Partition table: msdos Number Start End Size Type File System Flags 1 4194kB 62.9MB 58.7MB primary fat16 lba 2 62.9MB 3277MB 3214MB primary ext4
(parted) rm 2 (parted) mkpart primary 62.9 4351 (parted) print
Model: Loopback device (loop) Disk / dev / loop0: 4351MB Sector size (logical / physical): 512B / 512B Partition table: msdos Number Start End Size Type File System Flags 1 4194kB 62.9MB 58.7MB primary fat16 lba 2 62.9MB 4351MB 4288MB primary ext4
(parted) quit
sudo e2fsck -f /dev/loop1
e2fsck 1.42.9 (4-Feb-2014) Pass 1: Check inodes, blocks, and sizes Pass 2: Checking the structure directory Pass 3: Checking the connectivity directory Pass 4: Checking reference counts Pass 5: Checking group summary information / dev / loop1: 86233/196224 files (0.1% non-contiguous), 630146/784640 blocks
sudo resize2fs /dev/loop1
resize2fs 1.42.9 (4-Feb-2014) Resizing the filesystem on / dev / loop1 to 1046784 (4k) blocks. The filesystem on / dev / loop1 is now 1046784 blocks long.
sudo parted /dev/loop0
GNU Parted 2.3 / Dev / loop0 is used Welcome to GNU Parted! Type 'help' to view the list of commands.
(parted) print
Model: Loopback device (loop) Disk / dev / loop0: 4351MB Sector size (logical / physical): 512B / 512B Partition table: msdos Number Start End Size Type File System Flags 1 4194kB 62.9MB 58.7MB primary fat16 lba 2 62.9MB 4351MB 4288MB primary ext4
(parted) quit
losetup -d /dev/loop0 /dev/loop1
sudo mkdir ~/rpi_mnt sudo mount ~/rpi_image/2015-05-05-raspbian-wheezy.img -o loop,offset=$((122880*512)),rw ~/rpi_mnt
sudo mount ~/rpi_image/2015-05-05-raspbian-wheezy.img -o loop,offset=$((8192*512)),rw ~/rpi_mnt/boot
cd ~/rpi_mnt sudo mount --bind /dev dev/ sudo mount --bind /sys sys/ sudo mount --bind /proc proc/ sudo mount --bind /dev/pts dev/pts
sudo vi ~/rpi_mnt/etc/ld.so.preload
sudo cp /usr/bin/qemu-arm-static ~/rpi_mnt/usr/bin
cd ~/rpi_mnt sudo chroot . bin/bash
uname -a
Linux simm-UX32VD 3.19.0-33-generic # 38 ~ 14.04.1-Ubuntu SMP Fri Nov 6 18:17:28 UTC 2015 armv7l GNU / Linux
sudo raspi-config
apt-get remove --dry-run --auto-remove --purge libx11-.*
sed -i 's/wheezy/jessie/g' /etc/apt/sources.list apt-get update apt-get dist-upgrade -o Dpkg::Options::="--force-confold"
sudo vi ~/rpi_mnt/etc/ld.so.preload
sudo umount ~/rpi_mnt/sys sudo umount ~/rpi_mnt/proc sudo umount ~/rpi_mnt/dev/pts sudo umount ~/rpi_mnt/boot sudo umount ~/rpi_mnt/dev cd .. sudo umount ~/rpi_mnt
sudo fdisk -l sudo dd if=~/rpi_image/2015-05-05-raspbian-wheezy.img of=/dev/mmcblk0
Source: https://habr.com/ru/post/272523/
All Articles