最近工作機減肥搬環境
繞了一大圈失敗
想到之前看過別人這樣用Windows玩過
我就把它偷到shell下了
簡單講就是用RTC alarm去wake
用UEFI Shell改RTC跟shutdown
Shell下面用mm command應該也可以達成
但有現成的東西,直接改IoWrite8 port 70&71比較快
大概就這樣紀錄一下
巴哈真的很爛
沒有免費空間跟付費空間
只能留下廢文給自己參考
enabled RTC wake and set wakeup time to 00:02:00
Create UEFI Shell boot environment as follows
Drive:
│ startup.nsh
│ rtczero.efi
│ USB
│ readme.txt
│
└───EFI
├───boot
│ Bootx64.efi
rtczero.efi will cover RTC to 00:00:00 by write 70/71
Modify startup.nsh script as follows:
start--startup.nsh--
if exist fs0:\USB then
fs0:
endif
if exist fs1:\USB then
fs1:
endif
if exist fs2:\USB then
fs2:
endif
if exist fs3:\USB then
fs3:
endif
stall 5000000
rtczero.efi
reset -s
end--startup.nsh--
Create file named USB (no filename extension)in the drive
Test Shutdown and RTC boot USB detect over night
下面其實很多可以摘掉但我不整理了
因為只是多build很多垃圾不影響結果
--target.txt--start
ACTIVE_PLATFORM = 0gg/rtczero/AppPkg.dsc
TARGET = RELEASE
TARGET_ARCH = X64
TOOL_CHAIN_CONF = Conf/tools_def.txt
TOOL_CHAIN_TAG = VS2012x86
MAX_CONCURRENT_THREAD_NUMBER = 1
BUILD_RULE_CONF = Conf/build_rule.txt
--target.txt--end
--AppPkg.dec--
## @file
# Declarations for the UDK Standard Libraries.
#
# Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available under
# the terms and conditions of the BSD License which accompanies this distribution.
# The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
##
[Defines]
DEC_SPECIFICATION = 0x00010005
PACKAGE_NAME = AppPkg
PACKAGE_GUID = B3E3D3D5-D62B-4497-A175-264F489D127E
PACKAGE_VERSION = 0.01
[Guids]
gAppPkgTokenSpaceGuid = { 0xe7e1efa6, 0x7607, 0x4a78, { 0xa7, 0xdd, 0x43, 0xe4, 0xbd, 0x72, 0xc0, 0x99 }}
[PcdsFixedAtBuild]
gAppPkgTokenSpaceGuid.DataSource_Port|1234|UINT16|0
gAppPkgTokenSpaceGuid.Tftp_AckLogBase|4|UINT32|1
gAppPkgTokenSpaceGuid.Tftp_AckMultiplier|4|UINT32|2
gAppPkgTokenSpaceGuid.Tftp_Bandwidth|0|BOOLEAN|3
gAppPkgTokenSpaceGuid.Tftp_HighSpeed|0|BOOLEAN|4
gAppPkgTokenSpaceGuid.Tftp_MaxRetry|10|UINT32|5
gAppPkgTokenSpaceGuid.Tftp_MaxTimeoutInSec|3|UINT32|6
gAppPkgTokenSpaceGuid.WebServer_HttpPort|80|UINT16|7
--AppPkg.dec--end
--AppPkg.dsc--start
## @file
# Intel(r) UEFI Application Development Kit for EDK II.
# This package contains applications which depend upon Standard Libraries
# from the StdLib package.
#
# See the comments in the [LibraryClasses.IA32] and [BuildOptions] sections
# for important information about configuring this package for your
# environment.
#
# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
##
[Defines]
PLATFORM_NAME = Qoo
PLATFORM_GUID = 0458dade-8b6e-4e45-b773-1b27cbda3e06
PLATFORM_VERSION = 0.01
DSC_SPECIFICATION = 0x00010006
OUTPUT_DIRECTORY = 0Qoo
SUPPORTED_ARCHITECTURES = X64
BUILD_TARGETS = RELEASE
SKUID_IDENTIFIER = DEFAULT
#
# Debug output control
#
DEFINE DEBUG_ENABLE_OUTPUT = FALSE # Set to TRUE to enable debug output
DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x80000040 # Flags to control amount of debug output
DEFINE DEBUG_PROPERTY_MASK = 0
[PcdsFeatureFlag]
[PcdsFixedAtBuild]
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|$(DEBUG_PROPERTY_MASK)
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|$(DEBUG_PRINT_ERROR_LEVEL)
[PcdsFixedAtBuild.IPF]
[LibraryClasses]
#
# Entry Point Libraries
#
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
#
# Common Libraries
#
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
!if $(DEBUG_ENABLE_OUTPUT)
DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
!else ## DEBUG_ENABLE_OUTPUT
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
!endif ## DEBUG_ENABLE_OUTPUT
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
###################################################################################################
#
# Components Section - list of the modules and components that will be processed by compilation
# tools and the EDK II tools to generate PE32/PE32+/Coff image files.
#
# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
# into firmware volume images. This section is just a list of modules to compile from
# source into UEFI-compliant binaries.
# It is the FDF file that contains information on combining binary files into firmware
# volume images, whose concept is beyond UEFI and is described in PI specification.
# Binary modules do not need to be listed in this section, as they should be
# specified in the FDF file. For example: Shell binary (Shell_Full.efi), FAT binary (Fat.efi),
# Logo (Logo.bmp), and etc.
# There may also be modules listed in this section that are not required in the FDF file,
# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
# generated for it, but the binary will not be put into any firmware volume.
#
###################################################################################################
[Components]
#### Sample Applications.
# 0gg/Main/Main.inf # No LibC includes or functions.
# 0gg/Main/m.inf
# 0gg/Hello/Hello.inf
0gg/rtczero/1.inf
#C:\2012\0gg\IOW8
#### Un-comment the following line to build Python 2.7.2.
# AppPkg/Applications/Python/PythonCore.inf
#### Un-comment the following line to build Python 2.7.10.
# AppPkg/Applications/Python/Python-2.7.10/Python2710.inf
#### Un-comment the following line to build Lua.
# AppPkg/Applications/Lua/Lua.inf
##############################################################################
#
# Specify whether we are running in an emulation environment, or not.
# Define EMULATE if we are, else keep the DEFINE commented out.
#
# DEFINE EMULATE = 1
##############################################################################
#
# Include Boilerplate text required for building with the Standard Libraries.
#
##############################################################################
!include StdLib/StdLib.inc
!include AppPkg/Applications/Sockets/Sockets.inc
--AppPkg.dsc--end
--1.inf--start
## @file
# A simple, basic, application showing how the Hello application could be
# built using the "Standard C Libraries" from StdLib.
#
# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
##
[Defines]
INF_VERSION = 0x00010006
BASE_NAME = 1
FILE_GUID = 4ea88c46-7491-4dfd-b442-747010f3ce5f
MODULE_TYPE = UEFI_APPLICATION
VERSION_STRING = 0.1
ENTRY_POINT = ShellCEntryLib
#
# VALID_ARCHITECTURES = IA32 X64
#
[Sources]
1.c
[Packages]
StdLib/StdLib.dec
MdePkg/MdePkg.dec
ShellPkg/ShellPkg.dec
OvmfPkg/OvmfPkg.dec
MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
UefiLib
IoLib
ShellCEntryLib
LibC
# UefiLib
# ShellCEntryLib
--1.inf--end
--1.c--start
//CMOS RTC - Real Time Clock and Memory (ports 70h & 71h)
//Reg#
//00 RTC seconds Rs
//01 RTC seconds alarm Rsa
//02 RTC minutes Rm
//03 RTC minutes alarm Rma
//04 RTC hours Rh
//05 RTC hours alarm Rha
//06 RTC day of week
//07 RTC day of month
//08 RTC month
//09 RTC year
//0A RTC Status register A:
#include <stdio.h>
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/ShellCEntryLib.h>
#include <Library/IoLib.h>
int main (IN int Argc,IN char **Argv)
{
IoWrite8 (0x70, 0x04);
IoWrite8 (0x71, 0);
IoWrite8 (0x70, 0x02);
IoWrite8 (0x71, 0);
IoWrite8 (0x70, 0x00);
IoWrite8 (0x71, 0);
}
--1.c--end