en:bpi-r2:storage
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
en:bpi-r2:storage [2019/07/31 14:39] – [preloader] frank | en:bpi-r2:storage [2023/06/08 17:06] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Storage ====== | ||
+ | {{: | ||
+ | image by garywang | ||
+ | it looks like / | ||
+ | |||
+ | ===== preloader ===== | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | sudo dd if=BPI-R2-EMMC-boot0-DDR1600-20190722-2k.img of=/dev/sdc bs=1k seek=2 | ||
+ | |||
+ | (SD-Card needs additional MMC_BOOT & BRLYT header, see below) | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | sudo dd if=BPI-R2-EMMC-boot0-DDR1600-20190722-0k.img of=/ | ||
+ | |||
+ | new preloaderfiles from here: https:// | ||
+ | |||
+ | ===== SD-Card ===== | ||
+ | |||
+ | sdcard-bootsektor reverse-engineering | ||
+ | [[http:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | * SDMMC_BOOT-Signatur + address of 2nd header (0x00000200) - first 440 byte (before partitiontable): | ||
+ | |||
+ | gunzip -c BPI-R2-HEAD440-0k.img.gz | dd of=/ | ||
+ | |||
+ | * BRLYT-signature + preloader-Address (0x00000800): | ||
+ | |||
+ | gunzip -c BPI-R2-HEAD1-512b.img.gz | dd of=/ | ||
+ | |||
+ | ==== short install-guide ==== | ||
+ | |||
+ | this guide is derived from user ul90 but using a fixed partition table (existing image/ | ||
+ | |||
+ | dd if=/ | ||
+ | loopdev=$(losetup -f) | ||
+ | sudo losetup ${loopdev} ../ | ||
+ | echo $loopdev | ||
+ | sudo dd if=~/ | ||
+ | sudo dd if=~/ | ||
+ | sudo dd if=~/ | ||
+ | sudo dd if=/ | ||
+ | sudo sfdisk ${loopdev} < ~/ | ||
+ | sudo partprobe ${loopdev} | ||
+ | ls ${loopdev}* | ||
+ | sudo mkfs -t vfat ${loopdev}p1 | ||
+ | sudo mkfs -t ext4 ${loopdev}p2 | ||
+ | sudo fatlabel ${loopdev}p1 BPI-BOOT | ||
+ | sudo e2label ${loopdev}p2 BPI-ROOT | ||
+ | |||
+ | install debian (from [[debian# | ||
+ | |||
+ | sudo mount ${loopdev}p2 /mnt/ | ||
+ | sudo cp -r debian_buster_armhf/ | ||
+ | #install kernel-modules to same partition | ||
+ | kernelpack=/ | ||
+ | sudo tar -xzf ${kernelpack} -C /mnt/ --strip-components=1 BPI-ROOT | ||
+ | #install kernel to boot-partition | ||
+ | sudo umount /mnt | ||
+ | sudo mount ${loopdev}p1 /mnt/ | ||
+ | sudo tar -xzf ${kernelpack} -C /mnt/ --strip-components=1 BPI-BOOT | ||
+ | #maybe create a uEnv.txt | ||
+ | sudo umount /mnt | ||
+ | |||
+ | sudo losetup -d ${loopdev} | ||
+ | #now write the image to card (make sure /dev/sdc is your sdcard-device and no partition is mounted) | ||
+ | sudo dd if=../ | ||
+ | sync | ||
+ | |||
+ | |||
+ | ==== Step-by-Step-Guide from " | ||
+ | |||
+ | === 1. download binary files: === | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | === 2. Create image file (8GB): === | ||
+ | |||
+ | dd if=/ | ||
+ | |||
+ | === 3. Load image as virtual drive: === | ||
+ | |||
+ | losetup /dev/loop8 bpir2.img | ||
+ | |||
+ | === 4. Make partitions and format: === | ||
+ | |||
+ | <code bash> | ||
+ | parted -s /dev/loop8 mklabel msdos | ||
+ | parted -s /dev/loop8 unit MiB mkpart primary fat32 -- 100MiB 356MiB | ||
+ | parted -s /dev/loop8 unit MiB mkpart primary ext2 -- 356MiB 7295MiB | ||
+ | partprobe /dev/loop8 | ||
+ | mkfs.vfat / | ||
+ | mkfs.ext4 -O ^has_journal -E stride=2, | ||
+ | sync | ||
+ | parted -s /dev/loop8 print | ||
+ | </ | ||
+ | |||
+ | === 5. extended boot-headers === | ||
+ | |||
+ | * SDMMC_BOOT-signature + address of 2nd header 0x00000200 (before partition-table): | ||
+ | |||
+ | gunzip -c BPI-R2-HEAD440-0k.img.gz | dd of=/ | ||
+ | |||
+ | * BRLYT-signature + preloader-address (0x00000800): | ||
+ | |||
+ | gunzip -c BPI-R2-HEAD1-512b.img.gz | dd of=/ | ||
+ | |||
+ | === 6. Write preloader and u-boot bootloader: === | ||
+ | |||
+ | dd if=preloader_iotg7623Np1_sd_1600M.bin of=/ | ||
+ | dd if=u-boot.bin of=/ | ||
+ | sync | ||
+ | === 7. Copy rootfs + kernel === | ||
+ | |||
+ | create bootstraped rootfs | ||
+ | |||
+ | * [[Ubuntu]] | ||
+ | * [[Debian]] | ||
+ | |||
+ | Install Kernel: | ||
+ | |||
+ | [[Kernel# | ||
+ | === 8. Remove loop device: === | ||
+ | |||
+ | losetup -d /dev/loop8 | ||
+ | |||
+ | ===== MMC-Utils ===== | ||
+ | |||
+ | with the [[https:// | ||
+ | |||
+ | < | ||
+ | .... | ||
+ | Boot configuration bytes [PARTITION_CONFIG: | ||
+ | ....</ | ||
+ | |||
+ | i have added the mmc-utils also to [[https:// | ||
+ | |||
+ | a forum user give me the tip [[http:// | ||
+ | |||
+ | ./mmc bootpart enable 1 1 / | ||
+ | |||
+ | < | ||
+ | [18:02] root@bpi-r2: | ||
+ | Boot configuration bytes [PARTITION_CONFIG: | ||
+ | [18:02] root@bpi-r2: | ||
+ | [18:03] root@bpi-r2: | ||
+ | Boot configuration bytes [PARTITION_CONFIG: | ||
+ | </ | ||
+ | ===== install OS on EMMC ===== | ||
+ | |||
+ | http:// | ||
+ | |||
+ | - [[uboot# | ||
+ | - activate write mode / | ||
+ | - write preloader from [[https:// | ||
+ | * < | ||
+ | * with [[https:// | ||
+ | - copy of OS-image to EMMC (device=/ | ||
+ | * < | ||
+ | dd if=deb_stretch_emmc.img of=/ | ||
+ | * < | ||
+ | * alternate (with [[https:// | ||
+ | - poweroff, remove SD card and boot again | ||
+ | |||
+ | if sd-card-image does not fit emmc: [[https:// | ||
+ | |||
+ | ===== manual copy of OS ===== | ||
+ | |||
+ | * if you want bootable sdcard,you need to copy first 2k from existing sd-image/ | ||
+ | * {{ : | ||
+ | dd if=bpi-r2-sd-boot1m.img of=/dev/sdx | ||
+ | sync | ||
+ | #remove card after " | ||
+ | sudo mkfs -t vfat /dev/sdx1 | ||
+ | sudo mkfs -t ext4 /dev/sdx2 | ||
+ | #set filesystem-labels, | ||
+ | sudo mlabel -i /dev/sdx1 ::BPI-BOOT | ||
+ | sudo tune2fs -L BPI-ROOT /dev/sdx2 | ||
+ | </ | ||
+ | * install uboot (not needed if bpi-r2-sd-boot1m.img is flashed):< | ||
+ | * export partitiontable from SD {{ : | ||
+ | root@bpi-r2: | ||
+ | </ | ||
+ | * check/ | ||
+ | * create filesystems (mkfs) for p1=vfat (apt-get install dosfstools) and p2=ext4 (here emmc)< | ||
+ | mkfs -t ext4 / | ||
+ | * create+configure mount-points in existing system< | ||
+ | mkdir -p / | ||
+ | nano /etc/fstab | ||
+ | # <file system> | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | * mount it:< | ||
+ | mount / | ||
+ | mount / | ||
+ | </ | ||
+ | * unpack bootstrapped debian or copy full rootfs from sdcard< | ||
+ | </ | ||
+ | * copy kernel (p1) and modules (p2)< | ||
+ | cp / | ||
+ | mkdir -p / | ||
+ | cp -r / | ||
+ | * configure uboot to load kernel from right partition< |
en/bpi-r2/storage.txt · Last modified: 2023/06/08 17:06 by 127.0.0.1