aboutsummaryrefslogtreecommitdiff
path: root/docs/future/fastboot/grub.cfg.memdisk
blob: fb3a65203bc865dfc3bb1bfc76efaeea2a2927a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#### This goes into the memdisk (3rd alternative: hard drive not found and no config file in the cbfs)

### Add regular keyboard support
terminal_input --append at_keyboard

### We are standalone
set prefix=(memdisk)/boot/grub

### If grub.cfg is on the disk or the cbfs, try to load it
if [ -f "(ahci0,1)/grub.cfg" ] ; then
	source (ahci0,1)/grub.cfg
else
 if [ -f "(ahci0,2)/grub.cfg" ] ; then
	source (ahci0,2)/grub.cfg
 else
  if [ -f "(ahci0,3)/grub.cfg" ] ; then
	source (ahci0,3)/grub.cfg
  else
   if [ -f "(ahci0,4)/grub.cfg" ] ; then
	source (ahci0,4)/grub.cfg
   else
	if [ -f "(cbfsdisk)/etc/grub.cfg" ] ; then
		# play 1 beep to say something is wrong
		play 480 440 1
		source (cbfsdisk)/etc/grub.cfg
	else
		# play 2 beeps to say something is quite wrong
		play 480 440 1
		play 480 440 1
		# add integrated serial port:
		serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
		terminal_input  --append serial
		terminal_output --append serial
		# add usb serial:
		insmod nativedisk
		insmod ehci
		insmod ohci
		insmod uhci
		insmod usb
		insmod usbserial_pl2303
		insmod usbserial_ftdi
		insmod usbserial_usbdebug
		serial --speed=115200 --word=8 --parity=no --stop=1 usb1
		terminal_input  --append serial_usb1
		terminal_output --append serial_usb1

		# Default to the first entry after 10 seconds to try and type blindly if needed
		set default=1
		set timeout=10
		# Here are the entries
		menuentry 'MEMDISK: SeaBIOS' {
			chainloader (cbfsdisk)/elf/seabios.elf
		}
		menuentry 'MEMDISK: a kernel with root on /dev/sda1' {
			linux  (ahci0,1)/bzImage root=/dev/sda1 ro quiet
		}
		menuentry 'MEMDISK: Indicate normal coreboot success' {
			cmosclean 0x30:0
			cmosclean 0x30:1
			cmosclean 0x30:2
			cmosclean 0x30:3
			cmosclean 0x30:4
			cmosclean 0x30:5
		}
		menuentry 'MEMDISK: to show coreboot CBMEM logs, type' {
			set pager=1
			cbmemc
			set pager=0
		}
		menuentry 'MEMDISK: to show coreboot CBFS content, type' {
			lscoreboot
			error
		}
		menuentry 'MEMDISK: to show coreboot TIMESTAMPS, type' {
			coreboot_boottime
			error
		}
		menuentry 'MEMDISK: reboot' {
			# reset to normal
			cmosclean 48:0
			cmosclean 48:1
			# reset boot count
			cmosclean 48:4
			cmosclean 48:5
			cmosclean 48:6
			cmosclean 48:7
			# rebooting makes it impossible to shut down with normal.
			reboot
		}
		menuentry 'MEMDISK: halt' {
			# reset to normal
			cmosclean 48:0
			cmosclean 48:1
			# reset boot count
			cmosclean 48:4
			cmosclean 48:5
			cmosclean 48:6
			cmosclean 48:7
			# rebooting makes it impossible to shut down with normal.
			halt
		}
	fi
   fi
  fi
 fi
fi