I am finishing a project in raspberry pi 1 b+, and I would like to clone your raspbian operating system, with all the configurations, installations and files, that you now have installed, in order to record this image in another memory, as a backup in case of that the memory that has rpi fails,
how could i do it? Thanks in advance
Here's one way:
Power off your Raspberry Pi.
Remove the SD card and put it in a PC running Linux or a Mac.
Use dd to read the entire SD card into a file (disk image) on that PC. This may take a few minutes, depending on the capacity/speed of your SD card and the speed of your PC.
The command will look something like:
sudo dd if=/dev/XXXXX bs=65536 > RaspberryPiImage.bin
where XXXXX is whatever is the furthest from a in the list sda, sdb, sdc through sdz.
Check the size of the file RaspberryPiImage.bin corresponds to the full capacity of your SD card. So if your SD card is 16GB, you should see close to 16GB if you run:
ls -lh RaspberryPiImage.bin
You'll probably want to compress the image as it will almost certainly be a) large and b) readily compressible.
You could use:
gzip RaspberryPiImage.bin
Related
I've recently been getting into bare metal development for the Raspberry Pi 2, and having some success. Admittedly I've hesitated to buy an actual physical device until I feel I can do something useful with it, for the time being I've been emulating the device using qemu 2.11.0.
So far I've developed multicore capabilities for my kernel, as well as simple Serial I/O, but I feel I'd like to get much further before working with a physical device.
My issue right now is that I'm trying to learn how to place my kernel onto an SD card image and boot qemu-system-arm from that SD card image, so I can properly emulate a kernel loaded from the raspberry pi 2 bootloader.
I've gotten as far as grabbing the SD card contents from https://github.com/raspberrypi/firmware ... aster/boot, and using the following script to create the image and load my kernel into it. I've seen that people have figured out how to load Raspbian from an emulated SD card, so I figure I can do the same.
#!/bin/bash
OUTPUT_IMG=os.img
OUTPUT_IMG_SIZE=40
TEMP_MOUNT_DIR="$(mktemp -d)"
# the SD card boot partition contents are in this folder...
OUTPUT_IMG_CONTENTS_DIR="./sd"
OS_DIR="${HOME}/os"
OS_BINARY="${OS_DIR}/kernel.bin"
dd if=/dev/null of=${OUTPUT_IMG} bs=1M seek=${OUTPUT_IMG_SIZE}
mkfs.fat -F 32 ${OUTPUT_IMG}
sudo mount -t vfat -o loop ${OUTPUT_IMG} ${TEMP_MOUNT_DIR}
make -C ${OS_DIR} clean
make -C ${OS_DIR}
sudo cp -r ${OUTPUT_IMG_CONTENTS_DIR} ${TEMP_MOUNT_DIR}
sudo cp ${OS_BINARY} "${TEMP_MOUNT_DIR}/kernel.img"
The only issue is that qemu doesn't seem to boot from this image using the following command:
qemu-system-arm -machine raspi2 -serial file:serial.log -sd ./dev/os.img
I've tried a few different combinations, but to no avail.
I can see from hooking GDB that the kernel is simply not booting from this card image. Loading the kernel directly into qemu with the -kernel argument works otherwise perfectly.
I was wondering if anyone here had any insight on how to accomplish this!
Any help here would be greatly appreciated!
Your command won't work because you haven't passed QEMU either a guest BIOS or a guest kernel to run. The QEMU arm boards aren't like the x86 PC machine, which always automatically runs a guest BIOS image. If you want to run a BIOS (probably UEFI?) you need to find a suitable BIOS blob and pass it to QEMU with the -bios argument. Then QEMU will run the BIOS code, which will hopefully include SD card drivers to load the kernel and so on off the SD card.
Just using -kernel is much simpler...
After doing a bit of reading and searching online, as well as a bit of help from other contributors such as Peter Maydell with his answer above, I think I've answered my own question. Unless I'm mistaken qemu-system-arm does not fully emulate the Raspberry Pi boot process, and instead just loads the kernel specified with the -kernel argument by loading the binary into the guest system's memory and jumping to the entry point. It doesn't look like any additional hardware bootloading is emualted for -M raspi2 unfortunately.
Can ARM qemu system emulator boot from card image without kernel param?
This question is similar and contains some more useful details on this issue, relating to qemu-system-arm as a whole..
I have a raspberry pi with raspbian and a 32gb SD card. I need it to run a bash script 24/7, but the script runs for 20-30 minutes and then it stops. And when I reboot the raspberry, it won't load the desktop and this https://i.stack.imgur.com/b165r.jpg shows up. It seems that this is because there isn't enough memory. I guessed it's because of the cache (the script has to open a window in chromium). How can I delete it? Is there a way to do it every time at the end of the script? What else could it be? Thanks.
This is what happens when I do apt-get purge anything to free up some space
https://i.stack.imgur.com/5F0FM.jpg
And this is what happens when I write df -h... It says that the system is full but how the heck is that possible???
https://i.stack.imgur.com/L8uvM.jpg
I am trying to build beaglebone black wifi with buildroot but it seems that there are several configuration , for u-boot and kernel.
What is the right def config , am335-evm or omap3-beagle for BBB wireless?
What is the right kernel and def config for BBB wireless?
U-boot should be the target image format u-boot.bin or u-boot.img?
Does anyone has a git repo of a working beaglebone black ( wireless or not) working?
What are the minimum uEnv.txt settings to get u-boot start working?
Thanks!
You can use beaglebone_defconfig configuration file:
make beaglebone_defconfig
It enables support for multiple am335x boards like BBB, am335x-evm etc. This BR configuration provides U-Boot and U-Boot's internal scripts would read the board ID and load corresponding device tree blob. At the end of the build process you'll get a SD card image, that you can directly burn onto your SD card.
The only things missing are WiLink firmware and wpa_supplicant. Just select following packages in BR's menuconfig:
BR2_PACKAGE_WILINK_BT_FIRMWARE
BR2_PACKAGE_WPA_SUPPLICANT
Ok, so it does work, but i was waited to see on the HDMI the login.
After I connected UART using this post:
https://codechief.wordpress.com/2013/11/11/beaglebone-black-serial-debug-connection/ ( but i did replace tx and rx)
Pressed the S2 button i do see the linux prompt.
I have a trouble build OpenWrt with SD card.
I download the source, git://github.openwrt.org/openwrt.git and run "make menuconfig", set target "brcm27xx", "brcm2710", "Raspberry Pi 3 Model B".
And finish the configuration, build success.
Using "sudo dd if=openwrt....img of=/dev/sdb bs=2M", I create SD card.
When I boot Raspberry Pi 3 with creating SD card, the Kernel message with error.
run "mount"
/dev/root/ type ext4 ro(read-only) file system.
What is the problem!! Because of this I can not do anything...
Please Help me...
I have been using dd for a while now and it is both very powerful and very unforgiving, in the sense that your console will suggest the writing of the image is concluded but in actuality it has not. My images constantly failed for much the same reason as yours so now use my alternative command line, see below....
sudo dd if=openwrt....img of=/dev/sdb bs=2M
Here is my suggestion
sudo dd if=openwrt....img of=/dev/sdb bs=4096 conv=sync,notrunc status=progress; sudo sync
the last command may be unnecessary as sync is defined within dd command line. remember all of the above is one a line command not two wrap is ok I hope this helps you
This question is almost a year old and people might come across this in the future.
To run OpenWRT/LEDE on Raspberry Pi, you need to flash an image on a microSD. You may download the images through this link(Just search for the particular RPi Model): https://openwrt.org/toh/views/toh_fwdownload
Then from personal experience, I use Etcher to flash the image on the microSD. You may download it through this link: https://etcher.io/
Hope this helps someone out there. :)
I'm currently installing virtual box, and one of the steps requires that I add a disk image (in my case, an ubuntu ISO file) to a virtual CD/DVD drive listed under the virtual machines Storage.
From what I understand the ISO basically contains all the contents of ubuntu. And once I've allocated enough disk space for my virtual machine, I need to install ubuntu by reading from this ISO file into my virtual hard drive.
So- is that the reason why I need to add the ISO image to my dvd/cd? Because it acts as an ACTUAL cd/dvd? My understanding is limited - I just want more clarification about this process!
.iso files are images of the entire content of a CD. They are meant to be burnt on a actual CD. But there are now several programs allowing to read the content of an .iso file without actually writing the data to a CD.
You're right in everything you said.
Virtual Box simulates (almost) everything of a real computer: disks, drives, memory, USB ports...
The drive is initially empty, i.e. has no CD/DVD inside.
Then you choose which CD should be simulated inside the drive. It can be either the actual CD on your physical machine, or a CD image, i.e. a .iso file.
When some program inside the virtual machine wants to access the data written on what it thinks is the CD, Virtual Box reads the .iso file and answer the program, as if the data came from a CD.
Virtual box uses virtual drives. These drives act as 'actual' drives on the guest OS, in your case Ubuntu would be the guest OS.
When you create a new virtual machine, it is clean, nothing has been installed yet.
In order to install Ubuntu on the machine you will need to load the ISO image into the virtual CD/DVD drive to install it.
Note: A ISO is a 'disk image' that contains the entire contents of a disk in a single file, that can be loaded into virtual drives, or burned to physical CD/DVDs
Here is a small tutorial on install Ubuntu to virtual box, the screen shots may differ a little bit, but the process will generally be the same for you.
http://osxdaily.com/2012/03/27/install-run-ubuntu-linux-virtualbox/