Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Commit

Permalink
change readonly to readwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
Cédric Verstraeten committed Mar 11, 2016
1 parent 35d196b commit cc75df3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion board/raspberrypi/cmdline.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dwc_otg.fiq_fix_enable=1 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait ro rootflags=noload panic=10 quiet loglevel=1
dwc_otg.fiq_fix_enable=1 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw rootflags=noload panic=10 quiet loglevel=1
2 changes: 1 addition & 1 deletion board/raspberrypi2/cmdline.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dwc_otg.fiq_fix_enable=1 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait ro rootflags=noload panic=10 quiet loglevel=1
dwc_otg.fiq_fix_enable=1 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw rootflags=noload panic=10 quiet loglevel=1

16 comments on commit cc75df3

@ccrisan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure you want to mount the root filesystem read-write?

@cedricve
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I enabled this because the images and configuration files are located at /etc/opt by default. Maybe it will be better to move them to the /data directory, and revert it to ro. What do you think?

@ccrisan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved all /etc stuff that needs updating to /data/etc. In fact the only writable partition is /data. / and /boot are always read/only to prevent corruption and to allow automatic updates which overwrite the entire partition (similar to android in a way).

@cedricve
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I see good point, how and where in the project do perform a kernel update?

@ccrisan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The kernel is updated along with the entire OS image.

@cedricve
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a stupid question, but I don't see where you create or move specific files to the /data file. I only see the cleanup and postbuild scripts.

@ccrisan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a stupid question at all. It's part of the motionEye package in fact (due to some legacy-related reasons).

But the procedure can be implemented in whatever language/script you think it's best:

  1. download the gzipped image from whatever hardcoded link you decide to use
  2. extract the image somewhere to /data
  3. using fdisk, determine the boundaries of the boot and root partitions
  4. extract the two filesystem images from the whole image (let's call them boot.img, root.img)
  5. stop any services that may reboot the system (so-called software watchdogs)
  6. RPi only: back up the /boot/config.txt file so that board-level settings can be preserved across updates
  7. use dd to write the boot.img file to /dev/mmcblk0p1
  8. restore the /boot/config.txt from backup
  9. configure a temporary initramfs in /boot/config.txt so that the root partition is upgraded at next boot
  10. the fwupdater.gz initramfs image will use dd to write the root.img file to /dev/mmcblk0p2
  11. remove the initramfs setting from /boot/config.txt so that the system will boot normally
  12. issue a final reboot
  13. execute any post-upgrade scripts from /usr/share/post-upgrade

@cedricve
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System is now read-only again, all files that need to be modified are moved to the data directory

  • /data/web/
  • /data/machinery

@cedricve
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ccrisan I have reviewed the update process, and I must say congrats :) I will try to put it in a simple bash script (or did you already do that?) so I can call it from the webinterface.

I see (and understand) what you're doing but you've lost me at point 10 untill 13. Where can I see the functionality of those last four steps.

@ccrisan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's all embedded into fwupdater.gz. Download it, unpack it, enter the rootfs.cpio archive and you'll see the /init script. In fact the kernel normally executes the /init binary found in the root of the root partition unless otherwise told. This script will simply do what points 10, 11 and 12 say.

@cedricve
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks that makes sense 👍

@cedricve
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ccrisan I have a question regarding: 13. execute any post-upgrade scripts from /usr/share/post-upgrade

Does it really executes every script in the directory or does it search for a script with the same name of the version to which it is upgraded?

@ccrisan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does what you would normally expect it to do: it executes all scripts from the former version to the newly updated version, in order.

@cedricve
Copy link
Member

@cedricve cedricve commented on cc75df3 Jun 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you mark your releases with dates it sounds logical However I tag the version with 1.0.0, what will happen then? Does it do an integer comparison?

@ccrisan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cedricve
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great 👍 thanks @ccrisan

Please sign in to comment.