Ticket #36 (closed task: fixed)

Opened 3 years ago

Last modified 2 years ago

Boot OI from SD or internal memory

Reported by: dottedmag Owned by: dottedmag
Priority: normal Milestone: 0.1
Component: buildsystem Version:
Keywords: Cc: pit
Blocking: Blocked By:

Description

We need the dual-boot firmware which allows booting from NFS if key was pressed at the some stage of startup.

This will allow booting development image from NFS while still using device as a regular book.

Idea:

  • nfsboot kernel at 2nd megabyte, booted by bootloader
  • bootloader boots without root=/dev/nfs
  • rcS waits for keypress and kexec's current kernel with root=/dev/nfs if pressed
  • else kexecs original kernel (from some unused place on flash)

Attachments

keypressed Download (6.8 KB) - added by pit 2 years ago.

Change History

Changed 2 years ago by pit

Changed 2 years ago by pit

here is my programs for button reacting

#include <stdio.h>
#include <time.h>
#include <linux/input.h>

#define WAIT_TIME 2
#define INPUT_DEV "/dev/input/event0"

int main ()
	{
	clock_t endwait;
	int lng;
	int fd;	

	endwait = clock () + WAIT_TIME * (CLOCKS_PER_SEC);
	fd = open(INPUT_DEV, O_RDONLY|O_NONBLOCK)
	if (fd == -1)
		{
		printf("error opening file\n");
		return 0;
		}

	while (clock() < endwait)
		{
		lng = read(fd, &data, sizeof(data));
		if(lng != -1)
			{			
			close(fd);
			//printf("1\n");			
			return 1;
			}
		}

	close(fd);
	//printf("0\n");
	return 0;
	}

as you can see, it's reacting on any evdev event (key pressed, key released, etc). #defines should be params, but i'm to lazy to do checking and stuff, and this is program-for-a-one-time anyway. this program used by following script:

#!/bin/sh

/home/key
if [ "$?" = "1" ]; then
	echo 1
	kexec -l /zImage
	kexec -e
fi
echo 0

Changed 2 years ago by dottedmag

  • milestone changed from 0.1 to 0.2

There's a problem with kexec-like functionality for Hanlin kernel, so deferring it a bit.

Changed 2 years ago by dottedmag

  • summary changed from dual-boot firmware to Boot OI from SD or internal memory
  • milestone changed from 0.2 to 0.1

We've got kexec replacement (reloaded.ko) working, so no need to reflash the original firmware - it should be enough to put OI to the SD/internal memory and boot into it using a reloaded.ko.

Targeting 0.1, should be easy to do.

Changed 2 years ago by dottedmag

  • status changed from new to closed
  • resolution set to fixed

OI-on-SD implemented, thanks to jekhor.

Note: See TracTickets for help on using tickets.