* Updating the root partition @ 2002-06-19 15:18 Chris AtLee 2002-06-19 22:23 ` Jörn Engel 0 siblings, 1 reply; 9+ messages in thread From: Chris AtLee @ 2002-06-19 15:18 UTC (permalink / raw) To: Linux MTD [-- Attachment #1: Type: text/plain, Size: 355 bytes --] Hi, I've got linux booting off of a cramfs partition sitting on mtdblock1. Is it possible to overwrite the mtdblock1 partition while linux is running? The kernel itself isn't located on the root partition. I've tried just copying a new cramfs image to /dev/mtd1 but I get errors on decompressing next time I try and boot. Cheers, Chris [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Updating the root partition 2002-06-19 15:18 Updating the root partition Chris AtLee @ 2002-06-19 22:23 ` Jörn Engel 2002-06-19 22:44 ` Russ Dill 0 siblings, 1 reply; 9+ messages in thread From: Jörn Engel @ 2002-06-19 22:23 UTC (permalink / raw) To: Chris AtLee; +Cc: Linux MTD On Wed, 19 June 2002 11:18:12 -0400, Chris AtLee wrote: > I've got linux booting off of a cramfs partition sitting on mtdblock1. > Is it possible to overwrite the mtdblock1 partition while linux is > running? The kernel itself isn't located on the root partition. I've > tried just copying a new cramfs image to /dev/mtd1 but I get errors on > decompressing next time I try and boot. - Use /dev/mtdblock1. The char device does not erase any blocks, so you end up ||ing the old and new data. - Do the flashing soon after reboot and make sure, all necessary binaries are in RAM. Power-cycle afterwards, as you sure don't want to load good-as-random code and execute it, albeit it is only the userspace. Jörn -- Premature optimization is the root of all evil. -- Donald Knuth ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Updating the root partition 2002-06-19 22:23 ` Jörn Engel @ 2002-06-19 22:44 ` Russ Dill 2002-06-19 23:22 ` Christopher Fowler 0 siblings, 1 reply; 9+ messages in thread From: Russ Dill @ 2002-06-19 22:44 UTC (permalink / raw) To: Jörn Engel; +Cc: Chris AtLee, Linux MTD On Wed, 2002-06-19 at 15:23, Jörn Engel wrote: > On Wed, 19 June 2002 11:18:12 -0400, Chris AtLee wrote: > > I've got linux booting off of a cramfs partition sitting on mtdblock1. > > Is it possible to overwrite the mtdblock1 partition while linux is > > running? The kernel itself isn't located on the root partition. I've > > tried just copying a new cramfs image to /dev/mtd1 but I get errors on > > decompressing next time I try and boot. > > - Use /dev/mtdblock1. The char device does not erase any blocks, so > you end up ||ing the old and new data. > - Do the flashing soon after reboot and make sure, all necessary > binaries are in RAM. Power-cycle afterwards, as you sure don't want > to load good-as-random code and execute it, albeit it is only the > userspace. if you are using busybox init, you can signal it to kill everything, and exec run the respawn entry in inittab. Your respawn entry can copy a statiacly linked copy of whatever you are using to flash to a ramfs, chroot/piviot_root to the ramfs and exec the program. once there, umount the cramfs, and you can safely do whatever you want. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Updating the root partition 2002-06-19 22:44 ` Russ Dill @ 2002-06-19 23:22 ` Christopher Fowler 2002-06-19 23:29 ` Russ Dill 0 siblings, 1 reply; 9+ messages in thread From: Christopher Fowler @ 2002-06-19 23:22 UTC (permalink / raw) To: Russ Dill; +Cc: Jörn Engel, Chris AtLee, Linux MTD Going into a pseudo single user mode to flash is not acceptable. You need to be able to flash from any tty. From any web interface. From any command. My unit will flash with a simple flash command while the system is running. Chris On Wed, 2002-06-19 at 18:44, Russ Dill wrote: > On Wed, 2002-06-19 at 15:23, Jörn Engel wrote: > > On Wed, 19 June 2002 11:18:12 -0400, Chris AtLee wrote: > > > I've got linux booting off of a cramfs partition sitting on mtdblock1. > > > Is it possible to overwrite the mtdblock1 partition while linux is > > > running? The kernel itself isn't located on the root partition. I've > > > tried just copying a new cramfs image to /dev/mtd1 but I get errors on > > > decompressing next time I try and boot. > > > > - Use /dev/mtdblock1. The char device does not erase any blocks, so > > you end up ||ing the old and new data. > > - Do the flashing soon after reboot and make sure, all necessary > > binaries are in RAM. Power-cycle afterwards, as you sure don't want > > to load good-as-random code and execute it, albeit it is only the > > userspace. > > if you are using busybox init, you can signal it to kill everything, and > exec run the respawn entry in inittab. Your respawn entry can copy a > statiacly linked copy of whatever you are using to flash to a ramfs, > chroot/piviot_root to the ramfs and exec the program. once there, umount > the cramfs, and you can safely do whatever you want. > > > ______________________________________________________ > Linux MTD discussion mailing list > http://lists.infradead.org/mailman/listinfo/linux-mtd/ > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Updating the root partition 2002-06-19 23:22 ` Christopher Fowler @ 2002-06-19 23:29 ` Russ Dill 2002-06-19 23:56 ` Christopher Fowler 0 siblings, 1 reply; 9+ messages in thread From: Russ Dill @ 2002-06-19 23:29 UTC (permalink / raw) To: Christopher Fowler; +Cc: Jörn Engel, Chris AtLee, Linux MTD On Wed, 2002-06-19 at 16:22, Christopher Fowler wrote: > Going into a pseudo single user mode to flash is not acceptable. You > need to be able to flash from any tty. From any web interface. From > any command. My unit will flash with a simple flash command while the > system is running. right, you have a program that accepts a flash image, authenicates it, and copies it to a flash partition, once this is done, *then* you signal init. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Updating the root partition 2002-06-19 23:29 ` Russ Dill @ 2002-06-19 23:56 ` Christopher Fowler 2002-06-20 1:43 ` Russ Dill 0 siblings, 1 reply; 9+ messages in thread From: Christopher Fowler @ 2002-06-19 23:56 UTC (permalink / raw) To: Russ Dill; +Cc: Jörn Engel, Chris AtLee, Linux MTD In a way. On my system you have to restart to run on the new software. I have implemented a pseudo single user mode in init that will umount the rootfs and then dump the new software into memory. Ths keeps you from having to do a restart. However, this is not possible from remote locations. You must be on serial console to do this. That is why single user mode is not acceptable. Chris On Wed, 2002-06-19 at 19:29, Russ Dill wrote: > On Wed, 2002-06-19 at 16:22, Christopher Fowler wrote: > > Going into a pseudo single user mode to flash is not acceptable. You > > need to be able to flash from any tty. From any web interface. From > > any command. My unit will flash with a simple flash command while the > > system is running. > > right, you have a program that accepts a flash image, authenicates it, > and copies it to a flash partition, once this is done, *then* you signal > init. > > > ______________________________________________________ > Linux MTD discussion mailing list > http://lists.infradead.org/mailman/listinfo/linux-mtd/ > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Updating the root partition 2002-06-19 23:56 ` Christopher Fowler @ 2002-06-20 1:43 ` Russ Dill 2002-06-20 10:13 ` Stefan Thomasson 0 siblings, 1 reply; 9+ messages in thread From: Russ Dill @ 2002-06-20 1:43 UTC (permalink / raw) To: Christopher Fowler; +Cc: Jörn Engel, Chris AtLee, Linux MTD On Wed, 2002-06-19 at 16:56, Christopher Fowler wrote: > In a way. On my system you have to restart to run on the new software. > I have implemented a pseudo single user mode in init that will umount > the rootfs and then dump the new software into memory. Ths keeps you > from having to do a restart. However, this is not possible from remote > locations. You must be on serial console to do this. That is why > single user mode is not acceptable. I think you are a little confused on what is going on here, so I'll explain in detail. on my system, when it is normally up and running, an ftpd daemon is running when the ftpd daemon receives an upload, it verifies the integrity, and saves it in /var The ftpd daemon then sends a HUP signal to init because inittab contains the line: ::restart:/linuxex, init kills all running processes and exec's /linuxex linuxex now runs, and is the only running process on the system, linuxex is a shell script: /bin/umount /tmp /bin/umount /etc /bin/umount /proc /bin/cp /usr/sbin/flash /var /bin/cp -a /dev/nftla /var/out /bin/cp -a /dev/ttyS0 /var cd /var /bin/ln -s flash chroot /bin/mkdir old echo pivot root to var... pivot_root . old exec ./chroot . ./flash so now flash is the only program running, and its statiacally linked, so there are no more references to the cramfs root, and it can be umounted by flash. flash ten proceeds to flash the image, and reset the machine. ------ so as you can see, there is no pseudo single user mode required, and the flash image is received while the system is up and fully operational. As soon as the image is received and verified, the system basically goes down for a reboot, during which the new image is flashed. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Updating the root partition 2002-06-20 1:43 ` Russ Dill @ 2002-06-20 10:13 ` Stefan Thomasson 2002-06-20 11:47 ` cfowler 0 siblings, 1 reply; 9+ messages in thread From: Stefan Thomasson @ 2002-06-20 10:13 UTC (permalink / raw) To: Russ Dill; +Cc: Christopher Fowler, Jörn Engel, Chris AtLee, Linux MTD Hi, I'm trying to this whith a jffs2 partition and have some questions regarding this. Russ Dill wrote: > > > The ftpd daemon then sends a HUP signal to init Doesn't init only reread the inittab on a HUP? > > because inittab contains the line: ::restart:/linuxex, init kills all > running processes and exec's /linuxex Its not like going to runlevel 1, is it? restart, is this a special function in BB init? Could not find any info on this one, is it like a reboot? Or does it get executed everytime I starts? > > linuxex now runs, and is the only running process on the system, linuxex > is a shell script: > > /bin/umount /tmp > /bin/umount /etc > /bin/umount /proc > /bin/cp /usr/sbin/flash /var > /bin/cp -a /dev/nftla /var/out > /bin/cp -a /dev/ttyS0 /var > cd /var > /bin/ln -s flash chroot > /bin/mkdir old > echo pivot root to var... > pivot_root . old > exec ./chroot . ./flash Why are you running chroot symlinked to flash, unless its multi function... > > so now flash is the only program running, and its statiacally linked, so > there are no more references to the cramfs root, and it can be umounted > by flash. flash ten proceeds to flash the image, and reset the machine. > > ------ > > so as you can see, there is no pseudo single user mode required, and the > flash image is received while the system is up and fully operational. As > soon as the image is received and verified, the system basically goes > down for a reboot, during which the new image is flashed. Is this done for every reboot? ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Updating the root partition 2002-06-20 10:13 ` Stefan Thomasson @ 2002-06-20 11:47 ` cfowler 0 siblings, 0 replies; 9+ messages in thread From: cfowler @ 2002-06-20 11:47 UTC (permalink / raw) To: Stefan Thomasson; +Cc: Russ Dill, Jörn Engel, Chris AtLee, Linux MTD On Thu, 2002-06-20 at 06:13, Stefan Thomasson wrote: > Hi, I'm trying to this whith a jffs2 partition and > have some questions regarding this. > > > Russ Dill wrote: > > > > > > The ftpd daemon then sends a HUP signal to init > > Doesn't init only reread the inittab on a HUP? Not mine. Busybox and SysV does. but I wrote my own. > > > > > because inittab contains the line: ::restart:/linuxex, init kills all > > running processes and exec's /linuxex > > Its not like going to runlevel 1, is it? pseudo like. I guess. There are no runlevels in my machine > > restart, is this a special function in BB init? Could not find any info > on this one, > is it like a reboot? Or does it get executed everytime I starts? I wrote my own restart. You see when I want to restart, I tell the kernel to toggle the line that restarts the CPU. I do not want to shutdown. I do not care about data in memory. // Tell every USER_PROCESS we are restarting. wall_all(); printf("Restarting System...\n"); log_info("system restarting"); /* Sleep 1 second to give the message time */ /* Flush any Buffers */ // This is here to flush output on tty lines. No disk // is concerened. sync(); /* Take the system down */ reboot(0x01234567); Russ and My desgins are differernt. He may give you some comments too. > > > > > linuxex now runs, and is the only running process on the system, linuxex > > is a shell script: > > > > /bin/umount /tmp > > /bin/umount /etc > > /bin/umount /proc > > /bin/cp /usr/sbin/flash /var > > /bin/cp -a /dev/nftla /var/out > > /bin/cp -a /dev/ttyS0 /var > > cd /var > > /bin/ln -s flash chroot > > /bin/mkdir old > > echo pivot root to var... > > pivot_root . old > > exec ./chroot . ./flash > > Why are you running chroot symlinked to flash, unless its multi > function... > > > > > so now flash is the only program running, and its statiacally linked, so > > there are no more references to the cramfs root, and it can be umounted > > by flash. flash ten proceeds to flash the image, and reset the machine. > > > > ------ > > > > so as you can see, there is no pseudo single user mode required, and the > > flash image is received while the system is up and fully operational. As > > soon as the image is received and verified, the system basically goes > > down for a reboot, during which the new image is flashed. > > Is this done for every reboot? > > ______________________________________________________ > Linux MTD discussion mailing list > http://lists.infradead.org/mailman/listinfo/linux-mtd/ > > ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2002-06-20 11:39 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2002-06-19 15:18 Updating the root partition Chris AtLee 2002-06-19 22:23 ` Jörn Engel 2002-06-19 22:44 ` Russ Dill 2002-06-19 23:22 ` Christopher Fowler 2002-06-19 23:29 ` Russ Dill 2002-06-19 23:56 ` Christopher Fowler 2002-06-20 1:43 ` Russ Dill 2002-06-20 10:13 ` Stefan Thomasson 2002-06-20 11:47 ` cfowler
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox